예제 #1
0
        public GameContent(Race number, string name, SocialStatus status, PlayerClass player, int[] stats, int[] resists, int[] baseRes, int[,] wp)
        {
            Buffer = new ScreenBuffer();
            WorldLevels = new List<Level>();
            time = new Time();

            turnCounter = 0;

            PC = new Character(69, 10, number, status, name, player, stats, resists, baseRes, wp);

            for (int i = 3; i > 0; i--)
            {
                WorldLevels.Add(new Level("Start" + i));
            }

            for (int i = 0; i < WorldLevels.Count - 1; i++)
            {   
                Level.ConnectLevels(WorldLevels[i], WorldLevels[i + 1]);
            }

            //CurrentMap = new Map("Data\\dungeon3.txt");
            //CurrentMap = new Map(map, 1, 5);
            CurrentLevel = WorldLevels[0];
            CurrentMap = CurrentLevel.Map;
            Entities = WorldLevels[0].EntityList;
            List<Point> startingPosList = Map.GenerateListOfStartingLocations(CurrentMap.map);
            Point startingPos = Map.SelectRandomEmptyLocation(startingPosList);
            //CurrentMap.addObjectAt(69, 10, PC);
            CurrentMap.addObjectAt(startingPos.X + 1, startingPos.Y + 5, PC);
            //startingPos = Map.SelectRandomEmptyLocation(startingPosList);
            ////CurrentMap.addObjectAt(27, 34, Enemy);
            //CurrentMap.addObjectAt(startingPos.X + 1, startingPos.Y + 5, Enemy);
        }
예제 #2
0
 public static void ConnectLevels(Level bottom, Level top)
 {   
     bottom.CreateEntrance(top.Name);
     top.CreateExit(bottom.Name);
 }
예제 #3
0
        public void GoUpDownStair()
        {
            if (GC.PC.ActualStamina < 1)
            {
                Game.topTextArea.AddMessage(Game.Lang[StringName.TIRED_TEXT]);
                return;
            }
            MapTile tile;
            StairWay stair = new StairWay();
            StairWay newStair = new StairWay();
            Level lvl = new Level();
            Point newPos = new Point();
            bool stairs = false;
            string lvlname;

            tile = GC.CurrentMap.getMapTile(GC.PC.getX(),GC.PC.getY());
            //check if stairs are on same tile as player
            foreach (Object o in tile._objects)
            {
                if (o.getType() == ObjectType.O_STAIRWAY)
                {
                    stairs = true;
                    stair = o as StairWay;
                }
            }
            if (!stairs)
            {
                if (dir.Key == ConsoleKey.OemPeriod)
                {
                    topTextArea.AddMessage("There is no stairs leading downwards");
                }
                else if (dir.Key == ConsoleKey.OemComma)
                {
                    topTextArea.AddMessage("There is no stairs leading upwards");
                }
                
            }
            else
            {
                //check if we selected proper key
                if (dir.Key == ConsoleKey.OemPeriod && stair.Type != StairWaysType.DOWN)
                {
                    topTextArea.AddMessage("There is no stairs leading downwards");
                    return;
                }
                if (dir.Key == ConsoleKey.OemComma && stair.Type != StairWaysType.UP)
                {
                    topTextArea.AddMessage("There is no stairs leading upwards");
                    return;
                }
                //remove player from current location
                tile.removeObject(GC.PC);
                //get position of stairs on next level
                //get name of next level
                lvlname = stair.LevelName;
                foreach (Level l in GC.WorldLevels)
                {
                    if (l.Name == lvlname)
                    {
                        lvl = l;
                        break;
                    }
                }
                //get stairs from new level
                if (dir.Key == ConsoleKey.OemPeriod)
                {
                    newStair = lvl.Entrance;
                    newStair.hasBeenSeen();
                }
                else if (dir.Key == ConsoleKey.OemComma)
                {
                    newStair = lvl.Exit;
                    newStair.hasBeenSeen();
                }
                newPos = newStair.Position;
                //set new level's map  as current
                GC.CurrentMap = lvl.Map;
                //set current level
                GC.CurrentLevel = lvl;
                //set new entity list from new level
                GC.Entities = lvl.EntityList;
                //set player at new map
                GC.CurrentMap.addObjectAt(newPos.X + GC.CurrentMap.getOffsetX(), newPos.Y + GC.CurrentMap.getOffsetY(), GC.PC);
                //use stamina every  5 minutes (ie 30 rounds) if not in comabt
                if (Game.GC.turnCounter != 0 && Game.GC.turnCounter % 30 == 0)
                {
                    GC.PC.ActualStamina -= 1;
                }
                Game.bottomPanel.needUpdate = true;
                ClearMap();
                GC.CurrentMap.draw();
            }
        }