Exemple #1
0
        //Return face if input is a valid input
        public static Directions.Face ConvertToValidFace(string face)
        {
            if (!Enum.IsDefined(typeof(Directions.Face), face))
            {
                throw new InvalidInputException("Invalid Face");
            }

            Directions.Face direction = (Directions.Face)Enum.Parse(typeof(Directions.Face), face);
            return(direction);
        }
Exemple #2
0
 //Check if the face is valid
 //if true create new pacman with given coordinate
 private void PlacePacman(int x, int y, string face)
 {
     Directions.Face direction = Directions.ConvertToValidFace(face);
     _pacman.Place(_grid, x, y, direction);
 }