Client LuaCsForBarotrauma
ExponentiationComponent.cs
1
using
System.Globalization;
2
using
System.Xml.Linq;
3
4
namespace
Barotrauma.Items.Components
5
{
6
class
ExponentiationComponent
:
ItemComponent
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
22
public
ExponentiationComponent
(
Item
item
,
ContentXElement
element)
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
}
Barotrauma.ContentXElement
Definition:
ContentXElement.cs:13
Barotrauma.Item
Definition:
BarotraumaShared/SharedSource/Items/Item.cs:26
Barotrauma.Item.SendSignal
void SendSignal(string signal, string connectionName)
Definition:
BarotraumaShared/SharedSource/Items/Item.cs:2930
Barotrauma.Items.Components.Connection
Definition:
BarotraumaShared/SharedSource/Items/Components/Signal/Connection.cs:10
Barotrauma.Items.Components.Connection.Name
readonly string Name
Definition:
BarotraumaShared/SharedSource/Items/Components/Signal/Connection.cs:20
Barotrauma.Items.Components.ExponentiationComponent
Definition:
ExponentiationComponent.cs:7
Barotrauma.Items.Components.ExponentiationComponent.ReceiveSignal
override void ReceiveSignal(Signal signal, Connection connection)
Definition:
ExponentiationComponent.cs:28
Barotrauma.Items.Components.ExponentiationComponent.ExponentiationComponent
ExponentiationComponent(Item item, ContentXElement element)
Definition:
ExponentiationComponent.cs:22
Barotrauma.Items.Components.ExponentiationComponent.Exponent
float Exponent
Definition:
ExponentiationComponent.cs:11
Barotrauma.Items.Components.ItemComponent
The base class for components holding the different functionalities of the item
Definition:
BarotraumaShared/SharedSource/Items/Components/ItemComponent.cs:35
Barotrauma.Items.Components.ItemComponent.item
Item item
Definition:
BarotraumaShared/SharedSource/Items/Components/ItemComponent.cs:36
Barotrauma.Items.Components.ItemComponent.IsActive
virtual bool? IsActive
Definition:
BarotraumaShared/SharedSource/Items/Components/ItemComponent.cs:114
Barotrauma.Serialize
Definition:
SerializableProperty.cs:23
InGameEditable
Definition:
Editable.cs:60
Barotrauma.Items.Components
Definition:
BarotraumaShared/SharedSource/Items/Components/DockingPort.cs:15
Barotrauma.IsPropertySaveable
IsPropertySaveable
Definition:
SerializableProperty.cs:16
Barotrauma.Items.Components.Signal
Definition:
Signal.cs:4
Barotrauma.Items.Components.Signal.value
string value
Definition:
Signal.cs:5
Barotrauma
BarotraumaShared
SharedSource
Items
Components
Signal
ExponentiationComponent.cs
Generated by
1.9.1