Пример #1
0
        public bool loadLevel(string levelName)
        {
            if (levelName == null)
            {
                return(false);
            }

            level       = null;
            elapsedTime = 0;
            numPeoples  = 0;
            Level newLevel = Level.readFrom(Content.RootDirectory + "\\Levels\\" + levelName + ".2d");

            PopulationManager tempPopulationManagerRef = new PopulationManager();

            if (newLevel != null)
            {
                level = newLevel;
                List <GameObject> Sky = new List <GameObject>();
                for (int i = 1; i < 4; i++)
                {
                    Cloud fluffyAndWhite = new Cloud(i);
                    fluffyAndWhite.position = new Vector2(Firecracker.random.Next(0, Firecracker.level.dimensions.X * Firecracker.level.gridSize), Firecracker.random.Next(0, Firecracker.level.dimensions.Y * Firecracker.level.gridSize));
                    Sky.Add(fluffyAndWhite);
                }

                level.addObjects(Sky);
                m_Forest.Initialize(Firecracker.spriteSheets);
                Ocean water = new Ocean();
                water.position = new Vector2(10, 10);
                level.addObject(water);

                return(true);
            }
            return(false);
        }
 public PopulationManager()
 {
     Instance = this;
     Init();
 }