Example #1
0
 /// <summary>
 /// Moves a character down a floor if it exists, otherwise create a new floor.
 /// </summary>
 /// <param name="player">The character to move down a floor.</param>
 public void MovePlayerDownFloor(Character player)
 {
     currentFloor--;
     Floor floorTravelingTo;
     if (currentFloor < 0)
     {
         floorTravelingTo = new Floor(this, viewport, 50 + floorsVisited, 50 + floorsVisited);
         floors.Insert(0,floorTravelingTo);
         floorsVisited++;
         currentFloor = 0;
     }
     else
     {
         floorTravelingTo = floors[currentFloor];
     }
     MovePlayerToFloor(floorTravelingTo.StairsUpLocation, floorTravelingTo, player);
 }
Example #2
0
 /// <summary>
 /// Moves a chracter up a floor, if it exists, otherwise create a new
 /// floor.
 /// </summary>
 /// <param name="player">The chracter to move up the floor.</param>
 public void MovePlayerUpFloor(Character player)
 {
     currentFloor++;
     Floor floorTravelingTo;
     if (currentFloor >= floors.Count)
     {
         floorTravelingTo = new Floor(this, viewport, 50 + floorsVisited, 50 + floorsVisited);
         floors.Add(floorTravelingTo);
         floorsVisited++;
     }
     else
     {
         floorTravelingTo = floors[currentFloor];
     }
     MovePlayerToFloor(floorTravelingTo.StairsDownLocation, floorTravelingTo, player);
 }
Example #3
0
 /// <summary>
 /// Handles addeing the chracter to the new floor, and sets the positon of the character to the 
 /// location of the stairs.
 /// </summary>
 /// <param name="stairsLocation">The location of the stairs where the player will end up at.</param>
 /// <param name="floorTravelingTo">The new floor the chracter will be on.</param>
 /// <param name="player">The character to move to the new floor.</param>
 private void MovePlayerToFloor(Point stairsLocation, Floor floorTravelingTo, Character player)
 {
     floorTravelingTo.AddChracter(player);
     player.PositionX = stairsLocation.X;
     player.PositionY = stairsLocation.Y + 1;
     RenderDungeon((int)player.PositionX, (int)player.PositionY);
 }