Beispiel #1
0
        public MovementManager(PhysicsObj obj, WeenieObject wobj)
        {
            PhysicsObj = obj;
            WeenieObj  = wobj;

            MotionInterpreter = new MotionInterp(obj, wobj);
            MoveToManager     = new MoveToManager(obj, wobj);
        }
Beispiel #2
0
 public InterpretedMotionState InqInterpretedMotionState()
 {
     if (MotionInterpreter == null)
     {
         MotionInterpreter = MotionInterp.Create(PhysicsObj, WeenieObj);
         if (PhysicsObj != null)
         {
             MotionInterpreter.enter_default_state();
         }
     }
     return(MotionInterpreter.InterpretedState);
 }
Beispiel #3
0
 public void move_to_interpreted_state(InterpretedMotionState state)
 {
     if (MotionInterpreter == null)
     {
         MotionInterpreter = MotionInterp.Create(PhysicsObj, WeenieObj);
         if (PhysicsObj != null)
         {
             MotionInterpreter.enter_default_state();
         }
     }
     MotionInterpreter.move_to_interpreted_state(state);
 }
Beispiel #4
0
 public MotionInterp get_minterp()
 {
     if (MotionInterpreter == null)
     {
         MotionInterpreter = MotionInterp.Create(PhysicsObj, WeenieObj);
         if (PhysicsObj != null)
         {
             MotionInterpreter.enter_default_state();
         }
     }
     return(MotionInterpreter);
 }
Beispiel #5
0
        public void EnterDefaultState()
        {
            if (PhysicsObj == null)
            {
                return;
            }

            if (MotionInterpreter == null)
            {
                MotionInterpreter = MotionInterp.Create(PhysicsObj, WeenieObj);
            }

            MotionInterpreter.enter_default_state();
        }
Beispiel #6
0
        public WeenieError PerformMovement(MovementStruct mvs)
        {
            PhysicsObj.set_active(true);

            switch (mvs.Type)
            {
            case MovementType.RawCommand:
            case MovementType.InterpretedCommand:
            case MovementType.StopRawCommand:
            case MovementType.StopInterpretedCommand:
            case MovementType.StopCompletely:

                if (MotionInterpreter == null)
                {
                    MotionInterpreter = MotionInterp.Create(PhysicsObj, WeenieObj);
                    if (PhysicsObj != null)
                    {
                        MotionInterpreter.enter_default_state();
                    }
                }
                return(MotionInterpreter.PerformMovement(mvs));

            case MovementType.MoveToObject:
            case MovementType.MoveToPosition:
            case MovementType.TurnToObject:
            case MovementType.TurnToHeading:

                if (MoveToManager == null)
                {
                    MoveToManager = MoveToManager.Create(PhysicsObj, WeenieObj);
                }

                return(MoveToManager.PerformMovement(mvs));

            default:
                return(WeenieError.GeneralMovementFailure);
            }
        }
Beispiel #7
0
        public static MotionInterp Create(PhysicsObj obj, WeenieObject wobj)
        {
            var motionInterp = new MotionInterp(obj, wobj);

            return(motionInterp);
        }