Client LuaCsForBarotrauma
MissionStateAction.cs
1
namespace
Barotrauma
2
{
3
7
class
MissionStateAction
:
EventAction
8
{
9
[
Serialize
(
""
,
IsPropertySaveable
.Yes, description:
"Identifier of the mission whose state to change."
)]
10
public
Identifier
MissionIdentifier
{
get
;
set
; }
11
12
public
enum
OperationType
13
{
14
Set,
15
Add
16
}
17
18
[
Serialize
(
OperationType
.Set,
IsPropertySaveable
.Yes, description:
"Should the value be added to the state of the mission, or should the state be set to the specified value."
)]
19
public
OperationType
Operation
{
get
;
set
; }
20
21
[
Serialize
(0,
IsPropertySaveable
.Yes, description:
"The state to set the mission to, or how much to add to the state of the mission."
)]
22
public
int
State
{
get
;
set
; }
23
24
private
bool
isFinished;
25
26
public
MissionStateAction
(
ScriptedEvent
parentEvent,
ContentXElement
element) : base(parentEvent, element)
27
{
28
State
= element.
GetAttributeInt
(
"value"
,
State
);
29
if
(
MissionIdentifier
.IsEmpty)
30
{
31
DebugConsole.ThrowError($
"Error in event \"{parentEvent.Prefab.Identifier}\": MissionIdentifier has not been configured."
,
32
contentPackage: element.
ContentPackage
);
33
}
34
}
35
36
public
override
bool
IsFinished
(ref
string
goTo)
37
{
38
return
isFinished;
39
}
40
public
override
void
Reset
()
41
{
42
isFinished =
false
;
43
}
44
45
public
override
void
Update
(
float
deltaTime)
46
{
47
if
(isFinished) {
return
; }
48
49
foreach
(
Mission
mission
in
GameMain
.
GameSession
.
Missions
)
50
{
51
if
(mission.
Prefab
.
Identifier
!=
MissionIdentifier
) {
continue
; }
52
switch
(
Operation
)
53
{
54
case
OperationType
.Set:
55
mission.
State
=
State
;
56
break
;
57
case
OperationType
.Add:
58
mission.
State
+= 1;
59
break
;
60
}
61
}
62
63
isFinished =
true
;
64
}
65
66
public
override
string
ToDebugString
()
67
{
68
return
$
"{ToolBox.GetDebugSymbol(isFinished)} {nameof(MissionStateAction)} -> ({(Operation == OperationType.Set ? State : '+' + State)})"
;
69
}
70
}
71
}
Barotrauma.ContentXElement
Definition:
ContentXElement.cs:13
Barotrauma.ContentXElement.ContentPackage
ContentPackage? ContentPackage
Definition:
ContentXElement.cs:14
Barotrauma.ContentXElement.GetAttributeInt
int GetAttributeInt(string key, int def)
Barotrauma.EventAction
Definition:
EventAction.cs:9
Barotrauma.GameMain
Definition:
GameMain.cs:25
Barotrauma.GameMain.GameSession
static GameSession?? GameSession
Definition:
GameMain.cs:88
Barotrauma.GameSession.Missions
IEnumerable< Mission > Missions
Definition:
BarotraumaShared/SharedSource/GameSession/GameSession.cs:42
Barotrauma.Mission
Definition:
BarotraumaShared/SharedSource/Events/Missions/Mission.cs:14
Barotrauma.Mission.State
virtual int? State
Definition:
BarotraumaShared/SharedSource/Events/Missions/Mission.cs:23
Barotrauma.Mission.Prefab
readonly MissionPrefab Prefab
Definition:
BarotraumaShared/SharedSource/Events/Missions/Mission.cs:15
Barotrauma.MissionStateAction
Changes the state of a specific active mission. The way the states are used depends on the type of mi...
Definition:
MissionStateAction.cs:8
Barotrauma.MissionStateAction.Update
override void Update(float deltaTime)
Definition:
MissionStateAction.cs:45
Barotrauma.MissionStateAction.Operation
OperationType Operation
Definition:
MissionStateAction.cs:19
Barotrauma.MissionStateAction.IsFinished
override bool IsFinished(ref string goTo)
Has the action finished.
Definition:
MissionStateAction.cs:36
Barotrauma.MissionStateAction.MissionStateAction
MissionStateAction(ScriptedEvent parentEvent, ContentXElement element)
Definition:
MissionStateAction.cs:26
Barotrauma.MissionStateAction.OperationType
OperationType
Definition:
MissionStateAction.cs:13
Barotrauma.MissionStateAction.MissionIdentifier
Identifier MissionIdentifier
Definition:
MissionStateAction.cs:10
Barotrauma.MissionStateAction.ToDebugString
override string ToDebugString()
Rich test to display in debugdraw
Definition:
MissionStateAction.cs:66
Barotrauma.MissionStateAction.Reset
override void Reset()
Definition:
MissionStateAction.cs:40
Barotrauma.MissionStateAction.State
int State
Definition:
MissionStateAction.cs:22
Barotrauma.Prefab.Identifier
readonly Identifier Identifier
Definition:
Prefab.cs:34
Barotrauma.ScriptedEvent
Definition:
ScriptedEvent.cs:9
Barotrauma.Serialize
Definition:
SerializableProperty.cs:23
Barotrauma
Definition:
AchievementManager.cs:12
Barotrauma.IsPropertySaveable
IsPropertySaveable
Definition:
SerializableProperty.cs:16
Barotrauma
BarotraumaShared
SharedSource
Events
EventActions
MissionStateAction.cs
Generated by
1.9.1