This repository was archived by the owner on Aug 14, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
EnemyTargeting.cs
ErikOverflow edited this page Apr 9, 2019
·
1 revision
- Collider2D set as a Trigger
- GameEventListener listening to the PlayerDied GameEvent
- PlayerDied() - Releases target if the player dies (So we don't have enemies humping a corpse)
- OnTargetLost - Invoked when a target leaves the range of the Collider
- OnNewTargetAcquired - Invoked when a target enters the range of the Collider
- target - Current target
When a target enters the range of the Trigger Collider2D, the target is first checked to see if it has a CharacterHealth component, then it is set as the current target. Then OnNewTargetAcquired is invoked. If and when that transform leaves the Trigger, OnTargetLost is invoked. If the PlayerDied() is called externally the target is also set to null and OnTargetLost is invoked. The Physics collision matrix is configured to prevent Enemies from colliding with eachother, so we do not need to confirm that the collision contains anything beyond CharacterHealth.
Script Documentation
General Scripts
Generic Character Scripts
Enemy Scripts
Player Scripts
Erik's ongoing laundry list of TODOs that he doesn't want to create issues for