コード例 #1
0
 private static void CreateCharacter(IGameDungeon dungeon)
 {
     var character = new Character();
     var upstairs = dungeon.Single(c => c.Type == XType.StairsUp);
     character.Location = upstairs.Location;
     dungeon.Character = character;
 }
コード例 #2
0
        public void Fill(IGameDungeon dungeon)
        {
            ////TODO create all the stuff and place into dungeon

            CreateStairs(dungeon);
            CreateCharacter(dungeon);
        }
コード例 #3
0
 private static void CreateStairs(IGameDungeon dungeon)
 {
     var emptyCells = dungeon.Where(cell => cell.Type == XType.Empty).ToList();
     var count = emptyCells.Count;
     var upstairsPosition = StaticRandom.Next(emptyCells.Count);
     var downstairsPosition = StaticRandom.NextNotEqualToOld(
         0, emptyCells.Count, upstairsPosition);
     var upstairsCell = emptyCells[upstairsPosition];
     var downstairsCell = emptyCells[downstairsPosition];
     dungeon[upstairsCell].Type = XType.StairsUp;
     dungeon[downstairsCell].Type = XType.StairsDown;
 }
コード例 #4
0
ファイル: Processor.cs プロジェクト: CatSkald/Roguelike
        private static MapImage GetMapPicture(IGameDungeon dungeon)
        {
            var image = new MapImage(dungeon.Width, dungeon.Height);

            for (int x = 0; x < dungeon.Width; x++)
                for (int y = 0; y < dungeon.Height; y++)
                {
                    var cell = dungeon[x, y];
                    image.SetTile(cell.Location, cell.Type);
                }

            image.SetTile(dungeon.Character.Location, dungeon.Character.Type);

            return image;
        }