Barotrauma Client Doc
AbilityConditionItemInSubmarine.cs
1
using
System.Xml.Linq;
2
3
namespace
Barotrauma.Abilities
4
{
5
class
AbilityConditionItemInSubmarine
:
AbilityConditionData
6
{
7
private
readonly
SubmarineType
? submarineType;
8
9
public
AbilityConditionItemInSubmarine
(
CharacterTalent
characterTalent
,
ContentXElement
conditionElement) : base(
characterTalent
, conditionElement)
10
{
11
if
(conditionElement.
GetAttribute
(
"submarinetype"
) !=
null
)
12
{
13
submarineType = conditionElement.GetAttributeEnum<
SubmarineType
>(
"submarinetype"
,
SubmarineType
.Player);
14
}
15
}
16
17
protected
override
bool
MatchesConditionSpecific
(
AbilityObject
abilityObject)
18
{
19
if
((abilityObject as
IAbilityItem
)?.
Item
is
Item
item)
20
{
21
if
(item.Submarine ==
null
) {
return
false
; }
22
if
(submarineType.HasValue)
23
{
24
return
item.Submarine.Info?.Type == submarineType.Value;
25
}
26
else
27
{
28
return
true
;
29
}
30
}
31
else
32
{
33
LogAbilityConditionError
(abilityObject, typeof(
IAbilityItem
));
34
return
false
;
35
}
36
}
37
}
38
}
Barotrauma.Abilities.AbilityConditionData
Definition:
AbilityConditionData.cs:6
Barotrauma.Abilities.AbilityConditionData.LogAbilityConditionError
void LogAbilityConditionError(AbilityObject abilityObject, Type expectedData)
Definition:
AbilityConditionData.cs:18
Barotrauma.Abilities.AbilityCondition.characterTalent
CharacterTalent characterTalent
Definition:
AbilityCondition.cs:8
Barotrauma.Abilities.AbilityConditionItemInSubmarine
Definition:
AbilityConditionItemInSubmarine.cs:6
Barotrauma.Abilities.AbilityConditionItemInSubmarine.MatchesConditionSpecific
override bool MatchesConditionSpecific(AbilityObject abilityObject)
Definition:
AbilityConditionItemInSubmarine.cs:17
Barotrauma.Abilities.AbilityConditionItemInSubmarine.AbilityConditionItemInSubmarine
AbilityConditionItemInSubmarine(CharacterTalent characterTalent, ContentXElement conditionElement)
Definition:
AbilityConditionItemInSubmarine.cs:9
Barotrauma.Abilities.AbilityObject
Definition:
AbilityObjects.cs:6
Barotrauma.CharacterTalent
Definition:
CharacterTalent.cs:8
Barotrauma.ContentXElement
Definition:
ContentXElement.cs:13
Barotrauma.ContentXElement.GetAttribute
XAttribute? GetAttribute(string name)
Barotrauma.Item
Definition:
BarotraumaShared/SharedSource/Items/Item.cs:26
Barotrauma.Abilities.IAbilityItem
Definition:
AbilityInterfaces.cs:9
Barotrauma.Abilities
Definition:
AbilityCondition.cs:5
Barotrauma.SubmarineType
SubmarineType
Definition:
BarotraumaShared/SharedSource/Map/SubmarineInfo.cs:27
Barotrauma
BarotraumaShared
SharedSource
Characters
Talents
Abilities
AbilityConditionals
AbilityConditionData
AbilityConditionItemInSubmarine.cs
Generated by
1.9.1