public override void Update(EnemyController controller) { Vector3 direction = controller.TargetPlayer.GetPostion - controller.GetEnemyPosition; direction.y = 0; controller.transform.rotation = Quaternion.Slerp(controller.transform.rotation, Quaternion.LookRotation(direction), 0.1f); if (direction.magnitude < 17 && !isAttacking) { isAttacking = true; } else if (!isAttacking) { controller.SwitchState(EnemyData.State.PURSUIT); } }
public override void Update(EnemyController controller) { Vector3 direction = controller.TargetPlayer.GetPostion - controller.GetEnemyPosition; direction.y = 0; controller.transform.rotation = Quaternion.Slerp(controller.transform.rotation, Quaternion.LookRotation(direction), 0.1f); if (direction.magnitude > 17) { controller.transform.Translate(0, 0, 0.2f); } else { controller.SwitchState(EnemyData.State.ATTACKING); } }
public virtual void Start(EnemyController controller) { controller.SwitchState(EnemyData.State.IDLE); }