Client LuaCsForBarotrauma
GreaterComponent.cs
1
using
System.Globalization;
2
using
System.Xml.Linq;
3
4
namespace
Barotrauma.Items.Components
5
{
6
class
GreaterComponent
:
EqualsComponent
7
{
8
private
float
val1, val2;
9
10
public
GreaterComponent
(
Item
item
,
ContentXElement
element)
11
: base(
item
, element)
12
{
13
IsActive
=
true
;
14
}
15
16
public
override
void
Update
(
float
deltaTime,
Camera
cam)
17
{
18
bool
sendOutput =
false
;
19
for
(
int
i = 0; i <
timeSinceReceived
.Length; i++)
20
{
21
if
(
timeSinceReceived
[i] <=
timeFrame
) sendOutput =
true
;
22
timeSinceReceived
[i] += deltaTime;
23
}
24
25
if
(sendOutput)
26
{
27
string
signalOut = val1 > val2 ?
output
: falseOutput;
28
if
(
string
.IsNullOrEmpty(signalOut))
return
;
29
30
item
.
SendSignal
(signalOut,
"signal_out"
);
31
}
32
}
33
34
public
override
void
ReceiveSignal
(
Signal
signal,
Connection
connection)
35
{
36
//base.ReceiveSignal(signal, connection);
37
switch
(connection.
Name
)
38
{
39
case
"signal_in1"
:
40
float
.TryParse(signal.
value
, NumberStyles.Float, CultureInfo.InvariantCulture, out val1);
41
timeSinceReceived
[0] = 0.0f;
42
break
;
43
case
"signal_in2"
:
44
float
.TryParse(signal.
value
, NumberStyles.Float, CultureInfo.InvariantCulture, out val2);
45
timeSinceReceived
[1] = 0.0f;
46
break
;
47
case
"set_output"
:
48
output
= signal.
value
;
49
break
;
50
}
51
}
52
}
53
}
Barotrauma.Camera
Definition:
Camera.cs:10
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.EqualsComponent
Definition:
EqualsComponent.cs:7
Barotrauma.Items.Components.EqualsComponent.timeFrame
float timeFrame
Definition:
EqualsComponent.cs:18
Barotrauma.Items.Components.EqualsComponent.timeSinceReceived
float[] timeSinceReceived
Definition:
EqualsComponent.cs:11
Barotrauma.Items.Components.EqualsComponent.output
string output
Definition:
EqualsComponent.cs:8
Barotrauma.Items.Components.GreaterComponent
Definition:
GreaterComponent.cs:7
Barotrauma.Items.Components.GreaterComponent.GreaterComponent
GreaterComponent(Item item, ContentXElement element)
Definition:
GreaterComponent.cs:10
Barotrauma.Items.Components.GreaterComponent.ReceiveSignal
override void ReceiveSignal(Signal signal, Connection connection)
Definition:
GreaterComponent.cs:34
Barotrauma.Items.Components.GreaterComponent.Update
override void Update(float deltaTime, Camera cam)
Definition:
GreaterComponent.cs:16
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.Items.Components
Definition:
BarotraumaShared/SharedSource/Items/Components/DockingPort.cs:15
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
GreaterComponent.cs
Generated by
1.9.1