void Start() { // Cache agent component and destination agent = GetComponent <NavMeshAgent>(); detection = GetComponent <SoundDetection>(); destination = agent.destination; monsterTarget = monsterDestination[0]; }
void Awake() { animEnemy = this.GetComponentInChildren <Animator> (); enemyHealth = this.GetComponentInChildren <ObjectHealth> (); elapsedTime = 0.0f; PlayerGO = GameObject.FindGameObjectWithTag("Player"); playerTransform = PlayerGO.transform; sightDetector = new SightDetection(sightRange, sightAngle); soundDetector = new SoundDetection(hearingSensitivity); InitializeFSM(); }