Example #1
0
 private void Avoid()
 {
     if (avoidence == Avoidence.Rotating)
     {
         motor.Rotate(-1 * data.rotateSpeed);
         if (CanMove())
         {
             avoidence = Avoidence.Moving;
             exitTime  = avoidTime;
         }
     }
     else if (avoidence == Avoidence.Moving)
     {
         if (CanMove())
         {
             exitTime -= Time.deltaTime;
             motor.Move(data.moveSpeed);
             if (exitTime <= 0)
             {
                 avoidence = Avoidence.NotAvoiding;
             }
         }
         else
         {
             avoidence = Avoidence.Rotating;
         }
     }
 }
Example #2
0
 private void Flee()
 {
     if (CanMove())
     {
         if (motor.RotateToward(this.gameObject.transform.position - Player.transform.position, data.rotateSpeed))
         {
             //Do Nothing, Is Rotating
         }
         else
         {
             motor.Move(data.moveSpeed);
         }
     }
     else
     {
         avoidence = Avoidence.Rotating;
     }
 }
Example #3
0
 private void Chase()
 {
     if (CanMove())
     {
         if (motor.RotateToward(Player.transform.position, data.rotateSpeed))
         {
             //Do Nothing, Is Rotating
         }
         else
         {
             motor.Fire();
             motor.Move(data.moveSpeed);
         }
     }
     else
     {
         avoidence = Avoidence.Rotating;
     }
 }