Client LuaCsForBarotrauma
SonarTransducer.cs
1 using System.Xml.Linq;
2 
4 {
6  {
7  const float SendSignalInterval = 0.5f;
8 
9  private float sendSignalTimer;
10 
12 
13  public SonarTransducer(Item item, ContentXElement element) : base(item, element)
14  {
15  IsActive = true;
16  }
17 
18  public override void Update(float deltaTime, Camera cam)
19  {
20  UpdateOnActiveEffects(deltaTime);
21 
22  if (HasPower)
23  {
24  sendSignalTimer += deltaTime;
25  if (sendSignalTimer > SendSignalInterval)
26  {
27  item.SendSignal("0101101101101011010", "data_out");
28  sendSignalTimer = SendSignalInterval;
29  }
30  }
31  }
32 
33  public override float GetCurrentPowerConsumption(Connection connection = null)
34  {
35  if (connection != powerIn || !IsActive)
36  {
37  return 0;
38  }
39 
41  }
42  }
43 }
void SendSignal(string signal, string connectionName)
override float GetCurrentPowerConsumption(Connection connection=null)
Current power consumption of the device (or amount of generated power if negative)
SonarTransducer(Item item, ContentXElement element)
override void Update(float deltaTime, Camera cam)