// Update is called once per frame
        void LateUpdate()
        {
            // TODO: Haven't found a solution for it, but this can maybe be more optimized
            // Check if vehicle is still on-route
            if (!_startedPathFinding || !NavigationUtil.PathComplete(_agent))
            {
                return;
            }

            // We are not marked to destroy, so we're driving back to were we came from
            _startedPathFinding = false;
            _drivingBack        = !_drivingBack;
            StartPathFinding(false);
        }
Exemple #2
0
 // Update is called once per frame
 void Update()
 {
     // Check if we have a target and if we are actually at the target
     if (HasTarget && NavigationUtil.PathComplete(_agent))
     {
         if (!_rotating && Target != null)
         {
             _agent.isStopped = true;
             // We stopped rotating so we are ready to fire
             if (IsFiringEnabled)
             {
                 Fire();
             }
             else
             {
                 RemoveTarget();
             }
         }
     }
 }