Third Person Cover Shooter  1.6
CoverShooter.FighterBrain Class Reference

Simulates a fighter, takes cover, assaults, uses weapons, throws grenades, etc. More...

Inheritance diagram for CoverShooter.FighterBrain:
CoverShooter.BaseBrain CoverShooter.IAlertListener CoverShooter.ICharacterHealthListener CoverShooter.AIBase

Public Member Functions

void ToOpenFire ()
 Registers that the AI is currently firing. More...
 
void ToCloseFire ()
 Registers that the AI has stopped firing. More...
 
void ToSprintTo (Vector3 position)
 Registers that the AI has started sprinting to a location. More...
 
void ToRunTo (Vector3 position)
 Registers that the AI has started running to a location. More...
 
void ToWalkTo (Vector3 position)
 Registers that the AI has started walking to a location. More...
 
void ToStopMoving ()
 Registers that the AI has stopped moving. More...
 
void ToCircle (Vector3 threat)
 Registers that the AI has no target location to move to. More...
 
void ToWalkInDirection (Vector3 vector)
 Registers that the AI has no target location to move to. More...
 
void ToRunInDirection (Vector3 vector)
 Registers that the AI has no target location to move to. More...
 
void ToSprintInDirection (Vector3 vector)
 Registers that the AI has no target location to move to. More...
 
void ToWalkFrom (Vector3 target)
 Registers that the AI has no target location to move to. More...
 
void ToRunFrom (Vector3 target)
 Registers that the AI has no target location to move to. More...
 
void ToSprintFrom (Vector3 target)
 Registers that the AI has no target location to move to. More...
 
void ToKeepCloseTo (KeepCloseTo value)
 Registers that the AI is told to keep close to a position. More...
 
void SetIdleAlertedState ()
 Sets the AI state to alerted. More...
 
void ToAttack (Actor target)
 Sets the target threat and starts either taking cover or assaulting. More...
 
void ToEnterProcess (bool isFighting)
 Enters a process. More...
 
void ToExitProcess ()
 Told that the process has stopped. More...
 
void ToExitProcessAndMaintainPosition ()
 Told to stop the process and maintain previous position if there was any. More...
 
void ToSetThreat (Threat threat)
 Locks the AI on the given threat. More...
 
void ToHoldPosition (Vector3 position)
 Starts maintaing the position. More...
 
void ToStopActions ()
 Removes threat and sets the AI state to idleButAlerted. More...
 
override void ToForget ()
 Forget about the enemy and return to patrol or idle state. More...
 
void ToBecomeScared ()
 Told by a component to be scared. More...
 
void ToMakeCall ()
 Told by a component to make a call. More...
 
void ToFindCover ()
 Told by a component to find a cover. More...
 
void ToFindDefenseCover (Vector3 position)
 Told by a component to find a defensive cover. More...
 
void ToRegroupAround (AIBaseRegrouper regrouper)
 Told by an outside command to regroup around a unit. More...
 
void ToFindAndMaintainPosition (AIBaseRegrouper regrouper)
 Told by an outside command to regroup and maintain a position. More...
 
void AssaultResponse ()
 Registers existance of an assault component. More...
 
void CallResponse ()
 Registers that a call is being made. More...
 
void InvestigationResponse ()
 Registers existance of an investigation component. More...
 
void SearchResponse ()
 Registers existance of a search component. More...
 
void OnFinishSearch ()
 Notified that a search has finished. More...
 
void OnResurrect ()
 Notified that the AI has been resurected. More...
 
void OnDead ()
 Character is dead. More...
 
void OnAssaultStop ()
 Notified of an end of an assault. More...
 
void OnSeeDeath (Actor actor)
 A death was witnessed. More...
 
void OnWaypointsFound ()
 Notified that the waypoint system has waypoints to visit. More...
 
void OnSpawn (Actor caller)
 Event called during a spawning process. More...
 
void OnNeedLight ()
 One of the components declares a need for a light. More...
 
void OnDontNeedLight ()
 One of the components declares that a light is no longer needed. More...
 
void OnCallMade ()
 Registers a successful call. More...
 
void OnHit (Hit hit)
 Registers damage done by a weapon. More...
 
void OnFriendHit (Actor friend)
 Notified that a friend was hit. More...
 
void OnFinishTakeCover ()
 Notified by cover AI that target cover was taken. More...
 
void OnAlert (ref GeneratedAlert alert)
 Notified by an alert system of an alert. More...
 
void OnFoundFriend (Actor friend)
 Notified by communication AI that a friend was found. More...
 
void OnLostFriend (Actor friend)
 Notified by communication AI that a friend got out of range. More...
 
void OnCivilianAlerted (Actor actor)
 Notified that a civilian is alerted. More...
 
void OnFriendKnowsEnemy (Actor friend)
 Notified by a friend that they found a new enemy position. More...
 
void OnFriendFoundEnemy (Actor friend)
 Notified by a friend that they found a new enemy position. More...
 
void OnSeenByFriend (Actor friend)
 Notified by a friend that the AI is seen by them. More...
 
void OnUnseenByFriend (Actor friend)
 Notified by a friend that the AI is no longer visible by them. More...
 
void OnSeeActor (Actor actor)
 Notified by the sight AI that an actor has entered the view. More...
 
void OnUnseeActor (Actor actor)
 Notified by the sight AI that an actor has dissappeared from the view. More...
 
void OnInvalidCover ()
 Notified by the cover AI that the current cover is no longer valid. More...
 
void OnFoundCover ()
 Notified by the cover AI that a cover was found. More...
 
void OnNoCover ()
 Notified that no cover was found. More...
 
void OnCoverSearch ()
 Notified that a component has started to look for covers. More...
 
void OnCircleFail ()
 Notified by the movement AI that circling of an enemy is no longer viable. More...
 
void OnMoveFromFail ()
 Notified by the movement AI that a position can no longer be retreated from. More...
 
void OnPointInvestigated (Vector3 position)
 Notified by the search AI that a position has been investigated. More...
 
- Public Member Functions inherited from CoverShooter.BaseBrain
void OnEnterDanger ()
 Registers an entrance to a dangerous area. More...
 
void OnLeaveDanger ()
 Registers that the AI is leaving a dangerous area. More...
 
- Public Member Functions inherited from CoverShooter.AIBase
void Message (string name)
 Sends a message to other components. More...
 
void Message (string name, object value)
 Sends a message to other components. More...
 

Public Attributes

float AvoidDistance = 4
 Enemy distance to trigger slow retreat. More...
 
float AllySpacing = 1.2f
 Enemy distance to trigger slow retreat. More...
 
float StandDuration = 2
 Duration in seconds to stand fighting before changing state. More...
 
float CircleDuration = 2
 Duration in seconds to fight circling the enemy before changing state. More...
 
float CoverSwitchWait = 10
 Time in seconds for the AI to wait before switching to a better cover. More...
 
float GuessDistance = 30
 Distance at which the AI guesses the position on hearing instead of knowing it precisely. More...
 
float TakeCoverImmediatelyChance = 0
 Chance the AI will take cover immediately after learning of existance of an enemy. More...
 
float DistanceToGoToCoverFromStandOrCircle = 6
 AI won't go to cover if it is closer to the enemy than this value. More...
 
bool ImmediateThreatReaction = true
 Should the AI attack threats immedietaly on seeing them. More...
 
bool AttackAggressors = true
 Should the AI switch to attacking enemies that deal damage to the AI. More...
 
AIStartSettings Start = AIStartSettings.Default()
 Settings for AI startup. More...
 
FighterSpeedSettings Speed = FighterSpeedSettings.Default()
 Speed of the motor during various AI states. More...
 
AIApproximationSettings Approximation = new AIApproximationSettings(0, 10, 5, 30)
 How accurately the AI guesses the position of an enemy. More...
 
FighterRetreatSettings Retreat = FighterRetreatSettings.Default()
 Settings for AI retreats. More...
 
FighterInvestigationWaitSettings Investigation = FighterInvestigationWaitSettings.Default()
 Settings for how long the AI waits before investigating. More...
 
FighterGrenadeAvoidSettings GrenadeAvoidance = FighterGrenadeAvoidSettings.Default()
 Settings for how the fighter avoids other grenades. More...
 
AIGrenadeSettings Grenades = AIGrenadeSettings.Default()
 Settings for AI grenades. More...
 
bool DebugThreat = false
 Should a debug line be drawn towards the current threat. More...
 

Protected Member Functions

override void Awake ()
 
- Protected Member Functions inherited from CoverShooter.BaseBrain
void RemoveThreat ()
 Unset the current threat. More...
 
void UnseeThreat ()
 Sets the threat state to unseen. More...
 
void SetUnseenThreat (bool isHeard, bool isDirect, Actor threat, Vector3 position, Cover threatCover)
 Updates threat state. More...
 
void SetThreat (Actor threat, Vector3 position, Cover threatCover)
 Updates threat state. More...
 
void SetThreat (bool isVisible, bool isHeard, bool isActual, Actor threat, Vector3 position, Cover threatCover, float time)
 Updates threat state. More...
 

Properties

bool IsAlerted [get]
 Is the AI currently alarmed. More...
 
FighterState State [get]
 AI state the brain is at. More...
 
float InvestigationWait [get]
 Time in seconds to wait for inspecting the last seen threat position. More...
 
bool IsInAggressiveMode [get]
 Is the AI currently in an agressive mode. More...
 
Actor LockedThreat [get]
 Threat actor that the AI is locked on. More...
 
- Properties inherited from CoverShooter.BaseBrain
Actor Actor [get]
 Actor component found in the same object. More...
 
Actor Threat [get]
 Actor component of the threating character. More...
 
Actor ForgottenThreat [get]
 Threat actor that was told to be forgotten. More...
 
float ThreatAge [get]
 Time in seconds since the threat was last seen. More...
 
Vector3 LastKnownThreatPosition [get]
 Last known position of the assigned threat. More...
 
float LastSeenThreatTime [get]
 Time since level load that the threat was seen. More...
 
bool CanSeeTheThreat [get]
 Is the threat currently seen. More...
 
Cover ThreatCover [get]
 Cover that is currently known to be used by the threat. More...
 
bool IsActualThreatPosition [get]
 Was the last known threat position a position the threat occupied or was it just an indirect explosion. More...
 
bool HasSeenTheEnemy [get]
 Was any threat seen at least once. More...
 
bool HasHeardTheEnemy [get]
 Was any threat heard at least once. More...
 
Vector3 StartingLocation [get]
 Location at which the character started. More...
 
bool IsInDanger [get]
 Is the AI currently in a dangerous area. More...
 

Detailed Description

Simulates a fighter, takes cover, assaults, uses weapons, throws grenades, etc.

Member Function Documentation

◆ AssaultResponse()

void CoverShooter.FighterBrain.AssaultResponse ( )

Registers existance of an assault component.

◆ Awake()

override void CoverShooter.FighterBrain.Awake ( )
protectedvirtual

Reimplemented from CoverShooter.BaseBrain.

◆ CallResponse()

void CoverShooter.FighterBrain.CallResponse ( )

Registers that a call is being made.

◆ InvestigationResponse()

void CoverShooter.FighterBrain.InvestigationResponse ( )

Registers existance of an investigation component.

◆ OnAlert()

void CoverShooter.FighterBrain.OnAlert ( ref GeneratedAlert  alert)

Notified by an alert system of an alert.

Implements CoverShooter.IAlertListener.

◆ OnAssaultStop()

void CoverShooter.FighterBrain.OnAssaultStop ( )

Notified of an end of an assault.

◆ OnCallMade()

void CoverShooter.FighterBrain.OnCallMade ( )

Registers a successful call.

◆ OnCircleFail()

void CoverShooter.FighterBrain.OnCircleFail ( )

Notified by the movement AI that circling of an enemy is no longer viable.

◆ OnCivilianAlerted()

void CoverShooter.FighterBrain.OnCivilianAlerted ( Actor  actor)

Notified that a civilian is alerted.

◆ OnCoverSearch()

void CoverShooter.FighterBrain.OnCoverSearch ( )

Notified that a component has started to look for covers.

◆ OnDead()

void CoverShooter.FighterBrain.OnDead ( )

◆ OnDontNeedLight()

void CoverShooter.FighterBrain.OnDontNeedLight ( )

One of the components declares that a light is no longer needed.

◆ OnFinishSearch()

void CoverShooter.FighterBrain.OnFinishSearch ( )

Notified that a search has finished.

Forgets about the previous threat as nothing was found during the search.

◆ OnFinishTakeCover()

void CoverShooter.FighterBrain.OnFinishTakeCover ( )

Notified by cover AI that target cover was taken.

◆ OnFoundCover()

void CoverShooter.FighterBrain.OnFoundCover ( )

Notified by the cover AI that a cover was found.

◆ OnFoundFriend()

void CoverShooter.FighterBrain.OnFoundFriend ( Actor  friend)

Notified by communication AI that a friend was found.

◆ OnFriendFoundEnemy()

void CoverShooter.FighterBrain.OnFriendFoundEnemy ( Actor  friend)

Notified by a friend that they found a new enemy position.

◆ OnFriendHit()

void CoverShooter.FighterBrain.OnFriendHit ( Actor  friend)

Notified that a friend was hit.

◆ OnFriendKnowsEnemy()

void CoverShooter.FighterBrain.OnFriendKnowsEnemy ( Actor  friend)

Notified by a friend that they found a new enemy position.

◆ OnHit()

void CoverShooter.FighterBrain.OnHit ( Hit  hit)

Registers damage done by a weapon.

◆ OnInvalidCover()

void CoverShooter.FighterBrain.OnInvalidCover ( )

Notified by the cover AI that the current cover is no longer valid.

◆ OnLostFriend()

void CoverShooter.FighterBrain.OnLostFriend ( Actor  friend)

Notified by communication AI that a friend got out of range.

◆ OnMoveFromFail()

void CoverShooter.FighterBrain.OnMoveFromFail ( )

Notified by the movement AI that a position can no longer be retreated from.

◆ OnNeedLight()

void CoverShooter.FighterBrain.OnNeedLight ( )

One of the components declares a need for a light.

◆ OnNoCover()

void CoverShooter.FighterBrain.OnNoCover ( )

Notified that no cover was found.

◆ OnPointInvestigated()

void CoverShooter.FighterBrain.OnPointInvestigated ( Vector3  position)

Notified by the search AI that a position has been investigated.

◆ OnResurrect()

void CoverShooter.FighterBrain.OnResurrect ( )

Notified that the AI has been resurected.

Implements CoverShooter.ICharacterHealthListener.

◆ OnSeeActor()

void CoverShooter.FighterBrain.OnSeeActor ( Actor  actor)

Notified by the sight AI that an actor has entered the view.

◆ OnSeeDeath()

void CoverShooter.FighterBrain.OnSeeDeath ( Actor  actor)

A death was witnessed.

◆ OnSeenByFriend()

void CoverShooter.FighterBrain.OnSeenByFriend ( Actor  friend)

Notified by a friend that the AI is seen by them.

◆ OnSpawn()

void CoverShooter.FighterBrain.OnSpawn ( Actor  caller)

Event called during a spawning process.

◆ OnUnseeActor()

void CoverShooter.FighterBrain.OnUnseeActor ( Actor  actor)

Notified by the sight AI that an actor has dissappeared from the view.

◆ OnUnseenByFriend()

void CoverShooter.FighterBrain.OnUnseenByFriend ( Actor  friend)

Notified by a friend that the AI is no longer visible by them.

◆ OnWaypointsFound()

void CoverShooter.FighterBrain.OnWaypointsFound ( )

Notified that the waypoint system has waypoints to visit.

◆ SearchResponse()

void CoverShooter.FighterBrain.SearchResponse ( )

Registers existance of a search component.

◆ SetIdleAlertedState()

void CoverShooter.FighterBrain.SetIdleAlertedState ( )

Sets the AI state to alerted.

◆ ToAttack()

void CoverShooter.FighterBrain.ToAttack ( Actor  target)

Sets the target threat and starts either taking cover or assaulting.

◆ ToBecomeScared()

void CoverShooter.FighterBrain.ToBecomeScared ( )

Told by a component to be scared.

◆ ToCircle()

void CoverShooter.FighterBrain.ToCircle ( Vector3  threat)

Registers that the AI has no target location to move to.

◆ ToCloseFire()

void CoverShooter.FighterBrain.ToCloseFire ( )

Registers that the AI has stopped firing.

◆ ToEnterProcess()

void CoverShooter.FighterBrain.ToEnterProcess ( bool  isFighting)

Enters a process.

Is told if can fire during it.

◆ ToExitProcess()

void CoverShooter.FighterBrain.ToExitProcess ( )

Told that the process has stopped.

Sets the idle but alerted AI state.

◆ ToExitProcessAndMaintainPosition()

void CoverShooter.FighterBrain.ToExitProcessAndMaintainPosition ( )

Told to stop the process and maintain previous position if there was any.

◆ ToFindAndMaintainPosition()

void CoverShooter.FighterBrain.ToFindAndMaintainPosition ( AIBaseRegrouper  regrouper)

Told by an outside command to regroup and maintain a position.

◆ ToFindCover()

void CoverShooter.FighterBrain.ToFindCover ( )

Told by a component to find a cover.

◆ ToFindDefenseCover()

void CoverShooter.FighterBrain.ToFindDefenseCover ( Vector3  position)

Told by a component to find a defensive cover.

◆ ToForget()

override void CoverShooter.FighterBrain.ToForget ( )
virtual

Forget about the enemy and return to patrol or idle state.

Reimplemented from CoverShooter.BaseBrain.

◆ ToHoldPosition()

void CoverShooter.FighterBrain.ToHoldPosition ( Vector3  position)

Starts maintaing the position.

◆ ToKeepCloseTo()

void CoverShooter.FighterBrain.ToKeepCloseTo ( KeepCloseTo  value)

Registers that the AI is told to keep close to a position.

◆ ToMakeCall()

void CoverShooter.FighterBrain.ToMakeCall ( )

Told by a component to make a call.

◆ ToOpenFire()

void CoverShooter.FighterBrain.ToOpenFire ( )

Registers that the AI is currently firing.

◆ ToRegroupAround()

void CoverShooter.FighterBrain.ToRegroupAround ( AIBaseRegrouper  regrouper)

Told by an outside command to regroup around a unit.

◆ ToRunFrom()

void CoverShooter.FighterBrain.ToRunFrom ( Vector3  target)

Registers that the AI has no target location to move to.

◆ ToRunInDirection()

void CoverShooter.FighterBrain.ToRunInDirection ( Vector3  vector)

Registers that the AI has no target location to move to.

◆ ToRunTo()

void CoverShooter.FighterBrain.ToRunTo ( Vector3  position)

Registers that the AI has started running to a location.

◆ ToSetThreat()

void CoverShooter.FighterBrain.ToSetThreat ( Threat  threat)

Locks the AI on the given threat.

◆ ToSprintFrom()

void CoverShooter.FighterBrain.ToSprintFrom ( Vector3  target)

Registers that the AI has no target location to move to.

◆ ToSprintInDirection()

void CoverShooter.FighterBrain.ToSprintInDirection ( Vector3  vector)

Registers that the AI has no target location to move to.

◆ ToSprintTo()

void CoverShooter.FighterBrain.ToSprintTo ( Vector3  position)

Registers that the AI has started sprinting to a location.

◆ ToStopActions()

void CoverShooter.FighterBrain.ToStopActions ( )

Removes threat and sets the AI state to idleButAlerted.

◆ ToStopMoving()

void CoverShooter.FighterBrain.ToStopMoving ( )

Registers that the AI has stopped moving.

◆ ToWalkFrom()

void CoverShooter.FighterBrain.ToWalkFrom ( Vector3  target)

Registers that the AI has no target location to move to.

◆ ToWalkInDirection()

void CoverShooter.FighterBrain.ToWalkInDirection ( Vector3  vector)

Registers that the AI has no target location to move to.

◆ ToWalkTo()

void CoverShooter.FighterBrain.ToWalkTo ( Vector3  position)

Registers that the AI has started walking to a location.

Member Data Documentation

◆ AllySpacing

float CoverShooter.FighterBrain.AllySpacing = 1.2f

Enemy distance to trigger slow retreat.

◆ Approximation

AIApproximationSettings CoverShooter.FighterBrain.Approximation = new AIApproximationSettings(0, 10, 5, 30)

How accurately the AI guesses the position of an enemy.

◆ AttackAggressors

bool CoverShooter.FighterBrain.AttackAggressors = true

Should the AI switch to attacking enemies that deal damage to the AI.

◆ AvoidDistance

float CoverShooter.FighterBrain.AvoidDistance = 4

Enemy distance to trigger slow retreat.

◆ CircleDuration

float CoverShooter.FighterBrain.CircleDuration = 2

Duration in seconds to fight circling the enemy before changing state.

◆ CoverSwitchWait

float CoverShooter.FighterBrain.CoverSwitchWait = 10

Time in seconds for the AI to wait before switching to a better cover.

◆ DebugThreat

bool CoverShooter.FighterBrain.DebugThreat = false

Should a debug line be drawn towards the current threat.

◆ DistanceToGoToCoverFromStandOrCircle

float CoverShooter.FighterBrain.DistanceToGoToCoverFromStandOrCircle = 6

AI won't go to cover if it is closer to the enemy than this value.

Only used when the enemy has been known for awhile.

◆ GrenadeAvoidance

FighterGrenadeAvoidSettings CoverShooter.FighterBrain.GrenadeAvoidance = FighterGrenadeAvoidSettings.Default()

Settings for how the fighter avoids other grenades.

◆ Grenades

AIGrenadeSettings CoverShooter.FighterBrain.Grenades = AIGrenadeSettings.Default()

Settings for AI grenades.

◆ GuessDistance

float CoverShooter.FighterBrain.GuessDistance = 30

Distance at which the AI guesses the position on hearing instead of knowing it precisely.

◆ ImmediateThreatReaction

bool CoverShooter.FighterBrain.ImmediateThreatReaction = true

Should the AI attack threats immedietaly on seeing them.

◆ Investigation

Settings for how long the AI waits before investigating.

◆ Retreat

FighterRetreatSettings CoverShooter.FighterBrain.Retreat = FighterRetreatSettings.Default()

Settings for AI retreats.

◆ Speed

FighterSpeedSettings CoverShooter.FighterBrain.Speed = FighterSpeedSettings.Default()

Speed of the motor during various AI states.

◆ StandDuration

float CoverShooter.FighterBrain.StandDuration = 2

Duration in seconds to stand fighting before changing state.

◆ Start

AIStartSettings CoverShooter.FighterBrain.Start = AIStartSettings.Default()

Settings for AI startup.

◆ TakeCoverImmediatelyChance

float CoverShooter.FighterBrain.TakeCoverImmediatelyChance = 0

Chance the AI will take cover immediately after learning of existance of an enemy.

Property Documentation

◆ InvestigationWait

float CoverShooter.FighterBrain.InvestigationWait
get

Time in seconds to wait for inspecting the last seen threat position.

◆ IsAlerted

bool CoverShooter.FighterBrain.IsAlerted
get

Is the AI currently alarmed.

◆ IsInAggressiveMode

bool CoverShooter.FighterBrain.IsInAggressiveMode
get

Is the AI currently in an agressive mode.

Aggressivness determines if the AI immediately attacks threats seen.

◆ LockedThreat

Actor CoverShooter.FighterBrain.LockedThreat
get

Threat actor that the AI is locked on.

Other threats are ignored.

◆ State

FighterState CoverShooter.FighterBrain.State
get

AI state the brain is at.


The documentation for this class was generated from the following file: