예제 #1
0
        public bool move(Directions dir)
        {
            if (currChamber.hasDoor(dir))
            {
                switch (dir)
                {
                case Directions.North:
                    currChamber = temple.getChamber(currChamber.getYPos() - 1, currChamber.getXPos());
                    break;

                case Directions.East:
                    currChamber = temple.getChamber(currChamber.getYPos(), currChamber.getXPos() + 1);
                    break;

                case Directions.South:
                    currChamber = temple.getChamber(currChamber.getYPos() + 1, currChamber.getXPos());
                    break;

                case Directions.West:
                    currChamber = temple.getChamber(currChamber.getYPos(), currChamber.getXPos() - 1);
                    break;
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #2
0
 public Hero(string name, int firepower, Temple temple) : base(name, firepower)
 {
     this.temple = temple;
     currChamber = temple.getChamber(
         GameManager.getRandom().Next(temple.getYChambers()),
         GameManager.getRandom().Next(temple.getXChambers())
         );
 }