Esempio n. 1
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (TowerDefense game = new TowerDefense())
     {
         game.Run();
     }
 }
Esempio n. 2
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (TowerDefense game = new TowerDefense())
     {
         game.Run();
     }
 }
Esempio n. 3
0
 public TowerManager(TowerDefense game)
     : base(game)
 {
     this.game = game;
     towers = new List<Tower>();
     towerList = new List<Tower>();
 }
Esempio n. 4
0
 public Spawner(TowerDefense game, List<Enemy> enemies, List<Wave> waves)
     : base(game)
 {
     this.game = game;
     this.enemies = enemies;
     this.waves = waves;
     current = 0;
     if (waves.Count == 0)
     {
         finished = true;
     }
 }
Esempio n. 5
0
        public Loader(XmlDocument document, ContentManager content, TowerDefense game)
        {
            doc = document;
            this.content = content;

            spriteDict = new Dictionary<int, Sprite>();
            towerDict = new Dictionary<int, Tower>();
            projectileDict = new Dictionary<int, Projectile>();
            enemyDict = new Dictionary<int, Enemy>();
            levelDict = new List<Level>();
            spawnPointDict = new Dictionary<int, SpawnPoint>();
            this.game = game;

            LoadAssetsFromXml();
        }
Esempio n. 6
0
        // The main point of entry for the application.
        private static void Main(string[] args)
        {
            // Check the folders and files in the system.
            FolderSystem.Check();

            // Load the game data.
            DataManager.Load();

            // Initialize the audio system.
            AudioManager.Initialize();

            // Initialize the game graphics.
            GraphicsManager.Initialize();

            // Start the game-loop.
            TowerDefense.GameLoop();
        }
Esempio n. 7
0
        public Level(TowerDefense game, int cellSize, int rows, int columns, Point end, List<Wave> waves, int id)
            : base(game)
        {
            this.cellSize = cellSize;
            this.end = end;
            this.Id = id;
            InitializeMap(rows, columns);
            Lost = false;
            Won = false;
            this.game = game;
            componentList = new List<GameComponent>();

            towerManager = new TowerManager(game);
            enemyManager = new EnemyManager(game);
            projectileManager = new ProjectileManager(game);
            spawner = new Spawner(game, enemyManager.enemies, waves);
            camera = new Camera(game, Vector2.Zero, columns*cellSize, rows*cellSize);
            Paused = false;

            pathfinding = Pathfinding.createPath(IntObjectMap, new Point(0, 0), End);
        }
Esempio n. 8
0
        private static void GameLoop()
        {
            int tick = 0, tick16 = 0;

            // Mark the game as running, and show the main window.
            TowerDefense.Flag = GameFlag.Running;

            // Continue to run the game-loop as long as our game
            // is not closing.
            while (TowerDefense.Flag != GameFlag.Closing)
            {
                tick = Environment.TickCount;

                // Render graphics up to 60 times a second.
                if (tick16 < tick)
                {
                    GraphicsManager.Graphics?.Draw();
                    tick16 = tick + 16;
                }
            }

            // The game will only be destroyed when the flag is set to closing.
            TowerDefense.Destroy();
        }
Esempio n. 9
0
 public ProjectileManager(TowerDefense game)
     : base(game)
 {
     this.game = game;
     shoots = new List<Projectile>();
 }
Esempio n. 10
0
 public EnemyManager(TowerDefense game)
     : base(game)
 {
     this.game = game;
     enemies = new List<Enemy>();
 }