Example #1
0
 // Update is called once per frame
 void Update()
 {
     // Rotate
     if (target)
     {
         float dist = Vector3.Distance(target.position, transform.position);
         if (dist > 30f)
         {
             thruster.SetTargetDirection(target.position - transform.position);
             thruster.SetThrustSpeed(thruster.thrustSpeedBase);
             thruster.SetThrustV(1f);// Go
             thruster.BrakeOff();
         }
         else
         {
             thruster.SetThrustV(1f);
             thruster.SetThrustSpeed(thruster.thrustSpeedBase * 0.5f);// SLOW
             thruster.BrakeOff();
             levelController.ProcessArrival(gameObject, target.gameObject);
         }
     }
     else
     {
         EventManager.TriggerEvent("haulerLost");
     }
 }