// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { bool isPlayer = monster.IsPlayer(); if (monster.typeMode == Monster.TypeMonster.normal && monster.isIdleCoroutine) { return; } if (!monster.isIdleCoroutine || isPlayer) { if (monster.isIdleCoroutine) { monster.StopIdleCoroutine(); } bool isWall = monster.IsWall(); //Métodos para escolher a direção que o inimido deve se mover if (!isPlayer) { monster.StayMode(isWall); } else { monster.AttackingMode(false); } Monster.Direction currentDirection = monster.CurrentDirectionToWalk(); monster.SetAnimDirection(currentDirection); //Escolhe a animação dependendo apenas da direção atual monster.SetVelocity(currentDirection); //Ecolhe a velocidade dependendo da direção atual monster.FlipCharacter(currentDirection); //Inverte o sentido dependendo da direção atual } }
// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { Monster.Direction currentDirection = Monster.Direction.stay; monster.AttackingMode(true); monster.SetAnimDirection(currentDirection); //Escolhe a animação dependendo apenas da direção atual monster.SetVelocity(currentDirection); //Ecolhe a velocidade dependendo da direção atual monster.FlipCharacter(currentDirection); //Inverte o sentido dependendo da direção atual }