private Vector3 _lastTouchedWaypoint; // keep track of the last waypoint we touched, so we don't keep going back to it void Start() { // Set up the generic AI components _animator = GetComponent <CharacterAnimator>(); _settings = GetComponent <EnemyAISettings>(); _awareness = GetComponent <EnemyAwareness>(); _personalHearingRadius = GetComponentInChildren <HearingRadius>(); _personalVision = GetComponentInChildren <Vision>(); _timeSincePlayerSeen = 0; // Set up Astar _seeker = GetComponent <Seeker>(); if (_seeker == null) { _seeker = gameObject.AddComponent <Seeker>(); } // Map the output of this class to the input of the animator GetComponent <CharacterInput>().UpdateInputMethod = UpdateInput; // Let child classes initialize OnStart(); // Finally, register ourselves with the AI system GameManager.AI.Enemies.Add(this); transform.parent = GameManager.AI.transform; }
private void Start() { enemyAwareness = GetComponent <EnemyAwareness>(); playersTransform = FindObjectOfType <PlayerMovementBehavior>().transform; enemyNavMeshAgent = GetComponent <NavMeshAgent>(); }