public void Execute() { animal.UpdateEnergyLevel(Time.deltaTime * 2f); if (anim != null) { anim.Play(animationStr); } if (animal.GetEnergyLevel() >= 80f) { // No need to rest animal.ExitBusy(); //animal.GetStateMachine().SwtichToPreviousState(); animal.GetStateMachine().ChangeState(new WanderAround(agent, animal.GetSpeed(), animal)); } }
public void Execute() { //Debug.Log("looking for resources"); if (animal.GetHungerLevel() < animal.GetThirstLevel()) // So far this condition checking should be safe. { // Debug.Log("Searching for food!"); animal.GetStateMachine().ChangeState(searchForFood); } else if (animal.GetHungerLevel() > animal.GetThirstLevel()) { // Debug.Log("Searching for water!"); animal.GetStateMachine().ChangeState(searchForWater); } else { animal.GetStateMachine().ChangeState(new WanderAround(agent, animal.GetSpeed(), animal)); } }
private void ReleaseGrabbing() { Debug.Log("RELEASING!!!"); gameObject.SendMessage("OnRelease", GrabbingHandRef.GetComponent <IHandGesture>().GetVelocity(), SendMessageOptions.DontRequireReceiver); transform.parent = null; grabbed = false; if (animalComponentRef != null) { // animalComponentRef.ExitBusy(); animalComponentRef.ExitBusyWithStateChange(new WanderAround(animalComponentRef.GetComponent <NavMeshAgent>(), animalComponentRef.GetSpeed(), animalComponentRef)); } }