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)); } }