Client LuaCsForBarotrauma
ExponentiationComponent.cs
1 using System.Globalization;
2 using System.Xml.Linq;
3 
5 {
7  {
8  private float exponent;
9  [InGameEditable, Serialize(1.0f, IsPropertySaveable.No, description: "The exponent of the operation.", alwaysUseInstanceValues: true)]
10  public float Exponent
11  {
12  get
13  {
14  return exponent;
15  }
16  set
17  {
18  exponent = value;
19  }
20  }
21 
23  : base(item, element)
24  {
25  IsActive = true;
26  }
27 
28  public override void ReceiveSignal(Signal signal, Connection connection)
29  {
30  switch (connection.Name)
31  {
32  case "set_exponent":
33  case "exponent":
34  float.TryParse(signal.value, NumberStyles.Float, CultureInfo.InvariantCulture, out exponent);
35  break;
36  case "signal_in":
37  float.TryParse(signal.value, NumberStyles.Float, CultureInfo.InvariantCulture, out float value);
38  signal.value = MathUtils.Pow(value, Exponent).ToString("G", CultureInfo.InvariantCulture);
39  item.SendSignal(signal, "signal_out");
40  break;
41  }
42  }
43  }
44 }
void SendSignal(string signal, string connectionName)
override void ReceiveSignal(Signal signal, Connection connection)
ExponentiationComponent(Item item, ContentXElement element)
The base class for components holding the different functionalities of the item