示例#1
0
 /* Changes position of the player
  * Changes position.x or position.y relative to the direction of gravity
  */
 private void Movement(MOVE tempMove)
 {
     if (!rotLevel)
     {
         if (currGrav.Equals(GRAVITY.UP) || currGrav.Equals(GRAVITY.DOWN))
         {
             if (tempMove.Equals(MOVE.LEFT))
             {
                 currentPos.x      += -0.05f;
                 currentMovement    = MOVE.LEFT;
                 transform.position = currentPos;
             }
             else if (tempMove.Equals(MOVE.RIGHT))
             {
                 currentPos.x      += 0.05f;
                 currentMovement    = MOVE.RIGHT;
                 transform.position = currentPos;
             }
         }
         else if (currGrav.Equals(GRAVITY.LEFT) || currGrav.Equals(GRAVITY.RIGHT))
         {
             if (tempMove.Equals(MOVE.LEFT))
             {
                 currentPos.y      += -0.05f;
                 currentMovement    = MOVE.LEFT;
                 transform.position = currentPos;
             }
             else if (tempMove.Equals(MOVE.RIGHT))
             {
                 currentPos.y      += 0.05f;
                 currentMovement    = MOVE.RIGHT;
                 transform.position = currentPos;
             }
         }
     }
     else
     {
         if (tempMove.Equals(MOVE.LEFT))
         {
             currentPos.x      += -0.05f;
             currentMovement    = MOVE.LEFT;
             transform.position = currentPos;
         }
         else if (tempMove.Equals(MOVE.RIGHT))
         {
             currentPos.x      += 0.05f;
             currentMovement    = MOVE.RIGHT;
             transform.position = currentPos;
         }
     }
 }