GetCamera() public method

Public method to allow access to the level's Camera object.
public GetCamera ( ) : Camera
return Camera
Ejemplo n.º 1
0
 /// <summary>
 /// Updates where the camera should be looking while the player is scoping.
 /// </summary>
 /// <param name="gameReference">The key to accessing the camera.</param>
 private void updateScope(Pantheon gameReference)
 {
     if (gameReference.ControlManager.actions.Aim && this.ArmedItem.type == Item.Type.WEAPON)
     {
         int offsetSpeed = 30;
         gameReference.ControlManager.disableMotion();
         if (offset.Length() == 0)
         {
             switch (Facing)
             {
                 case Direction.forward:
                     offset.Y = offsetSpeed;
                     break;
                 case Direction.forwardLeft:
                     offset.X = (int)(-offsetSpeed / Math.Sqrt(2));
                     offset.Y = (int)(offsetSpeed / Math.Sqrt(2));
                     break;
                 case Direction.Left:
                     offset.X = -offsetSpeed;
                     break;
                 case Direction.backLeft:
                     offset.X = (int)(-offsetSpeed / Math.Sqrt(2));
                     offset.Y = (int)(-offsetSpeed / Math.Sqrt(2));
                     break;
                 case Direction.back:
                     offset.Y = -offsetSpeed;
                     break;
                 case Direction.backRight:
                     offset.X = (int)(offsetSpeed / Math.Sqrt(2));
                     offset.Y = (int)(-offsetSpeed / Math.Sqrt(2));
                     break;
                 case Direction.Right:
                     offset.X = offsetSpeed;
                     break;
                 case Direction.forwardRight:
                     offset.X = (int)(offsetSpeed / Math.Sqrt(2));
                     offset.Y = (int)(offsetSpeed / Math.Sqrt(2));
                     break;
                 default:
                     offset = Vector2.Zero;
                     break;
             }
         }
         if (totalOffset.Length() < ((Weapon)ArmedItem).Range / 2)
         {
             gameReference.GetCamera().Pos += offset;
             totalOffset += offset;
         }
         updateLaser(gameReference, totalOffset);
     }
     else
     {
         gameReference.ControlManager.enableMotion();
         totalOffset = Vector2.Zero;
         offset = Vector2.Zero;
     }
 }
 /// <summary>
 /// Updates where the camera should be looking while the player is scoping.
 /// </summary>
 /// <param name="gameReference">The key to accessing the camera.</param>
 private void updateScope(Pantheon gameReference)
 {
     if (gameReference.controlManager.actions.Aim)
     {
         int offsetNum = 15;
         gameReference.controlManager.disableMotion();
         if (offset.Length() == 0)
         {
             switch (facing)
             {
                 case Direction.forward:
                     offset.Y = offsetNum;
                     break;
                 case Direction.forwardLeft:
                     offset.X = (int)(-offsetNum / Math.Sqrt(2));
                     offset.Y = (int)(offsetNum / Math.Sqrt(2));
                     break;
                 case Direction.Left:
                     offset.X = -offsetNum;
                     break;
                 case Direction.backLeft:
                     offset.X = (int)(-offsetNum / Math.Sqrt(2));
                     offset.Y = (int)(-offsetNum / Math.Sqrt(2));
                     break;
                 case Direction.back:
                     offset.Y = -offsetNum;
                     break;
                 case Direction.backRight:
                     offset.X = (int)(offsetNum / Math.Sqrt(2));
                     offset.Y = (int)(-offsetNum / Math.Sqrt(2));
                     break;
                 case Direction.Right:
                     offset.X = offsetNum;
                     break;
                 case Direction.forwardRight:
                     offset.X = (int)(offsetNum / Math.Sqrt(2));
                     offset.Y = (int)(offsetNum / Math.Sqrt(2));
                     break;
                 default:
                     offset = Vector2.Zero;
                     break;
             }
         }
         if (totalOffset.Length() < 300)
         {
             gameReference.GetCamera().Pos += offset;
             totalOffset += offset;
         }
         updateLaser(gameReference, totalOffset);
     }
     else
     {
         gameReference.controlManager.enableMotion();
         totalOffset = Vector2.Zero;
         offset = Vector2.Zero;
     }
 }