Ejemplo n.º 1
0
        protected override void OnDeath(dynamic sourceObject = null)
        {
            // Explosions
            Explosion explosion = new Explosion(Game, 100);

            explosion.Position = Position;
            Game.Layer_OtherAbove.AddChild(explosion);

            explosion          = new Explosion(Game, 60);
            explosion.Position = Utils.GetPointInDirection(Position, Rotation, 40);
            Game.Layer_OtherAbove.AddChild(explosion);

            explosion          = new Explosion(Game, 60);
            explosion.Position = Utils.GetPointInDirection(Position, Rotation, -40);
            Game.Layer_OtherAbove.AddChild(explosion);

            // Deploy Rowboats
            if (AmountOfInfantry <= 6 || (AI != null && ((ShipAI)AI).ReachedBeach))
            {
                base.OnDeath((object)sourceObject);
                return;
            }

            int amountOfRowboats = Utils.RandomInt(0, 2);

            for (int i = 0; i < amountOfRowboats; i++)
            {
                Rowboat rowboat = (Rowboat)Game.AIManager.SpawnEnemy(AIManager.TYPE_ROWBOAT, Utils.GetPointInDirection(Position, i == 0 ? 90 : -90, 100));
                rowboat.Rotation = Rotation;
            }

            base.OnDeath((object)sourceObject);
        }
Ejemplo n.º 2
0
        public void OnRowboatReachedBeach(Rowboat rowboat)
        {
            const float gapX = 4;

            for (int i = 0; i < rowboat.AmountOfInfantry; i++)
            {
                Infantryman enemy = new Infantryman(Game);
                enemy.SetPosition(Utils.GetPointInDirection(
                                      Game.Island.Position,
                                      (float)Utils.GetAngle(Game.Island.Position, rowboat.Position) - ((rowboat.AmountOfInfantry / 2) * gapX) + (i * gapX),
                                      Game.Island.Radius - 5)
                                  );

                enemy.Death += OnEnemyDeath;
                EnemyCount++;
                Game.Layer_Objects.AddChild(enemy);
            }
        }
Ejemplo n.º 3
0
        // Enemy Spawning

        public object SpawnEnemy(uint type, Vector2f position)
        {
            Character enemy;

            switch (type)
            {
            case TYPE_SHIP: enemy = new Ship(Game); break;

            case TYPE_ROWBOAT: enemy = new Rowboat(Game); break;

            default: enemy = new Infantryman(Game); break;
            }

            enemy.Position = position;

            enemy.Death += OnEnemyDeath;
            EnemyCount++;
            Game.Layer_Objects.AddChild(enemy);

            return(enemy);
        }
Ejemplo n.º 4
0
        // Enemy Spawning
        public object SpawnEnemy(uint type, Vector2f position)
        {
            Character enemy;
            switch (type)
            {
                case TYPE_SHIP: enemy = new Ship(Game); break;
                case TYPE_ROWBOAT: enemy = new Rowboat(Game); break;
                default: enemy = new Infantryman(Game); break;
            }

            enemy.Position = position;

            enemy.Death += OnEnemyDeath;
            EnemyCount++;
            Game.Layer_Objects.AddChild(enemy);

            return enemy;
        }
Ejemplo n.º 5
0
        public void OnRowboatReachedBeach(Rowboat rowboat)
        {
            const float gapX = 4;

            for (int i = 0; i < rowboat.AmountOfInfantry; i++)
            {
                Infantryman enemy = new Infantryman(Game);
                enemy.SetPosition(Utils.GetPointInDirection(
                    Game.Island.Position,
                    (float)Utils.GetAngle(Game.Island.Position, rowboat.Position) - ((rowboat.AmountOfInfantry / 2) * gapX) + (i * gapX),
                    Game.Island.Radius - 5)
                    );

                enemy.Death += OnEnemyDeath;
                EnemyCount++;
                Game.Layer_Objects.AddChild(enemy);
            }
        }