ORK Framework  3.17.1
API Documentation
GamingIsLove.ORKFramework.CombatantHandler Class Reference

Public Member Functions

virtual void FireChanged ()
 
virtual void Clear (bool clearLocked)
 Removes all current data in the combatant handler. More...
 
virtual void Tick ()
 Updates all registered combatants, called each frame. More...
 
virtual void UpdateAnimations ()
 Update animations of all registered combatants. Usually called when the timescale was changed. More...
 
virtual string CreateGUID ()
 Creates a new GUID currently not used in the combatant handler. More...
 
virtual Combatant Get (string guid)
 
virtual Combatant Get (int id)
 
virtual void GUIDChanged (Combatant combatant, string oldGUID)
 
virtual string CreateGroupGUID ()
 Creates a new GUID for a group currently not used in the combatant handler. More...
 
virtual Group GetGroup (string guid)
 
virtual void GUIDChanged (Group group, string oldGUID)
 
virtual void AddGroup (Group group)
 
virtual void RemoveGroup (Group group)
 
virtual void Add (Combatant combatant, bool isJoiningBattle)
 Adds/registers a combatant. More...
 
virtual void Remove (Combatant combatant)
 Removes/unregisters a combatant. More...
 
virtual void AddInBattle (Combatant combatant)
 Adds/registers a combatant to the in-battle list. The in-battle list is only for a quick reference to combatants currently participating in battle. More...
 
virtual void RemoveInBattle (Combatant combatant)
 Removes/unregisters a combatant from the in-battle list. The in-battle list is only for a quick reference to combatants currently participating in battle. More...
 
List< CombatantGetInBattle ()
 Gets all combatants currently in battle. Don't change the returned list unless you know what you're doing. More...
 
virtual void Lock (Combatant combatant)
 Blocks a combatant from being removed. More...
 
virtual bool IsLocked (Combatant combatant)
 Checks if a combatant is currently locked (i.e. blocked from being removed). More...
 
virtual bool Unlock (Combatant combatant)
 Unblocks a combatant from being removed, i.e. the combatant can be removed from now on. More...
 
virtual void LockBattle ()
 Locks all currently registered combatants that are in battle. More...
 
virtual void UnlockBattle ()
 Unlocks all currently registered combatants that are in battle. More...
 
virtual void SpawnBattle ()
 Spawns all currently registered combatants that are in battle and not yet spawned. More...
 
virtual void StartRealTimeAreaBattle ()
 Joins all spawned (real time battle) combatants to the battle. More...
 
virtual void EndBattle ()
 Ends the battle for all registered combatants that are currently in battle. More...
 
virtual void CheckDeath ()
 Performs checks on all registered combatants if they've died and aren't marked as dead yet. More...
 
virtual List< CombatantGetAll ()
 Gets all currently registered combatants. More...
 
virtual List< CombatantGet (bool addPlayerGroup, Consider isDead, Consider inBattle)
 Gets a list of combatants, considering their death and battle state. More...
 
virtual void Get (ref List< Combatant > list, bool addPlayerGroup, Consider isDead, Consider inBattle)
 Adds combatants to a provided list, considering their death and battle state. More...
 
virtual List< CombatantGet (Combatant user, bool addPlayerGroup, IRange range, Consider isEnemy, Consider isDead, Consider inBattle, CheckCombatant2 check)
 Gets a list of combatants within a defined range of a user. More...
 
virtual void Get (ref List< Combatant > list, Combatant user, bool addPlayerGroup, IRange range, Consider isEnemy, Consider isDead, Consider inBattle, CheckCombatant2 check)
 Adds combatants within a defined range of a user to a provided list. More...
 
virtual void Get (ref List< Combatant > allies, ref List< Combatant > enemies, Combatant user, bool addPlayerGroup, IRange range, Consider isDead, Consider inBattle, CheckCombatant2 check)
 Adds combatants within a defined range of a user to a provided list. More...
 
virtual List< CombatantGet (Vector3 position, Combatant user, bool addPlayerGroup, IRange range, Consider isEnemy, Consider isDead, Consider inBattle, CheckCombatant2 check)
 Gets a list of combatants within a defined range to a position. More...
 
virtual void Get (ref List< Combatant > list, Vector3 position, Combatant user, bool addPlayerGroup, IRange range, Consider isEnemy, Consider isDead, Consider inBattle, CheckCombatant2 check)
 Adds combatants within a defined range to a position to a provided list. More...
 
virtual void GetInGridRange (ref List< Combatant > list, Combatant user, bool addPlayerGroup, bool ignoreCellSize, bool blockDiagonalDistance1, int minDistance, int maxDistance, Consider isEnemy, Consider isDead, Consider inBattle, GridCellOriginCheck check)
 Adds combatants within a defined grid range to the user to a provided list. More...
 
virtual void GetInGridRange (ref List< Combatant > list, Combatant user, BattleGridCellComponent origin, bool addPlayerGroup, bool ignoreCellSize, bool blockDiagonalDistance1, int minDistance, int maxDistance, Consider isEnemy, Consider isDead, Consider inBattle, GridCellOriginCheck check)
 Adds combatants within a defined grid range to an origin cell to a provided list. More...
 
virtual List< FactionSettingGetFactions (Combatant user, bool addPlayerGroup, IRange range, Consider isDead, Consider inBattle, CheckCombatant2 check)
 Gets a list of faction IDs of all registered combatants within a defined range of a user. More...
 
virtual List< CombatantGetFactionMembers (Combatant user, FactionSetting faction, bool addPlayerGroup, IRange range, Consider isDead, Consider inBattle, CheckCombatant2 check)
 Gets a list of combatants within a defined range of a user that are part of a defined faction. More...
 
virtual List< GroupGetFactionGroups (FactionSetting faction)
 Gets a list of groups of a defined faction ID. More...
 
virtual List< GroupGetGroups (Combatant user, bool addPlayerGroup, Consider isEnemy)
 Gets a list of groups of a defined faction ID. More...
 
virtual void NotifyFactionAggressionStateChange (Combatant combatant, Combatant aggressor)
 Notifies a faction's combatants that one of their combatant's changed it's aggression state. More...
 
virtual Dictionary< FactionSetting, List< Combatant > > GetByFaction (Combatant user, bool addPlayerGroup, IRange range, Consider isDead, Consider inBattle, CheckCombatant2 check)
 Gets a dictionary containing lists of combatants per faction that are within range of a user. More...
 
virtual Combatant GetRandom (Combatant user, bool addPlayerGroup, IRange range, Consider isEnemy, Consider isDead, Consider inBattle, CheckCombatant2 check)
 Gets a random combatant matching defined conditions. More...
 
virtual Combatant GetOffset (Combatant current, int add, TargetSelectionSortType sortType, Combatant user, bool addPlayerGroup, IRange range, Consider isEnemy, Consider isDead, Consider inBattle, CheckCombatant2 check)
 Gets a combatant with an offset to a defined combatant in a list of combatants matching defined conditions. More...
 
virtual Combatant GetNearest (Combatant user, bool addPlayerGroup, IRange range, Consider isEnemy, Consider isDead, Consider inBattle, CheckCombatant2 check)
 Gets the nearest combatant to the user within a defined range. More...
 

Protected Attributes

GUIDCollection< Combatantcombatants = new GUIDCollection<Combatant>()
 
GUIDCollection< Groupgroups = new GUIDCollection<Group>()
 
Dictionary< Group, int > groupCount = new Dictionary<Group, int>()
 
List< Combatantlocked = new List<Combatant>()
 
List< CombatantinBattle = new List<Combatant>()
 
Notify changeHandler
 
NotifyCombatant addedHandler
 
NotifyCombatant removedHandler
 

Properties

virtual Notify Changed
 
virtual NotifyCombatant Added
 
virtual NotifyCombatant Removed
 

Member Function Documentation

◆ Add()

virtual void GamingIsLove.ORKFramework.CombatantHandler.Add ( Combatant  combatant,
bool  isJoiningBattle 
)
virtual

Adds/registers a combatant.

Parameters
combatantThe combatant that will be registered.
isJoiningBattletrue if the combatant is currently joining the battle.

◆ AddInBattle()

virtual void GamingIsLove.ORKFramework.CombatantHandler.AddInBattle ( Combatant  combatant)
virtual

Adds/registers a combatant to the in-battle list. The in-battle list is only for a quick reference to combatants currently participating in battle.

Parameters
combatantThe combatant that will be added.

◆ CheckDeath()

virtual void GamingIsLove.ORKFramework.CombatantHandler.CheckDeath ( )
virtual

Performs checks on all registered combatants if they've died and aren't marked as dead yet.

◆ Clear()

virtual void GamingIsLove.ORKFramework.CombatantHandler.Clear ( bool  clearLocked)
virtual

Removes all current data in the combatant handler.

Parameters
clearLockedtrue if locked combatants should also be removed.

◆ CreateGroupGUID()

virtual string GamingIsLove.ORKFramework.CombatantHandler.CreateGroupGUID ( )
virtual

Creates a new GUID for a group currently not used in the combatant handler.

Returns
The new GUID.

◆ CreateGUID()

virtual string GamingIsLove.ORKFramework.CombatantHandler.CreateGUID ( )
virtual

Creates a new GUID currently not used in the combatant handler.

Returns
The new GUID.

◆ EndBattle()

virtual void GamingIsLove.ORKFramework.CombatantHandler.EndBattle ( )
virtual

Ends the battle for all registered combatants that are currently in battle.

◆ Get() [1/7]

virtual List<Combatant> GamingIsLove.ORKFramework.CombatantHandler.Get ( bool  addPlayerGroup,
Consider  isDead,
Consider  inBattle 
)
virtual

Gets a list of combatants, considering their death and battle state.

Parameters
addPlayerGrouptrue if player group combatants should be added.
isDeadDefines if and how the death state is checked.
inBattleDefines if and how the battle state is checked.
Returns
A new list containing the matching combatants.

◆ Get() [2/7]

virtual void GamingIsLove.ORKFramework.CombatantHandler.Get ( ref List< Combatant list,
bool  addPlayerGroup,
Consider  isDead,
Consider  inBattle 
)
virtual

Adds combatants to a provided list, considering their death and battle state.

Parameters
listThe list the matching combatants will be added to.
addPlayerGrouptrue if player group combatants should be added.
isDeadDefines if and how the death state is checked.
inBattleDefines if and how the battle state is checked.

◆ Get() [3/7]

virtual List<Combatant> GamingIsLove.ORKFramework.CombatantHandler.Get ( Combatant  user,
bool  addPlayerGroup,
IRange  range,
Consider  isEnemy,
Consider  isDead,
Consider  inBattle,
CheckCombatant2  check 
)
virtual

Gets a list of combatants within a defined range of a user.

Parameters
userThe user combatant.
addPlayerGrouptrue if player group combatants should be added.
rangeThe range that will be used.
isEnemyDefines if user and other combatants should be enemies.
isDeadDefines if and how the death state is checked.
inBattleDefines if and how the battle state is checked.
check(Optional) Delegate function to perform additional checks. Pass null to not use.
Returns
A new list containing the matching combatants.

◆ Get() [4/7]

virtual void GamingIsLove.ORKFramework.CombatantHandler.Get ( ref List< Combatant list,
Combatant  user,
bool  addPlayerGroup,
IRange  range,
Consider  isEnemy,
Consider  isDead,
Consider  inBattle,
CheckCombatant2  check 
)
virtual

Adds combatants within a defined range of a user to a provided list.

Parameters
listThe list the matching combatants will be added to.
userThe user combatant.
addPlayerGrouptrue if player group combatants should be added.
rangeThe range that will be used.
isEnemyDefines if user and other combatants should be enemies.
isDeadDefines if and how the death state is checked.
inBattleDefines if and how the battle state is checked.
check(Optional) Delegate function to perform additional checks. Pass null to not use.

◆ Get() [5/7]

virtual void GamingIsLove.ORKFramework.CombatantHandler.Get ( ref List< Combatant allies,
ref List< Combatant enemies,
Combatant  user,
bool  addPlayerGroup,
IRange  range,
Consider  isDead,
Consider  inBattle,
CheckCombatant2  check 
)
virtual

Adds combatants within a defined range of a user to a provided list.

Parameters
alliesThe list the matching allied combatants will be added to.
enemiesThe list the matching enemy combatants will be added to.
userThe user combatant.
addPlayerGrouptrue if player group combatants should be added.
rangeThe range that will be used.
isDeadDefines if and how the death state is checked.
inBattleDefines if and how the battle state is checked.
check(Optional) Delegate function to perform additional checks. Pass null to not use.

◆ Get() [6/7]

virtual List<Combatant> GamingIsLove.ORKFramework.CombatantHandler.Get ( Vector3  position,
Combatant  user,
bool  addPlayerGroup,
IRange  range,
Consider  isEnemy,
Consider  isDead,
Consider  inBattle,
CheckCombatant2  check 
)
virtual

Gets a list of combatants within a defined range to a position.

Parameters
positionThe position used for the check.
userThe user combatant.
addPlayerGrouptrue if player group combatants should be added.
rangeThe range that will be used.
isEnemyDefines if user and other combatants should be enemies.
isDeadDefines if and how the death state is checked.
inBattleDefines if and how the battle state is checked.
check(Optional) Delegate function to perform additional checks. Pass null to not use.
Returns
A new list containing the matching combatants.

◆ Get() [7/7]

virtual void GamingIsLove.ORKFramework.CombatantHandler.Get ( ref List< Combatant list,
Vector3  position,
Combatant  user,
bool  addPlayerGroup,
IRange  range,
Consider  isEnemy,
Consider  isDead,
Consider  inBattle,
CheckCombatant2  check 
)
virtual

Adds combatants within a defined range to a position to a provided list.

Parameters
listThe list the matching combatants will be added to.
positionThe position used for the check.
userThe user combatant.
addPlayerGrouptrue if player group combatants should be added.
rangeThe range that will be used.
isEnemyDefines if user and other combatants should be enemies.
isDeadDefines if and how the death state is checked.
inBattleDefines if and how the battle state is checked.
check(Optional) Delegate function to perform additional checks. Pass null to not use.

◆ GetAll()

virtual List<Combatant> GamingIsLove.ORKFramework.CombatantHandler.GetAll ( )
virtual

Gets all currently registered combatants.

Returns
A new list containing all registered combatants.

◆ GetByFaction()

virtual Dictionary<FactionSetting, List<Combatant> > GamingIsLove.ORKFramework.CombatantHandler.GetByFaction ( Combatant  user,
bool  addPlayerGroup,
IRange  range,
Consider  isDead,
Consider  inBattle,
CheckCombatant2  check 
)
virtual

Gets a dictionary containing lists of combatants per faction that are within range of a user.

Parameters
userThe user combatant.
addPlayerGrouptrue if player group combatants should be added.
rangeThe range that will be used.
isDeadDefines if and how the death state is checked.
inBattleDefines if and how the battle state is checked.
check(Optional) Delegate function to perform additional checks. Pass null to not use.
Returns
A dictionary containing the combatants per faction.

◆ GetFactionGroups()

virtual List<Group> GamingIsLove.ORKFramework.CombatantHandler.GetFactionGroups ( FactionSetting  faction)
virtual

Gets a list of groups of a defined faction ID.

Parameters
factionThe ID of the faction.
Returns
A list containing matching groups.

◆ GetFactionMembers()

virtual List<Combatant> GamingIsLove.ORKFramework.CombatantHandler.GetFactionMembers ( Combatant  user,
FactionSetting  faction,
bool  addPlayerGroup,
IRange  range,
Consider  isDead,
Consider  inBattle,
CheckCombatant2  check 
)
virtual

Gets a list of combatants within a defined range of a user that are part of a defined faction.

Parameters
userThe user combatant.
factionThe ID of the faction.
addPlayerGrouptrue if player group combatants should be added.
rangeThe range that will be used.
isDeadDefines if and how the death state is checked.
inBattleDefines if and how the battle state is checked.
check(Optional) Delegate function to perform additional checks. Pass null to not use.
Returns
A new list containing the matching combatants.

◆ GetFactions()

virtual List<FactionSetting> GamingIsLove.ORKFramework.CombatantHandler.GetFactions ( Combatant  user,
bool  addPlayerGroup,
IRange  range,
Consider  isDead,
Consider  inBattle,
CheckCombatant2  check 
)
virtual

Gets a list of faction IDs of all registered combatants within a defined range of a user.

Parameters
userThe user combatant.
addPlayerGrouptrue if player group combatants should be added.
rangeThe range that will be used.
isDeadDefines if and how the death state is checked.
inBattleDefines if and how the battle state is checked.
check(Optional) Delegate function to perform additional checks. Pass null to not use.
Returns
A list containing the faction IDs.

◆ GetGroups()

virtual List<Group> GamingIsLove.ORKFramework.CombatantHandler.GetGroups ( Combatant  user,
bool  addPlayerGroup,
Consider  isEnemy 
)
virtual

Gets a list of groups of a defined faction ID.

Parameters
userThe user combatant.
addPlayerGrouptrue if the player group should be added.
isEnemyDefines if user and other combatants should be enemies.
Returns
A list containing matching groups.

◆ GetInBattle()

List<Combatant> GamingIsLove.ORKFramework.CombatantHandler.GetInBattle ( )

Gets all combatants currently in battle. Don't change the returned list unless you know what you're doing.

Returns
The in-battle list.

◆ GetInGridRange() [1/2]

virtual void GamingIsLove.ORKFramework.CombatantHandler.GetInGridRange ( ref List< Combatant list,
Combatant  user,
bool  addPlayerGroup,
bool  ignoreCellSize,
bool  blockDiagonalDistance1,
int  minDistance,
int  maxDistance,
Consider  isEnemy,
Consider  isDead,
Consider  inBattle,
GridCellOriginCheck  check 
)
virtual

Adds combatants within a defined grid range to the user to a provided list.

Parameters
listThe list the matching combatants will be added to.
userThe user combatant.
addPlayerGrouptrue if player group combatants should be added.
ignoreCellSizeIgnores the combatant's cell size.
blockDiagonalDistance1
minDistanceThe minimum grid distance.
maxDistanceThe maximum grid distance.
isEnemyDefines if user and other combatants should be enemies.
isDeadDefines if and how the death state is checked.
inBattleDefines if and how the battle state is checked.
check(Optional) Delegate function to perform additional checks. Pass null to not use.

◆ GetInGridRange() [2/2]

virtual void GamingIsLove.ORKFramework.CombatantHandler.GetInGridRange ( ref List< Combatant list,
Combatant  user,
BattleGridCellComponent  origin,
bool  addPlayerGroup,
bool  ignoreCellSize,
bool  blockDiagonalDistance1,
int  minDistance,
int  maxDistance,
Consider  isEnemy,
Consider  isDead,
Consider  inBattle,
GridCellOriginCheck  check 
)
virtual

Adds combatants within a defined grid range to an origin cell to a provided list.

Parameters
listThe list the matching combatants will be added to.
userThe user combatant.
originThe origin cell.
addPlayerGrouptrue if player group combatants should be added.
ignoreCellSizeIgnores the combatant's cell size.
blockDiagonalDistance1
minDistanceThe minimum grid distance.
maxDistanceThe maximum grid distance.
isEnemyDefines if user and other combatants should be enemies.
isDeadDefines if and how the death state is checked.
inBattleDefines if and how the battle state is checked.
check(Optional) Delegate function to perform additional checks. Pass null to not use.

◆ GetNearest()

virtual Combatant GamingIsLove.ORKFramework.CombatantHandler.GetNearest ( Combatant  user,
bool  addPlayerGroup,
IRange  range,
Consider  isEnemy,
Consider  isDead,
Consider  inBattle,
CheckCombatant2  check 
)
virtual

Gets the nearest combatant to the user within a defined range.

Parameters
userThe user combatant.
addPlayerGrouptrue if player group combatants should be added.
rangeThe range that will be used.
isEnemyDefines if user and other combatants should be enemies.
isDeadDefines if and how the death state is checked.
inBattleDefines if and how the battle state is checked.
check(Optional) Delegate function to perform additional checks. Pass null to not use.
Returns
The nearest, matching combatant.

◆ GetOffset()

virtual Combatant GamingIsLove.ORKFramework.CombatantHandler.GetOffset ( Combatant  current,
int  add,
TargetSelectionSortType  sortType,
Combatant  user,
bool  addPlayerGroup,
IRange  range,
Consider  isEnemy,
Consider  isDead,
Consider  inBattle,
CheckCombatant2  check 
)
virtual

Gets a combatant with an offset to a defined combatant in a list of combatants matching defined conditions.

Parameters
currentThe current combatant used as index basis.
addThe offset added to the current combatant's index.
sortTypeDefines how the list of matching combatants will be sorted, e.g. by distance to the user.
userThe user combatant.
addPlayerGrouptrue if player group combatants should be added.
rangeThe range that will be used.
isEnemyDefines if user and other combatants should be enemies.
isDeadDefines if and how the death state is checked.
inBattleDefines if and how the battle state is checked.
check(Optional) Delegate function to perform additional checks. Pass null to not use.
Returns
The combatant at the defined offset.

◆ GetRandom()

virtual Combatant GamingIsLove.ORKFramework.CombatantHandler.GetRandom ( Combatant  user,
bool  addPlayerGroup,
IRange  range,
Consider  isEnemy,
Consider  isDead,
Consider  inBattle,
CheckCombatant2  check 
)
virtual

Gets a random combatant matching defined conditions.

Parameters
userThe user combatant.
addPlayerGrouptrue if player group combatants should be added.
rangeThe range that will be used.
isEnemyDefines if user and other combatants should be enemies.
isDeadDefines if and how the death state is checked.
inBattleDefines if and how the battle state is checked.
check(Optional) Delegate function to perform additional checks. Pass null to not use.
Returns
A random, matching combatant.

◆ IsLocked()

virtual bool GamingIsLove.ORKFramework.CombatantHandler.IsLocked ( Combatant  combatant)
virtual

Checks if a combatant is currently locked (i.e. blocked from being removed).

Parameters
combatantThe combatant that will be checked for.
Returns
true if the combatant is currently locked.

◆ Lock()

virtual void GamingIsLove.ORKFramework.CombatantHandler.Lock ( Combatant  combatant)
virtual

Blocks a combatant from being removed.

Parameters
combatantThe combatant that will be locked.

◆ LockBattle()

virtual void GamingIsLove.ORKFramework.CombatantHandler.LockBattle ( )
virtual

Locks all currently registered combatants that are in battle.

◆ NotifyFactionAggressionStateChange()

virtual void GamingIsLove.ORKFramework.CombatantHandler.NotifyFactionAggressionStateChange ( Combatant  combatant,
Combatant  aggressor 
)
virtual

Notifies a faction's combatants that one of their combatant's changed it's aggression state.

Parameters
combatantThe combatant.

◆ Remove()

virtual void GamingIsLove.ORKFramework.CombatantHandler.Remove ( Combatant  combatant)
virtual

Removes/unregisters a combatant.

Parameters
combatantThe combatant that will be unregistered.

◆ RemoveInBattle()

virtual void GamingIsLove.ORKFramework.CombatantHandler.RemoveInBattle ( Combatant  combatant)
virtual

Removes/unregisters a combatant from the in-battle list. The in-battle list is only for a quick reference to combatants currently participating in battle.

Parameters
combatantThe combatant that will be removed.

◆ SpawnBattle()

virtual void GamingIsLove.ORKFramework.CombatantHandler.SpawnBattle ( )
virtual

Spawns all currently registered combatants that are in battle and not yet spawned.

◆ StartRealTimeAreaBattle()

virtual void GamingIsLove.ORKFramework.CombatantHandler.StartRealTimeAreaBattle ( )
virtual

Joins all spawned (real time battle) combatants to the battle.

◆ Tick()

virtual void GamingIsLove.ORKFramework.CombatantHandler.Tick ( )
virtual

Updates all registered combatants, called each frame.

◆ Unlock()

virtual bool GamingIsLove.ORKFramework.CombatantHandler.Unlock ( Combatant  combatant)
virtual

Unblocks a combatant from being removed, i.e. the combatant can be removed from now on.

Parameters
combatantThe combatant that willbe unlocked.
Returns
true if the combatant was unlocked (i.e. it was previously locked).

◆ UnlockBattle()

virtual void GamingIsLove.ORKFramework.CombatantHandler.UnlockBattle ( )
virtual

Unlocks all currently registered combatants that are in battle.

◆ UpdateAnimations()

virtual void GamingIsLove.ORKFramework.CombatantHandler.UpdateAnimations ( )
virtual

Update animations of all registered combatants. Usually called when the timescale was changed.