コード例 #1
0
ファイル: LevelTester.cs プロジェクト: midas06/TheseusFinal
        public List <Point> GetAdjacent()
        {
            List <Point> adjTiles = new List <Point>();

            if (!theseus.IsBlocked(Direction.Up))
            {
                if (!checkedTiles.Contains(ReturnAdjPoint(Direction.Up)))
                {
                    adjTiles.Add(Direction.Up);
                    if (!possibleTiles.Contains(ReturnAdjPoint(Direction.Up)))
                    {
                        possibleTiles.Add(ReturnAdjPoint(Direction.Up));
                    }
                }
            }
            if (!theseus.IsBlocked(Direction.Right))
            {
                if (!checkedTiles.Contains(ReturnAdjPoint(Direction.Right)))
                {
                    adjTiles.Add(Direction.Right);
                    if (!possibleTiles.Contains(ReturnAdjPoint(Direction.Right)))
                    {
                        possibleTiles.Add(ReturnAdjPoint(Direction.Right));
                    }
                }
            }
            if (!theseus.IsBlocked(Direction.Left))
            {
                if (!checkedTiles.Contains(ReturnAdjPoint(Direction.Left)))
                {
                    adjTiles.Add(Direction.Left);
                    if (!possibleTiles.Contains(ReturnAdjPoint(Direction.Left)))
                    {
                        possibleTiles.Add(ReturnAdjPoint(Direction.Left));
                    }
                }
            }
            if (!theseus.IsBlocked(Direction.Down))
            {
                if (!checkedTiles.Contains(ReturnAdjPoint(Direction.Down)))
                {
                    adjTiles.Add(Direction.Down);
                    if (!possibleTiles.Contains(ReturnAdjPoint(Direction.Down)))
                    {
                        possibleTiles.Add(ReturnAdjPoint(Direction.Down));
                    }
                }
            }

            return(adjTiles);
        }
コード例 #2
0
ファイル: Game.cs プロジェクト: midas06/TheseusFinal
        /* The go button */
        public bool Run(Keys theKeypress)
        {
            Point direction = PlayersTurn(theKeypress);

            //theView.Start();
            //theView.Display("****" + currentMap.Name + " ****\n");
            //theView.Display(MapCreator.ObjectsToString(theMap, theseus, minotaur));

            if (!IsGameOver())
            {
                if (!theseus.IsBlocked(direction))
                {
                    theseus.Move(direction);
                    if (!theseus.IsFinished())
                    {
                        minotaur.Hunt();
                    }
                }
            }


            return(true);
        }