// Start is called before the first frame update void Start() { timer = roamTimer; currState = BotStates.Roam; agent = this.GetComponent <NavMeshAgent>(); mazeGen = GameObject.FindObjectOfType <Maze>(); botPosHolder = GetComponent <BotTargetPosHolderScript>(); Vector3 newPos = mazeGen.GetRandomPosOnMaze(); agent.SetDestination(newPos); currTargetPos = newPos; }
// Start is called before the first frame update void Start() { roamTimer = Random.Range(5f, 15f); transform.GetChild(4).GetComponent <AudioSource>().Play(); alertAudioSource = transform.GetChild(3).GetComponent <AudioSource>(); inSoundPlayCoroutine = false; walkingAudioSource = transform.GetChild(2).GetComponent <AudioSource>(); currState = BotStates.Roam; agent = this.GetComponent <NavMeshAgent>(); mazeGen = GameObject.FindObjectOfType <Maze>(); botPosHolder = GetComponent <BotTargetPosHolderScript>(); Vector3 newPos = mazeGen.GetRandomPosOnMaze(); agent.SetDestination(newPos); currTargetPos = newPos; playAlertSoundOnce = false; }