IEnumerator Start() { state = babyCowAIState.WANDERING; agent = GetComponent <NavMeshAgent> (); enemy = GameObject.FindGameObjectWithTag("Alan").transform; wanderPoints = GameObject.FindGameObjectsWithTag("BabyCowPoints"); if (moveTo == null) { moveTo = getRandomMoveTo(); } yield return(new WaitForSeconds(Random.Range(30, 45))); GameObject obj = Instantiate(Cow, gameObject.transform.position, gameObject.transform.rotation) as GameObject; Debug.Log("new cow1"); Destroy(gameObject); }
public void MakeDecision() { prevState = state; switch (state) { case babyCowAIState.IDLE: state = Idle(); break; case babyCowAIState.WANDERING: state = Wander(); break; case babyCowAIState.CHASING: state = Chase(); break; case babyCowAIState.ATTACK: state = Attack(); break; } }