コード例 #1
0
ファイル: Dialog.cs プロジェクト: takishita2nd/HokkaidoWar
 public void CloseDialog(asd.Layer2D layer)
 {
     layer.RemoveObject(_dialog);
     layer.RemoveObject(_valueText);
     layer.RemoveObject(_okButton);
     layer.RemoveObject(_cancelButton);
 }
コード例 #2
0
ファイル: Dungeon.cs プロジェクト: wraikny/RandomDungeon
        void Tree()
        {
            int vNum = roomLayer.Objects.OfType <Room>().Count(x => x.isMainRoom);

            var kruskal = new Kruskal(vNum, graphLayer.Objects.OfType <Line>());

            LineList = kruskal.Compute();

            var unSelectedLines = new List <Line>();

            foreach (Line line in graphLayer.Objects.OfType <Line>().Where(x => !(LineList.Any(x.Equals))))
            {
                graphLayer.RemoveObject(line);
                unSelectedLines.Add(line);
            }

            foreach (Line line in new List <Line>(unSelectedLines)
                     .OrderBy(i => Guid.NewGuid())
                     .Take((int)(unSelectedLines.Count() * 0.1))
                     )
            {
                graphLayer.AddObject(line);
                unSelectedLines.Remove(line);
            }
            foreach (Line line in unSelectedLines)
            {
                line.Dispose();
            }
        }
コード例 #3
0
ファイル: Dungeon.cs プロジェクト: wraikny/RandomDungeon
        void Corridor()
        {
            var corridorList = new List <Corridor>();

            foreach (Line line in corridorLayer.Objects.OfType <Line>())
            {
                asd.Vector2DF size;
                float         thickness = (float)(3 * tileSize);

                size.X = (float)(Convert.ToInt32(Equals(line.start.pos.Y, line.end.pos.Y)) * Math.Sqrt(line.sqLength) + thickness);
                size.Y = (float)(Convert.ToInt32(Equals(line.start.pos.X, line.end.pos.X)) * Math.Sqrt(line.sqLength) + thickness);

                var corridor = new Corridor(line.mid, size, timesN);
                corridorList.Add(corridor);
                corridorLayer.AddObject(corridor);

                corridorLayer.RemoveObject(line);
                line.Dispose();
            }
            foreach (Room room in roomLayer.Objects.OfType <Room>()
                     .Where(x => !x.isMainRoom &&
                            (x.size.X < wMean * 1.25 || x.size.Y < hMean * 1.25)))
            {
                room.isCorridorRoom = corridorList
                                      .Any(obj => (!(obj.rd.X - tileSize / 2 < room.lu.X || room.rd.X < obj.lu.X + tileSize / 2) &&
                                                   !(obj.rd.Y - tileSize / 2 < room.lu.Y || room.rd.Y < obj.lu.Y + tileSize / 2)));
            }
        }
コード例 #4
0
ファイル: Dungeon.cs プロジェクト: wraikny/RandomDungeon
        protected override void OnUpdated()
        {
            base.OnUpdated();
            if (!stopRoom)
            {
                var rooms = roomLayer.Objects.OfType <Room>();
                CameraPos(rooms);
                cameraN  = Math.Max(cameraN, 1.2f * timesN);
                stopRoom = rooms.All(x => !x.moving);
            }
            else if (!selectedMain)
            {
                foreach (Room room in roomLayer.Objects.OfType <Room>())
                {
                    room.Round();
                }
                SelectMain();
                selectedMain = true;
            }
            else if (mainRoomList.Count() < 10)
            {
                Deserialize();
                Serialize();
            }
            else if (!doneDelaunay)
            {
                DelaunayDiagram();
                doneDelaunay = true;
            }
            else if (!doneTreed)
            {
                Tree();
                doneTreed = true;
            }
            else if (!doneCorridorLine)
            {
                CorridorLine();
                doneCorridorLine = true;
            }
            else if (!doneCorridor)
            {
                Corridor();
                doneCorridor = true;
            }
            else if (!doneMakeDungeon)
            {
                foreach (Room room in roomLayer.Objects.OfType <Room>().Where(x => !x.isMainRoom && !x.isCorridorRoom))
                {
                    roomLayer.RemoveObject(room);
                    room.Dispose();
                }
                var rooms = roomLayer.Objects.OfType <Room>().Where(x => x.isMainRoom || x.isCorridorRoom);
                CameraPos(rooms);

                doneMakeDungeon = true;
            }
            else if (!isSceneChanging && asd.Engine.Keyboard.GetKeyState(asd.Keys.Enter) == asd.KeyState.Push)
            {
                isSceneChanging = true;
                Deserialize();
                Serialize();

                /*
                 * var scene = new Dungeon();
                 * asd.Engine.ChangeSceneWithTransition(scene, new asd.TransitionFade(0.0f, 0.5f));
                 */
            }

            //cameraN = 1f;
        }