Ejemplo n.º 1
0
        /// <summary>
        ///     This method generates enemies.place them in the corresponding terrain
        ///     Each terrain has a type, and according to its type, different types of enemies are to be placed
        /// </summary>
        public void GetEnemies()
        {
            for (int i = 0; i < terrains.Count; i++)
            {
                switch (terrains[i].TerrainType)
                {
                // If the type of terrain is 'FIRE', then generate Fire class and place it in the terrain
                case Terrain.TERRAINSTATE_FIRE:
                    var fire = GameObjectMaker.CreateObject(GameObjectMaker.FIRE);
                    fire.PosX = terrains[i].PosX;
                    fire.PosY = terrains[i].PosY;
                    //  Add the generated fire into the List<Fire> in this class
                    this.fires.Add(fire);
                    break;

                // If the type of terrain is 'Enemy1', then generate Enemy(that has type of basic enemy1) class and place it in the terrain
                case Terrain.TERRAINSTATE_ENEMY1:
                    var basic1 = GameObjectMaker.CreateObject(GameObjectMaker.BASIC1);
                    basic1.PosX = terrains[i].PosX;
                    basic1.PosY = terrains[i].PosY;
                    //  Add the generated enemy into the List<Enemy> in this class
                    enemies.Add(basic1);
                    break;

                case Terrain.TERRAINSTATE_ENEMY2:
                    var basic2 = GameObjectMaker.CreateObject(GameObjectMaker.BASIC2);
                    basic2.PosX = terrains[i].PosX;
                    basic2.PosY = terrains[i].PosY;
                    enemies.Add(basic2);
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        public void Shoot()
        {
            var flash = (Flash)GameObjectMaker.CreateObject(GameObjectMaker.FLASH);

            #region - set basic properties of a flash

            flash.PosX            = this.PosX + this.Width / 4;
            flash.PosY            = this.PosY + this.Height / 4;
            flash.MovingDirection = this.MovingDirection;

            #endregion

            this.flashes.Add(flash);
        }