Client LuaCsForBarotrauma
SetTraitorEventStateAction.cs
1
#nullable enable
2
3
namespace
Barotrauma
4
{
8
class
SetTraitorEventStateAction
:
EventAction
9
{
10
private
readonly
TraitorEvent
? traitorEvent;
11
12
public
SetTraitorEventStateAction
(
ScriptedEvent
parentEvent,
ContentXElement
element) : base(parentEvent, element)
13
{
14
if
(parentEvent is
TraitorEvent
traitorEvent)
15
{
16
this.traitorEvent = traitorEvent;
17
}
18
else
19
{
20
DebugConsole.ThrowError($
"Cannot use the action {nameof(SetTraitorEventStateAction)} in the event \"{parentEvent.Prefab.Identifier}\" because it's not a traitor event."
,
21
contentPackage: element.
ContentPackage
);
22
}
23
}
24
25
[
Serialize
(
TraitorEvent
.
State
.Completed,
IsPropertySaveable
.Yes, description:
"The state to set the traitor event to (Incomplete, Completed or Failed)."
)]
26
public
TraitorEvent
.
State
State
{
get
;
set
; }
27
28
private
bool
isFinished;
29
30
public
override
bool
IsFinished
(ref
string
goTo)
31
{
32
return
isFinished;
33
}
34
35
public
override
void
Reset
()
36
{
37
isFinished =
false
;
38
}
39
40
public
override
void
Update
(
float
deltaTime)
41
{
42
if
(isFinished || traitorEvent ==
null
) {
return
; }
43
traitorEvent.CurrentState =
State
;
44
isFinished =
true
;
45
}
46
47
public
override
string
ToDebugString
()
48
{
49
return
$
"{ToolBox.GetDebugSymbol(isFinished)} {nameof(SetTraitorEventStateAction)} -> (State: {State})"
;
50
}
51
}
52
}
Barotrauma.ContentXElement
Definition:
ContentXElement.cs:13
Barotrauma.ContentXElement.ContentPackage
ContentPackage? ContentPackage
Definition:
ContentXElement.cs:14
Barotrauma.EventAction
Definition:
EventAction.cs:9
Barotrauma.ScriptedEvent
Definition:
ScriptedEvent.cs:9
Barotrauma.Serialize
Definition:
SerializableProperty.cs:23
Barotrauma.SetTraitorEventStateAction
Sets the state of the traitor event. Only valid in traitor events.
Definition:
SetTraitorEventStateAction.cs:9
Barotrauma.SetTraitorEventStateAction.IsFinished
override bool IsFinished(ref string goTo)
Has the action finished.
Definition:
SetTraitorEventStateAction.cs:30
Barotrauma.SetTraitorEventStateAction.SetTraitorEventStateAction
SetTraitorEventStateAction(ScriptedEvent parentEvent, ContentXElement element)
Definition:
SetTraitorEventStateAction.cs:12
Barotrauma.SetTraitorEventStateAction.Update
override void Update(float deltaTime)
Definition:
SetTraitorEventStateAction.cs:40
Barotrauma.SetTraitorEventStateAction.State
TraitorEvent.State State
Definition:
SetTraitorEventStateAction.cs:26
Barotrauma.SetTraitorEventStateAction.ToDebugString
override string ToDebugString()
Rich test to display in debugdraw
Definition:
SetTraitorEventStateAction.cs:47
Barotrauma.SetTraitorEventStateAction.Reset
override void Reset()
Definition:
SetTraitorEventStateAction.cs:35
Barotrauma.TraitorEvent
Definition:
TraitorEvent.cs:10
Barotrauma.TraitorEvent.State
State
Definition:
TraitorEvent.cs:12
Barotrauma
Definition:
AchievementManager.cs:12
Barotrauma.IsPropertySaveable
IsPropertySaveable
Definition:
SerializableProperty.cs:16
Barotrauma
BarotraumaShared
SharedSource
Events
EventActions
SetTraitorEventStateAction.cs
Generated by
1.9.1