Barotrauma Client Doc
Barotrauma.AIController Class Referenceabstract
Inheritance diagram for Barotrauma.AIController:
Barotrauma.ISteerable Barotrauma.ISteerable Barotrauma.EnemyAIController Barotrauma.EnemyAIController Barotrauma.HumanAIController Barotrauma.HumanAIController

Public Member Functions

bool HasValidPath (bool requireNonDirty=true, bool requireUnfinished=true, Func< WayPoint, bool > nodePredicate=null)
 Is the current path valid, using the provided parameters. More...
 
 AIController (Character c)
 
virtual void OnHealed (Character healer, float healAmount)
 
virtual void OnAttacked (Character attacker, AttackResult attackResult)
 
virtual void SelectTarget (AITarget target)
 
virtual void Update (float deltaTime)
 
virtual void Reset ()
 
void FaceTarget (ISpatialEntity target)
 
virtual bool SteerThroughGap (Structure wall, WallSection section, Vector2 targetWorldPos, float deltaTime)
 
virtual bool SteerThroughGap (Gap gap, Vector2 targetWorldPos, float deltaTime, float maxDistance=-1)
 
bool CanPassThroughHole (Structure wall, int sectionIndex, int requiredHoleCount)
 
bool TakeItem (Item item, CharacterInventory targetInventory, bool equip, bool wear=false, bool dropOtherIfCannotMove=true, bool allowSwapping=false, bool storeUnequipped=false, IEnumerable< Identifier > targetTags=null)
 
void UnequipEmptyItems (Item parentItem, bool avoidDroppingInSea=true)
 
void UnequipContainedItems (Item parentItem, Func< Item, bool > predicate=null, bool avoidDroppingInSea=true, int? unequipMax=null)
 
void ReequipUnequipped ()
 
abstract bool Escape (float deltaTime)
 
void ResetEscape ()
 
virtual void DebugDraw (SpriteBatch spriteBatch)
 

Static Public Member Functions

static void UnequipEmptyItems (Character character, Item parentItem, bool avoidDroppingInSea=true)
 
static void UnequipContainedItems (Character character, Item parentItem, Func< Item, bool > predicate, bool avoidDroppingInSea=true, int? unequipMax=null)
 

Public Attributes

bool Enabled
 
readonly Character Character
 

Protected Member Functions

void ResetAITarget ()
 
bool IsWallDisabled (Structure wall)
 
bool UpdateEscape (float deltaTime, bool canAttackDoors)
 
virtual void OnStateChanged (AIState from, AIState to)
 
virtual void OnTargetChanged (AITarget previousTarget, AITarget newTarget)
 

Protected Attributes

AITarget _lastAiTarget
 
AITarget _previousAiTarget
 
AITarget _selectedAiTarget
 
SteeringManager steeringManager
 
readonly float colliderWidth
 
readonly float minGapSize
 
readonly float colliderLength
 
readonly float avoidLookAheadDistance
 
bool allGapsSearched
 
readonly HashSet< GapunreachableGaps = new HashSet<Gap>()
 

Properties

AITarget SelectedAiTarget [get, protected set]
 
SteeringManager SteeringManager [get]
 
Vector2 Steering [get, set]
 
Vector2 SimPosition [get]
 
Vector2 WorldPosition [get]
 
Vector2 Velocity [get]
 
virtual bool CanEnterSubmarine [get]
 
virtual bool CanFlip [get]
 
virtual bool IsMentallyUnstable [get]
 
IEnumerable< HullVisibleHulls [get]
 Returns hulls that are visible to the character, including the current hull. Note that this is not an accurate visibility check, it only checks for open gaps between the adjacent and linked hulls. More...
 
bool IsCurrentPathNullOrUnreachable [get]
 
bool IsCurrentPathUnreachable [get]
 
bool IsCurrentPathFinished [get]
 
bool IsSteeringThroughGap [get, protected set]
 
bool IsTryingToSteerThroughGap [get, protected set]
 
Gap EscapeTarget [get]
 
- Properties inherited from Barotrauma.ISteerable
Vector2 Steering [get, set]
 
Vector2 Velocity [get]
 
Vector2 SimPosition [get]
 
Vector2 WorldPosition [get]
 

Detailed Description

Constructor & Destructor Documentation

◆ AIController()

Barotrauma.AIController.AIController ( Character  c)

Member Function Documentation

◆ CanPassThroughHole()

bool Barotrauma.AIController.CanPassThroughHole ( Structure  wall,
int  sectionIndex,
int  requiredHoleCount 
)

◆ DebugDraw()

virtual void Barotrauma.AIController.DebugDraw ( SpriteBatch  spriteBatch)
virtual

◆ Escape()

abstract bool Barotrauma.AIController.Escape ( float  deltaTime)
pure virtual

◆ FaceTarget()

void Barotrauma.AIController.FaceTarget ( ISpatialEntity  target)

◆ HasValidPath()

bool Barotrauma.AIController.HasValidPath ( bool  requireNonDirty = true,
bool  requireUnfinished = true,
Func< WayPoint, bool >  nodePredicate = null 
)

Is the current path valid, using the provided parameters.

Parameters
requireNonDirty
requireUnfinished
nodePredicate
Returns
When nodePredicate is defined, returns false if any of the nodes fails to match the predicate.

Definition at line 119 of file BarotraumaShared/SharedSource/Characters/AI/AIController.cs.

◆ IsWallDisabled()

bool Barotrauma.AIController.IsWallDisabled ( Structure  wall)
protected

◆ OnAttacked()

virtual void Barotrauma.AIController.OnAttacked ( Character  attacker,
AttackResult  attackResult 
)
virtual

◆ OnHealed()

virtual void Barotrauma.AIController.OnHealed ( Character  healer,
float  healAmount 
)
virtual

◆ OnStateChanged()

virtual void Barotrauma.AIController.OnStateChanged ( AIState  from,
AIState  to 
)
protectedvirtual

◆ OnTargetChanged()

virtual void Barotrauma.AIController.OnTargetChanged ( AITarget  previousTarget,
AITarget  newTarget 
)
protectedvirtual

◆ ReequipUnequipped()

void Barotrauma.AIController.ReequipUnequipped ( )

◆ Reset()

virtual void Barotrauma.AIController.Reset ( )
virtual

◆ ResetAITarget()

void Barotrauma.AIController.ResetAITarget ( )
protected

◆ ResetEscape()

void Barotrauma.AIController.ResetEscape ( )

◆ SelectTarget()

virtual void Barotrauma.AIController.SelectTarget ( AITarget  target)
virtual

◆ SteerThroughGap() [1/2]

virtual bool Barotrauma.AIController.SteerThroughGap ( Gap  gap,
Vector2  targetWorldPos,
float  deltaTime,
float  maxDistance = -1 
)
virtual

◆ SteerThroughGap() [2/2]

virtual bool Barotrauma.AIController.SteerThroughGap ( Structure  wall,
WallSection  section,
Vector2  targetWorldPos,
float  deltaTime 
)
virtual

◆ TakeItem()

bool Barotrauma.AIController.TakeItem ( Item  item,
CharacterInventory  targetInventory,
bool  equip,
bool  wear = false,
bool  dropOtherIfCannotMove = true,
bool  allowSwapping = false,
bool  storeUnequipped = false,
IEnumerable< Identifier targetTags = null 
)

◆ UnequipContainedItems() [1/2]

static void Barotrauma.AIController.UnequipContainedItems ( Character  character,
Item  parentItem,
Func< Item, bool >  predicate,
bool  avoidDroppingInSea = true,
int?  unequipMax = null 
)
static

◆ UnequipContainedItems() [2/2]

void Barotrauma.AIController.UnequipContainedItems ( Item  parentItem,
Func< Item, bool >  predicate = null,
bool  avoidDroppingInSea = true,
int?  unequipMax = null 
)

◆ UnequipEmptyItems() [1/2]

static void Barotrauma.AIController.UnequipEmptyItems ( Character  character,
Item  parentItem,
bool  avoidDroppingInSea = true 
)
static

◆ UnequipEmptyItems() [2/2]

void Barotrauma.AIController.UnequipEmptyItems ( Item  parentItem,
bool  avoidDroppingInSea = true 
)

◆ Update()

virtual void Barotrauma.AIController.Update ( float  deltaTime)
virtual

◆ UpdateEscape()

bool Barotrauma.AIController.UpdateEscape ( float  deltaTime,
bool  canAttackDoors 
)
protected

Member Data Documentation

◆ _lastAiTarget

AITarget Barotrauma.AIController._lastAiTarget
protected

◆ _previousAiTarget

AITarget Barotrauma.AIController._previousAiTarget
protected

◆ _selectedAiTarget

AITarget Barotrauma.AIController._selectedAiTarget
protected

◆ allGapsSearched

bool Barotrauma.AIController.allGapsSearched
protected

◆ avoidLookAheadDistance

readonly float Barotrauma.AIController.avoidLookAheadDistance
protected

◆ Character

readonly Character Barotrauma.AIController.Character

◆ colliderLength

readonly float Barotrauma.AIController.colliderLength
protected

◆ colliderWidth

readonly float Barotrauma.AIController.colliderWidth
protected

◆ Enabled

bool Barotrauma.AIController.Enabled

◆ minGapSize

readonly float Barotrauma.AIController.minGapSize
protected

◆ steeringManager

SteeringManager Barotrauma.AIController.steeringManager
protected

◆ unreachableGaps

readonly HashSet<Gap> Barotrauma.AIController.unreachableGaps = new HashSet<Gap>()
protected

Property Documentation

◆ CanEnterSubmarine

virtual bool Barotrauma.AIController.CanEnterSubmarine
get

◆ CanFlip

virtual bool Barotrauma.AIController.CanFlip
get

◆ EscapeTarget

Gap Barotrauma.AIController.EscapeTarget
get

◆ IsCurrentPathFinished

bool Barotrauma.AIController.IsCurrentPathFinished
get

◆ IsCurrentPathNullOrUnreachable

bool Barotrauma.AIController.IsCurrentPathNullOrUnreachable
get

◆ IsCurrentPathUnreachable

bool Barotrauma.AIController.IsCurrentPathUnreachable
get

◆ IsMentallyUnstable

virtual bool Barotrauma.AIController.IsMentallyUnstable
get

◆ IsSteeringThroughGap

bool Barotrauma.AIController.IsSteeringThroughGap
getprotected set

◆ IsTryingToSteerThroughGap

bool Barotrauma.AIController.IsTryingToSteerThroughGap
getprotected set

◆ SelectedAiTarget

AITarget Barotrauma.AIController.SelectedAiTarget
getprotected set

◆ SimPosition

Vector2 Barotrauma.AIController.SimPosition
get

◆ Steering

Vector2 Barotrauma.AIController.Steering
getset

◆ SteeringManager

SteeringManager Barotrauma.AIController.SteeringManager
get

◆ Velocity

Vector2 Barotrauma.AIController.Velocity
get

◆ VisibleHulls

IEnumerable<Hull> Barotrauma.AIController.VisibleHulls
get

Returns hulls that are visible to the character, including the current hull. Note that this is not an accurate visibility check, it only checks for open gaps between the adjacent and linked hulls.

Definition at line 99 of file BarotraumaShared/SharedSource/Characters/AI/AIController.cs.

◆ WorldPosition

Vector2 Barotrauma.AIController.WorldPosition
get