Hittables Manager
Presented by IHittablesManager interface, this system stores collection of all active Hittable objects in game, sorted by teams. It helps to find nearest hittables in certain point within certain radius.
To use this system, inject IHittablesManager interface into your class, as shown below:
[Inject] private IHittablesManager hittablesManager;
Available methods
void RegisterHittable(Hittable hittable)
This method registers hittable object in manager. Other characters and projectiles will be able to find it.
void UnregisterHittable(Hittable hittable)
This method unregisters hittable object from manager. Other characters and projectiles will not be able to find it.
List<Hittable> GetHittablesInRadius(Vector3 from, float radius)
This method returns all Hittable objects in certain radius from given point.
Example:
var foundHittables = hittablesManager.GetHittablesInRadius(transform.position, 10f);
List<Hittable> GetOtherTeamsHittablesInRadius(Vector3 from, float radius, TeamType excludedTeam)
This method returns all Hittable objects in certain radius from given point, from all teams except excludedTeam.
Example:
var foundEnemies = hittablesManager.GetOtherTeamsHittablesInRadius(
transform.position,
10f,
TeamType.Player);
List<Hittable> GetTeamHittablesInRadius(Vector3 from, float radius, TeamType teamType)
This method returns all Hittable objects in certain radius from given point, from certain team.
void KillTeam(TeamType teamType)
This method instantly kills all Hittable objects of certain team.
Last updated