Activating enemies and camera paths
We've now achieved a lot for the Dead keys game. We've created health, enemy AI, and the ability for enemies to change between different states. However, if we add enemies to the level right now, they'll begin in a sleeping or deactivated state and, as yet, nothing changes that state. To move forwards, we'll need to link the camera position in the level with enemies so that, as the camera moves near to an enemy, the enemy wakes up and becomes an active participant in the game. This allows us to pace our game with the camera. To achieve this, we'll use strategically positioned Trigger Volumes, with a GameTrigger
script. The script is as follows:
//------------------------------------ using UnityEngine; using System.Collections; using UnityEngine.EventSystems; using UnityEngine.Events; //------------------------------------ public class GameTrigger : MonoBehaviour { public UnityEvent OnTriggerEntered; ...