Client LuaCsForBarotrauma
TriggerEventAction.cs
1
namespace
Barotrauma
2
{
6
class
TriggerEventAction
:
EventAction
7
{
8
[
Serialize
(
""
,
IsPropertySaveable
.Yes, description:
"Identifier of the event to trigger."
)]
9
public
Identifier
Identifier
{
get
;
set
; }
10
11
[
Serialize
(
""
,
IsPropertySaveable
.Yes, description:
"Tag of the event to trigger."
)]
12
public
Identifier
EventTag
{
get
;
set
; }
13
14
[
Serialize
(
false
,
IsPropertySaveable
.Yes, description:
"If set to true, the event will trigger at the beginning of the next round. Useful for e.g. triggering some scripted event in the outpost after you finish a mission."
)]
15
public
bool
NextRound
{
get
;
set
; }
16
17
private
bool
isFinished;
18
19
public
TriggerEventAction
(
ScriptedEvent
parentEvent,
ContentXElement
element) : base(parentEvent, element) { }
20
21
public
override
bool
IsFinished
(ref
string
goTo)
22
{
23
return
isFinished;
24
}
25
public
override
void
Reset
()
26
{
27
isFinished =
false
;
28
}
29
30
public
override
void
Update
(
float
deltaTime)
31
{
32
if
(isFinished) {
return
; }
33
34
if
(
GameMain
.
GameSession
?.
EventManager
!=
null
)
35
{
36
if
(
NextRound
)
37
{
38
GameMain
.
GameSession
.
EventManager
.
QueuedEventsForNextRound
.Enqueue(
Identifier
);
39
}
40
else
41
{
42
EventPrefab
eventPrefab =
EventPrefab
.
FindEventPrefab
(
Identifier
,
EventTag
,
ParentEvent
.
Prefab
.
ContentPackage
);
43
if
(eventPrefab !=
null
)
44
{
45
var ev = eventPrefab.
CreateInstance
(
GameMain
.
GameSession
.
EventManager
.
RandomSeed
);
46
if
(ev !=
null
)
47
{
48
GameMain
.
GameSession
.
EventManager
.
QueuedEvents
.Enqueue(ev);
49
}
50
}
51
}
52
}
53
54
isFinished =
true
;
55
}
56
57
public
override
string
ToDebugString
()
58
{
59
return
$
"{ToolBox.GetDebugSymbol(isFinished)} {nameof(TriggerEventAction)} -> (EventPrefab: {Identifier.ColorizeObject()})"
;
60
}
61
}
62
}
Barotrauma.ContentXElement
Definition:
ContentXElement.cs:13
Barotrauma.EventAction
Definition:
EventAction.cs:9
Barotrauma.EventAction.ParentEvent
readonly ScriptedEvent ParentEvent
Definition:
EventAction.cs:106
Barotrauma.Event.Prefab
EventPrefab Prefab
Definition:
Event.cs:16
Barotrauma.EventManager.QueuedEvents
readonly Queue< Event > QueuedEvents
Definition:
BarotraumaShared/SharedSource/Events/EventManager.cs:118
Barotrauma.EventManager.QueuedEventsForNextRound
readonly Queue< Identifier > QueuedEventsForNextRound
Definition:
BarotraumaShared/SharedSource/Events/EventManager.cs:120
Barotrauma.EventManager.RandomSeed
int RandomSeed
Definition:
BarotraumaShared/SharedSource/Events/EventManager.cs:147
Barotrauma.EventPrefab
Definition:
EventPrefab.cs:10
Barotrauma.EventPrefab.CreateInstance
Event CreateInstance(int seed)
Definition:
EventPrefab.cs:127
Barotrauma.EventPrefab.FindEventPrefab
static EventPrefab FindEventPrefab(Identifier identifier, Identifier tag, ContentPackage source)
Finds an event prefab with the specified identifier, or if it isn't defined, a random event prefab wi...
Definition:
EventPrefab.cs:167
Barotrauma.GameMain
Definition:
GameMain.cs:25
Barotrauma.GameMain.GameSession
static GameSession?? GameSession
Definition:
GameMain.cs:88
Barotrauma.GameSession.EventManager
readonly EventManager EventManager
Definition:
BarotraumaShared/SharedSource/GameSession/GameSession.cs:69
Barotrauma.Prefab.ContentPackage
ContentPackage? ContentPackage
Definition:
Prefab.cs:37
Barotrauma.ScriptedEvent
Definition:
ScriptedEvent.cs:9
Barotrauma.Serialize
Definition:
SerializableProperty.cs:23
Barotrauma.TriggerEventAction
Triggers another event (can also trigger things other than scripted events, for example monster event...
Definition:
TriggerEventAction.cs:7
Barotrauma.TriggerEventAction.EventTag
Identifier EventTag
Definition:
TriggerEventAction.cs:12
Barotrauma.TriggerEventAction.Update
override void Update(float deltaTime)
Definition:
TriggerEventAction.cs:30
Barotrauma.TriggerEventAction.TriggerEventAction
TriggerEventAction(ScriptedEvent parentEvent, ContentXElement element)
Definition:
TriggerEventAction.cs:19
Barotrauma.TriggerEventAction.IsFinished
override bool IsFinished(ref string goTo)
Has the action finished.
Definition:
TriggerEventAction.cs:21
Barotrauma.TriggerEventAction.ToDebugString
override string ToDebugString()
Rich test to display in debugdraw
Definition:
TriggerEventAction.cs:57
Barotrauma.TriggerEventAction.Reset
override void Reset()
Definition:
TriggerEventAction.cs:25
Barotrauma.TriggerEventAction.NextRound
bool NextRound
Definition:
TriggerEventAction.cs:15
Barotrauma.TriggerEventAction.Identifier
Identifier Identifier
Definition:
TriggerEventAction.cs:9
Barotrauma
Definition:
AchievementManager.cs:12
Barotrauma.IsPropertySaveable
IsPropertySaveable
Definition:
SerializableProperty.cs:16
Barotrauma
BarotraumaShared
SharedSource
Events
EventActions
TriggerEventAction.cs
Generated by
1.9.1