Esempio n. 1
0
        /// <summary>
        /// Places a newly revived ghost
        /// </summary>
        /// <param name="ghost">
        /// Ghost to be placed
        /// </param>
        /// <param name="board">
        /// Game board
        /// </param>
        public void PlaceGhost(Cell ghost, Board board)
        {
            Position newPos;

            // x,y position of type Position
            newPos = GetPosition();

            // Change ghost to that position
            ghost.Position = newPos;

            // Add new ghost to playerGhosts array
            PlayerGhosts.Add(ghost);
        }
Esempio n. 2
0
        /// <summary>
        /// Moves picked ghost by one to the given input
        /// </summary>
        /// <param name="position">
        /// Initial position of the ghost
        /// </param>
        /// <param name="board">
        /// Game board
        /// </param>
        public void MoveGhost(Position position, Board board)
        {
            string moveInput;
            int    indexInArray;

            indexInArray = PlayerGhosts.IndexOf
                               (PlayerGhosts.Find(x => x.Position.x == position.x && x.Position.y == position.y));


            Console.WriteLine("What direction are you headed to?\n" +
                              "w - up; a - left; s - down; d - right");
            moveInput = Console.ReadLine();

            switch (moveInput)
            {
            case ("w"):
                if (PlayerGhosts[indexInArray].Position.x > 0)
                {
                    PlayerGhosts[indexInArray].Position.x--;
                }
                break;

            case ("a"):
                if (PlayerGhosts[indexInArray].Position.y > 0)
                {
                    PlayerGhosts[indexInArray].Position.y--;
                }
                break;

            case ("s"):
                if (PlayerGhosts[indexInArray].Position.x < 5)
                {
                    PlayerGhosts[indexInArray].Position.x++;
                }
                break;

            case ("d"):
                if (PlayerGhosts[indexInArray].Position.y < 5)
                {
                    PlayerGhosts[indexInArray].Position.y++;
                }
                break;

            default:
                break;
            }

            MirrorInteractionCheck(PlayerGhosts[indexInArray], board);
        }
Esempio n. 3
0
        /// <summary>
        /// Resurrects a ghost that is currently in the dungeon
        /// </summary>
        /// <returns>
        /// Returns the ghost that is being revived
        /// </returns>
        public Cell RessurectGhost()
        {
            int  ghostToRessurect;
            Cell ghost;

            Console.WriteLine("Pick a ghost from the Dungeon " +
                              "(select it's number): ");

            ghostToRessurect = PickAction(Dungeon.Count);
            ghost            = Dungeon[ghostToRessurect];

            PlayerGhosts.Add(Dungeon[ghostToRessurect]);
            Dungeon.Remove(Dungeon[ghostToRessurect]);

            return(ghost);
        }
Esempio n. 4
0
 /// <summary>
 /// Pushes a ghost outside the castle
 /// </summary>
 /// <param name="ghost">
 /// Ghost that will be taken out the castle
 /// </param>
 public void GhostPushOut(Cell ghost)
 {
     GhostsOutside.Add(ghost);
     PlayerGhosts.Remove(ghost);
 }