Пример #1
0
 public virtual void Stop()
 {
     this.targetVelocity   = Vector3.get_zero();
     this.validDestination = false;
     Mover.Mode mode = this.mode;
     if (mode != Mover.Mode.Physics)
     {
         if (mode == Mover.Mode.Navigation)
         {
             this.navMeshAgent.ResetPath();
         }
     }
     else
     {
         Rigidbody arg_55_0 = this.thisRigidbody;
         Vector3   zero     = Vector3.get_zero();
         this.thisRigidbody.set_angularVelocity(zero);
         arg_55_0.set_velocity(zero);
         this.thisRigidbody.Sleep();
     }
 }
Пример #2
0
    protected virtual void Start()
    {
        Mover.Mode mode = this.mode;
        if (mode != Mover.Mode.Physics)
        {
            if (mode == Mover.Mode.Navigation)
            {
                this.speed = this.navMeshAgent.get_speed();
                this.navMeshAgent.set_enabled(true);
                if (this.applyPosition)
                {
                    this.navMeshAgent.set_updatePosition(false);
                    this.navMeshAgent.set_updateRotation(false);
                }
                else
                {
                    this.navMeshAgent.set_updatePosition(true);
                    switch (this.rotationMode)
                    {
                    case Mover.RotationMode.Mover:
                    case Mover.RotationMode.Ignore:
                        this.navMeshAgent.set_updateRotation(false);
                        break;

                    case Mover.RotationMode.Agent:
                        this.navMeshAgent.set_updateRotation(true);
                        break;
                    }
                }
            }
        }
        else
        {
            this.thisRigidbody.set_isKinematic(false);
            this.thisRigidbody.set_freezeRotation(true);
            this.thisRigidbody.set_useGravity(false);
        }
    }