예제 #1
0
        public void AddToScene(TractorInfo info)
        {
            movementType       = info.inMovementType;
            mapObjectRemoved   = false;
            position           = info.position;
            noGoZoneId[0]      = info.noGoZoneId[0];
            noGoZoneId[1]      = info.noGoZoneId[1];
            mapObjectId        = info.mapObjectId;
            wheelsMapObjectId1 = info.wheelsMapObjectId1;
            wheelsMapObjectId2 = info.wheelsMapObjectId2;
            swappedBackward    = false;
            speed             = kMaxSpeed;
            movement          = TractorMovement.kTractorGoingRight;
            stateTimer        = (kTimeMoving * 0.5f);
            firstInGameUpdate = true;
            tractorType       = info.type;
            currentWheelAnim  = 0;
            animationTimer    = 0.0f;
            xStartPosition    = position.x;
            if (tractorType == (int)ObjectType.kOT_CrossingTractor)
            {
                speed            = -3.0f;
                framesToCrossMap = (int)((Constants.MAP_WIDTH + kMapEdgeBufferTractor) / -3.0f);
            }
            else if (tractorType == (int)ObjectType.kOT_CrossingLandRover)
            {
                speed            = 3.0f;
                framesToCrossMap = (int)((Constants.MAP_WIDTH + kMapEdgeBufferTractor) / -3.0f);
            }

            if (position.y < 550.0f)
            {
                this.IncrementUpdateToStartPosition();
                firstInGameUpdate = false;
                ((Globals.g_world.game).GetMapObject(mapObjectId)).SetPosition(position);
            }

            if ((tractorType == (int)ObjectType.kOT_CrossingTractor) || (tractorType == (int)ObjectType.kOT_Tractor))
            {
                zoneOffset[0] = -47.0f;
                zoneOffset[1] = 40.0f;
            }
            else
            {
                zoneOffset[0] = -40.0f;
                zoneOffset[1] = 32.0f;
            }
        }
예제 #2
0
 public void UpdateMovement_Oscillate()
 {
     if (movement == TractorMovement.kTractorGoingRight)
     {
         speed = Utilities.ApproachP1P2(speed, kMaxSpeed, kTractorAcc);
         if (stateTimer >= kTimeMoving)
         {
             stateTimer = 0.0f;
             movement   = TractorMovement.kTractorStoppingRight;
         }
     }
     else if (movement == TractorMovement.kTractorStoppingRight)
     {
         speed = Utilities.ApproachP1P2(speed, 0.0f, kTractorAcc);
         if (stateTimer >= kTimeStopped)
         {
             stateTimer = 0.0f;
             movement   = TractorMovement.kTractorGoingLeft;
         }
     }
     else if (movement == TractorMovement.kTractorGoingLeft)
     {
         speed = Utilities.ApproachP1P2(speed, -kMaxSpeed, kTractorAcc);
         if (stateTimer >= kTimeMoving)
         {
             stateTimer = 0.0f;
             movement   = TractorMovement.kTractorStoppingLeft;
         }
     }
     else if (movement == TractorMovement.kTractorStoppingLeft)
     {
         speed = Utilities.ApproachP1P2(speed, 0.0f, kTractorAcc);
         if (stateTimer >= kTimeStopped)
         {
             stateTimer = 0.0f;
             movement   = TractorMovement.kTractorGoingRight;
         }
     }
 }
예제 #3
0
        }                                                                ///@property(readwrite,assign) bool swappedBackward;

        public void SetMovement(TractorMovement inThing)
        {
            movement = inThing;
        }                                                             ///@property(readwrite,assign) TractorMovement movement;