Client LuaCsForBarotrauma
GiveSkillExpAction.cs
1
using
System.Linq;
2
3
namespace
Barotrauma
4
{
8
class
GiveSkillExpAction
:
EventAction
9
{
10
[
Serialize
(
""
,
IsPropertySaveable
.Yes, description:
"Identifier of the skill to increase."
)]
11
public
Identifier
Skill
{
get
;
set
; }
12
13
[
Serialize
(0.0f,
IsPropertySaveable
.Yes, description:
"How much the skill should increase."
)]
14
public
float
Amount
{
get
;
set
; }
15
16
[
Serialize
(
""
,
IsPropertySaveable
.Yes, description:
"Tag of the character(s) whose skill to increase."
)]
17
public
Identifier
TargetTag
{
get
;
set
; }
18
19
public
GiveSkillExpAction
(
ScriptedEvent
parentEvent,
ContentXElement
element) : base(parentEvent, element)
20
{
21
if
(
TargetTag
.IsEmpty)
22
{
23
DebugConsole.ThrowError($
"Error in event \"{parentEvent.Prefab.Identifier}\": {nameof(GiveSkillExpAction)} without a target tag (the action needs to know whose skill to check)."
,
24
contentPackage: element.
ContentPackage
);
25
}
26
}
27
28
private
bool
isFinished =
false
;
29
30
public
override
bool
IsFinished
(ref
string
goTo)
31
{
32
return
isFinished;
33
}
34
public
override
void
Reset
()
35
{
36
isFinished =
false
;
37
}
38
39
public
override
void
Update
(
float
deltaTime)
40
{
41
if
(isFinished) {
return
; }
42
var targets =
ParentEvent
.
GetTargets
(
TargetTag
).Where(e => e is
Character
).Select(e => e as
Character
);
43
foreach
(var target
in
targets)
44
{
45
target.Info?.IncreaseSkillLevel(
Skill
,
Amount
);
46
}
47
isFinished =
true
;
48
}
49
50
public
override
string
ToDebugString
()
51
{
52
return
$
"{ToolBox.GetDebugSymbol(isFinished)} {nameof(GiveSkillExpAction)} -> (TargetTag: {TargetTag.ColorizeObject()}, "
+
53
$
"Skill: {Skill.ColorizeObject()}, Amount: {Amount.ColorizeObject()})"
;
54
}
55
}
56
}
Barotrauma.Character
Definition:
BarotraumaShared/SharedSource/Characters/Character.cs:32
Barotrauma.ContentXElement
Definition:
ContentXElement.cs:13
Barotrauma.ContentXElement.ContentPackage
ContentPackage? ContentPackage
Definition:
ContentXElement.cs:14
Barotrauma.EventAction
Definition:
EventAction.cs:9
Barotrauma.EventAction.ParentEvent
readonly ScriptedEvent ParentEvent
Definition:
EventAction.cs:106
Barotrauma.GiveSkillExpAction
Increases the skill level of a specific character.
Definition:
GiveSkillExpAction.cs:9
Barotrauma.GiveSkillExpAction.GiveSkillExpAction
GiveSkillExpAction(ScriptedEvent parentEvent, ContentXElement element)
Definition:
GiveSkillExpAction.cs:19
Barotrauma.GiveSkillExpAction.Update
override void Update(float deltaTime)
Definition:
GiveSkillExpAction.cs:39
Barotrauma.GiveSkillExpAction.Reset
override void Reset()
Definition:
GiveSkillExpAction.cs:34
Barotrauma.GiveSkillExpAction.ToDebugString
override string ToDebugString()
Rich test to display in debugdraw
Definition:
GiveSkillExpAction.cs:50
Barotrauma.GiveSkillExpAction.IsFinished
override bool IsFinished(ref string goTo)
Has the action finished.
Definition:
GiveSkillExpAction.cs:30
Barotrauma.GiveSkillExpAction.TargetTag
Identifier TargetTag
Definition:
GiveSkillExpAction.cs:17
Barotrauma.GiveSkillExpAction.Amount
float Amount
Definition:
GiveSkillExpAction.cs:14
Barotrauma.ScriptedEvent
Definition:
ScriptedEvent.cs:9
Barotrauma.ScriptedEvent.GetTargets
IEnumerable< Entity > GetTargets(Identifier tag)
Definition:
ScriptedEvent.cs:300
Barotrauma.Serialize
Definition:
SerializableProperty.cs:23
Barotrauma.Skill
Definition:
Skill.cs:6
Barotrauma
Definition:
AchievementManager.cs:12
Barotrauma.IsPropertySaveable
IsPropertySaveable
Definition:
SerializableProperty.cs:16
Barotrauma
BarotraumaShared
SharedSource
Events
EventActions
GiveSkillExpAction.cs
Generated by
1.9.1