コード例 #1
0
        public City()
        {
            box             = new Box2D(new Vectors.Vector2Int(0, 0), 0, 0);
            background      = ConsoleColor.DarkGray;
            zoneDescription = "You're in a city, filled with shops and things to do.";
            zone            = ZoneType.City;

            // Private
            subZones = new Zone[]
            {
                new Castle(this),
                new Guild(this),
                new Store(this),
                new Blacksmith(this),
                new Tavern(this)
            };

            zoneDialog = "As you explore the city, there are a multitude of activities to partake in.";
            zoneMenu   = new Menu()
            {
                commands = new List <Menu.Option>
                {
                    new Menu.Option("Visit the Castle", new Menu.Option.Event(new Action <Menu>(SetMenu => Game.GetInstance().scene.SetMenu(subZones[0].zoneMenu)), subZones[0].zoneMenu)),
                    new Menu.Option("Visit the Adventurers Guild", new Menu.Option.Event(new Action <Menu>(SetMenu => Game.GetInstance().scene.SetMenu(subZones[1].zoneMenu)), subZones[1].zoneMenu)),
                    new Menu.Option("Visit the General Store", new Menu.Option.Event(new Action <Menu>(SetMenu => Game.GetInstance().scene.SetMenu(subZones[2].zoneMenu)), subZones[2].zoneMenu)),
                    new Menu.Option("Visit the Blacksmith", new Menu.Option.Event(new Action <Menu>(SetMenu => Game.GetInstance().scene.SetMenu(subZones[3].zoneMenu)), subZones[3].zoneMenu)),
                    new Menu.Option("Visit the Tavern", new Menu.Option.Event(new Action <Menu>(SetMenu => Game.GetInstance().scene.SetMenu(subZones[4].zoneMenu)), subZones[4].zoneMenu)),
                    new Menu.Option("Leave the City", new Menu.Option.Event(new Action(Player.GetInstance().SetState)))
                }
            };
        }
コード例 #2
0
ファイル: Box2D.cs プロジェクト: UFX-Official/CS-ConsoleRPG
        public static Map <int, List <Side> > GetAdjacent(Box2D box2D, List <Box2D> list)
        {
            int         numAdjacent   = 0;
            List <Side> adjacentSides = new List <Side>();

            for (int i = 0; i < list.Count; i++)
            {
                if (box2D.start.X == list[i].end.X)
                {
                    numAdjacent++;
                    adjacentSides.Add(Side.left);
                }

                else if (box2D.end.X == list[i].start.X)
                {
                    numAdjacent++;
                    adjacentSides.Add(Side.right);
                }

                else if (box2D.start.Y == list[i].end.Y)
                {
                    numAdjacent++;
                    adjacentSides.Add(Side.top);
                }

                else if (box2D.end.Y == list[i].start.Y)
                {
                    numAdjacent++;
                    adjacentSides.Add(Side.bottom);
                }
            }

            return(new Map <int, List <Side> >(numAdjacent, adjacentSides));
        }
コード例 #3
0
        public Grassland()
        {
            box = new Box2D(new Vectors.Vector2Int(0, 0), 0, 0);
            background      = ConsoleColor.DarkGreen;
            zoneDescription = "The area consists of a grassy terrain with some slight hills.";
            zone            = ZoneType.Grassland;

            zoneDialog = "Nothing much to see here";
            zoneMenu   = new Menu()
            {
                commands = new List <Menu.Option>
                {
                    new Menu.Option("Move Along", new Menu.Option.Event(new Action(Player.GetInstance().SetState)))
                }
            };
        }
コード例 #4
0
        public Zone()
        {
            background      = ConsoleColor.Black;
            zoneDescription = "The area is a vast openness with no discerning details to it.";
            box             = new Box2D(new Vectors.Vector2Int(0, 0), 0, 0);
            zone            = ZoneType.Empty;

            zoneDialog = "";
            zoneMenu   = new Menu()
            {
                commands = new List <Menu.Option>
                {
                    new Menu.Option("Wait", null)
                }
            };
        }
コード例 #5
0
            public Blacksmith(Zone parent)
            {
                box             = new Box2D(new Vectors.Vector2Int(0, 0), 0, 0);
                background      = ConsoleColor.Black;
                zoneDescription = "You're at the Blacksmiths.";
                zone            = ZoneType.Empty;

                this.parent = parent;

                zoneDialog = "The Blacksmith grunts as you approach, but stays focused on his work.";
                zoneMenu   = new Menu()
                {
                    commands = new List <Menu.Option>
                    {
                        new Menu.Option("Leave the Blacksmiths", new Menu.Option.Event(new Action <Menu>(SetMenu => Game.GetInstance().scene.SetMenu(parent.zoneMenu)), parent.zoneMenu))
                    }
                };
            }
コード例 #6
0
            public Castle(Zone parent)
            {
                box             = new Box2D(new Vectors.Vector2Int(0, 0), 0, 0);
                background      = ConsoleColor.Black;
                zoneDescription = "You're in the city Castle.";
                zone            = ZoneType.Empty;

                this.parent = parent;

                zoneDialog = "Guards stand vigilent as you walk the hallway.";
                zoneMenu   = new Menu()
                {
                    commands = new List <Menu.Option>
                    {
                        new Menu.Option("Leave the Castle", new Menu.Option.Event(new Action <Menu>(SetMenu => Game.GetInstance().scene.SetMenu(parent.zoneMenu)), parent.zoneMenu))
                    }
                };
            }
コード例 #7
0
            public Tavern(Zone parent)
            {
                box             = new Box2D(new Vectors.Vector2Int(0, 0), 0, 0);
                background      = ConsoleColor.Black;
                zoneDescription = "You're in the Tavern.";
                zone            = ZoneType.Empty;

                this.parent = parent;

                zoneDialog = "The Tavern is filled with people enjoying their time off.";
                zoneMenu   = new Menu()
                {
                    commands = new List <Menu.Option>
                    {
                        new Menu.Option("Rest", null),
                        new Menu.Option("Leave the Tavern", new Menu.Option.Event(new Action <Menu>(SetMenu => Game.GetInstance().scene.SetMenu(parent.zoneMenu)), parent.zoneMenu))
                    }
                };
            }
コード例 #8
0
            public Guild(Zone parent)
            {
                box             = new Box2D(new Vectors.Vector2Int(0, 0), 0, 0);
                background      = ConsoleColor.Black;
                zoneDescription = "You're in the Adventurer's Guild.";
                zone            = ZoneType.Empty;

                this.parent = parent;

                zoneDialog = "The Guild has a few people hanging around.";
                zoneMenu   = new Menu()
                {
                    commands = new List <Menu.Option>
                    {
                        new Menu.Option("Check Quest Board", null),
                        new Menu.Option("Leave the Guild", new Menu.Option.Event(new Action <Menu>(SetMenu => Game.GetInstance().scene.SetMenu(parent.zoneMenu)), parent.zoneMenu))
                    }
                };
            }
コード例 #9
0
            public Store(Zone parent)
            {
                box             = new Box2D(new Vectors.Vector2Int(0, 0), 0, 0);
                background      = ConsoleColor.Black;
                zoneDescription = "You're in the General Store.";
                zone            = ZoneType.Empty;

                this.parent = parent;

                zoneDialog = "The owner greets you expectantly.";
                zoneMenu   = new Menu()
                {
                    commands = new List <Menu.Option>
                    {
                        new Menu.Option("Buy wares", null),
                        new Menu.Option("Sell wares", null),
                        new Menu.Option("Leave the Shop", new Menu.Option.Event(new Action <Menu>(SetMenu => Game.GetInstance().scene.SetMenu(parent.zoneMenu)), parent.zoneMenu))
                    }
                };
            }
コード例 #10
0
ファイル: Map1.cs プロジェクト: UFX-Official/CS-ConsoleRPG
        public override void DrawMap(Box2D container)
        {
            int maxWidth  = container.GetWidth();
            int maxHeight = container.GetHeight();

            Vector2Int position = new Vector2Int(container.GetCentreX(), container.GetCentreY());

            position = new Vector2Int(position.X - (maxWidth / 2), position.Y - (maxHeight / 2));

            for (int row = 0; row < grid.GetLength(1); row++)
            {
                position.X = container.GetCentreX() - (maxWidth / 2);
                for (int col = 0; col < grid.GetLength(0); col++)
                {
                    grid[col, row].box.height = maxHeight / height;
                    grid[col, row].box.width  = maxWidth / width;

                    Box2D.Adjacency adjacency;
                    {
                        if (row == 0 && col == 0)
                        {
                            adjacency = Box2D.Adjacency.Bottom_Right;
                        }
                        else if (row == 0 && col == width - 1)
                        {
                            adjacency = Box2D.Adjacency.Bottom_Left;
                        }
                        else if (row == height - 1 && col == 0)
                        {
                            adjacency = Box2D.Adjacency.Top_Bottom_Right;
                        }
                        else if (row == height - 1 && col == width - 1)
                        {
                            adjacency = Box2D.Adjacency.Top_Bottom_Left;
                        }
                        else if (row == 0)
                        {
                            adjacency = Box2D.Adjacency.Bottom_Left_Right;
                        }
                        else if (row == height - 1)
                        {
                            adjacency = Box2D.Adjacency.Top_Left_Right;
                        }
                        else if (col == 0)
                        {
                            adjacency = Box2D.Adjacency.Top_Bottom_Right;
                        }
                        else if (col == width - 1)
                        {
                            adjacency = Box2D.Adjacency.Top_Bottom_Left;
                        }
                        else
                        {
                            adjacency = Box2D.Adjacency.All;
                        }
                    }

                    grid[col, row].box.Draw(position, adjacency);
                    grid[col, row].box.start = position;

                    if (grid[col, row].zone == ZoneType.City)
                    {
                        grid[col, row].box.Outline(grid[col, row].background);
                    }
                    if (grid[col, row].zone == ZoneType.Grassland)
                    {
                        grid[col, row].box.Outline(grid[col, row].background);
                    }

                    position.X += maxWidth / width;
                }

                position.Y += maxHeight / height;
            }

            UpdateMap();

            base.DrawMap(container);
        }
コード例 #11
0
ファイル: Map.cs プロジェクト: UFX-Official/CS-ConsoleRPG
 public virtual void DrawMap(Box2D container)
 {
 }