IEnumerator chooseAction() { while (true) { CatActions currAction = (CatActions)Random.Range(0, System.Enum.GetValues(typeof(CatActions)).Length); yield return(doAction(currAction)); } }
IEnumerator doAction(CatActions chosenAction) { switch (chosenAction) { //case CatActions.LICK: // yield return lickCat(); // break; case CatActions.WALK: yield return(walkCat(walkVelocity)); break; case CatActions.RUN: yield return(walkCat(runVelocity)); break; case CatActions.PLAY: if (!brinquedo.GetComponent <Brinquedo>().ocupado) { brinquedo.GetComponent <Brinquedo>().ocupado = true; //pega o brinquedo yield return(playCat(walkVelocity)); brinquedo.GetComponent <Brinquedo>().ocupado = false; //libera o brinquedo } else { doAction((CatActions)Random.Range(0, System.Enum.GetValues(typeof(CatActions)).Length - 1)); //PLAY é a ultima ação do enum } break; case CatActions.EAT: yield return(eatCat(walkVelocity)); break; } }
public void ChangeAnimationWalking() { action = CatActions.Walking; }
public void ChangeAnimationStanding() { action = CatActions.Standing; }
public void ChangeAnimationScratching() { action = CatActions.Scratching; }