// Fixed update because the Enemy can void FixedUpdate() { animator = GetComponent <Animator> () as Animator; isAggressive = EnemyMovement.calculateDistance(tr, player.transform); if (isAggressive) { // Moving Move(); // Attacking if (!isInCooldown) { // TODO: adjust attack direction to the one of the player Attack(); } } EnemyAnimation.Animate(animator, isAggressive, isFacingRight, isFacingUp, lookingHorizontal); }
//create to accomodate animation differences among the enemies. void Animate() { EnemyAnimation.Animate(false, anim, rb, isGrounded, false, health.IsDead()); // apply animations }
//create to accomodate animation differences among the enemies. protected virtual void Animate() { EnemyAnimation.Animate(isMoving(), anim, rb, isGrounded, isAttacking, health.IsDead()); // apply animations }