Loading...
Searching...
No Matches
CityBuilderCore.DefaultAttackManager Class Reference

Detailed Description

default implementation for IAttackManager
attacker targets are chosen purely on distance

https://citybuilder.softleitner.com/manual/attacks

Inheritance diagram for CityBuilderCore.DefaultAttackManager:
CityBuilderCore.IAttackManager

Public Member Functions

void AddAttacker (IAttacker attacker)
 adds an attacker to the manager that can now be found by defenders
typically called by the attacker in Start
 
void RemoveAttacker (IAttacker attacker)
 removes a previously added attacker from the manager, it can no longer be found by defenders
typically called by the attacker in OnDestroy when it has been killed
 
IAttacker GetAttacker (Vector3 position, float maxDistance)
 retrieves the closest attacker to a given position
 
IEnumerable< IAttackerGetAttackers (Vector3 position, float maxDistance)
 retrieves the all attackers within a radius
 
BuildingComponentPath< IAttackableGetAttackerPath (Vector2Int point, PathType pathType, object tag=null)
 attempts to find a path to an IAttackable
 

Public Attributes

bool IgnoreBlocked
 

Protected Member Functions

virtual void Awake ()
 

Member Function Documentation

◆ AddAttacker()

void CityBuilderCore.DefaultAttackManager.AddAttacker ( IAttacker attacker)
inline

adds an attacker to the manager that can now be found by defenders
typically called by the attacker in Start

Parameters
attackerthe attacker to add

Implements CityBuilderCore.IAttackManager.

◆ GetAttacker()

IAttacker CityBuilderCore.DefaultAttackManager.GetAttacker ( Vector3 position,
float maxDistance )
inline

retrieves the closest attacker to a given position

Parameters
positionposition of the defender that is looking for attackers
maxDistancemaximum distance to look for
Returns
the attacker if one was found inside the distance

Implements CityBuilderCore.IAttackManager.

◆ GetAttackerPath()

BuildingComponentPath< IAttackable > CityBuilderCore.DefaultAttackManager.GetAttackerPath ( Vector2Int point,
PathType pathType,
object tag = null )
inline

attempts to find a path to an IAttackable

Parameters
pointcurrent point to start from
pathTypepreferred path type
tagadditional pathing option
Returns
the attackable and a path to it if on was found

Implements CityBuilderCore.IAttackManager.

◆ GetAttackers()

IEnumerable< IAttacker > CityBuilderCore.DefaultAttackManager.GetAttackers ( Vector3 position,
float radius )
inline

retrieves the all attackers within a radius

Parameters
positionposition of the defender that is looking for attackers
radiusmaximum distance to look for
Returns
all attackers found inside the radius

Implements CityBuilderCore.IAttackManager.

◆ RemoveAttacker()

void CityBuilderCore.DefaultAttackManager.RemoveAttacker ( IAttacker attacker)
inline

removes a previously added attacker from the manager, it can no longer be found by defenders
typically called by the attacker in OnDestroy when it has been killed

Parameters
attacker

Implements CityBuilderCore.IAttackManager.