コード例 #1
0
ファイル: Rowboat.cs プロジェクト: Torrunt/SingleSwitchGame
        private void AddInfantryman(Vector2f position)
        {
            Infantryman infantryman = new Infantryman(Game, 1, null);

            infantryman.Visible = true;
            infantryman.SetPosition(position);
            AddChild(infantryman);
            InfantryPassengers.Add(infantryman);
        }
コード例 #2
0
ファイル: AIManager.cs プロジェクト: Torrunt/SingleSwitchGame
        private void SpawnOverTimeTimerHandler(Object source = null, ElapsedEventArgs e = null)
        {
            if (Game.Player == null)
            {
                StopSpawnEnemiesOverTime();
                return;
            }
            if (Game.Player.HasPowerup(Powerup.FREEZE_TIME))
            {
                return;
            }

            // Spawn enemy
            Character enemy;

            switch (SpawnOverTimeType)
            {
            case TYPE_SHIP:
            {
                enemy = new Ship(Game);
                int      angle          = Utils.RandomInt(0, 359);
                Vector2f intersectPoint = Utils.RaycastAgainstBounds(Game.Bounds, Game.Center, Utils.GetPointInDirection(Game.Center, angle, Game.Size.X));
                enemy.SetPosition(Utils.GetPointInDirection(intersectPoint, angle, 200));
                break;
            }

            default:
            {
                enemy = new Infantryman(Game);
                enemy.SetPosition(Utils.GetPointInDirection(Game.Island.Position, Utils.RandomInt(0, 359), Game.Island.Radius - 5));
                break;
            }
            }

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

            SpawnOverTimeCount++;

            if (SpawnOverTimeCount >= SpawnOverTimeAmount)
            {
                // Finish spawning enemies over time
                StopSpawnEnemiesOverTime();
            }
        }
コード例 #3
0
ファイル: AIManager.cs プロジェクト: Torrunt/SingleSwitchGame
        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);
            }
        }
コード例 #4
0
ファイル: AIManager.cs プロジェクト: Torrunt/SingleSwitchGame
        public void OnShipReachedBeach(Ship ship)
        {
            const float gapX = 4;

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

                enemy.Death += OnEnemyDeath;
                EnemyCount++;
                Game.Layer_Objects.AddChild(enemy);
            }
        }
コード例 #5
0
ファイル: AIManager.cs プロジェクト: Torrunt/SingleSwitchGame
        private void SpawnOverTimeTimerHandler(Object source = null, ElapsedEventArgs e = null)
        {
            if (Game.Player == null)
            {
                StopSpawnEnemiesOverTime();
                return;
            }
            if (Game.Player.HasPowerup(Powerup.FREEZE_TIME))
                return;

            // Spawn enemy
            Character enemy;
            switch (SpawnOverTimeType)
            {
                case TYPE_SHIP:
                {
                    enemy = new Ship(Game);
                    int angle = Utils.RandomInt(0, 359);
                    Vector2f intersectPoint = Utils.RaycastAgainstBounds(Game.Bounds, Game.Center, Utils.GetPointInDirection(Game.Center, angle, Game.Size.X));
                    enemy.SetPosition(Utils.GetPointInDirection(intersectPoint, angle, 200));
                    break;
                }
                default:
                {
                    enemy = new Infantryman(Game);
                    enemy.SetPosition(Utils.GetPointInDirection(Game.Island.Position, Utils.RandomInt(0, 359), Game.Island.Radius - 5));
                    break;
                }
            }

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

            SpawnOverTimeCount++;

            if (SpawnOverTimeCount >= SpawnOverTimeAmount)
            {
                // Finish spawning enemies over time
                StopSpawnEnemiesOverTime();
            }
        }
コード例 #6
0
ファイル: AIManager.cs プロジェクト: Torrunt/SingleSwitchGame
        public void OnShipReachedBeach(Ship ship)
        {
            const float gapX = 4;

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

                enemy.Death += OnEnemyDeath;
                EnemyCount++;
                Game.Layer_Objects.AddChild(enemy);
            }
        }
コード例 #7
0
ファイル: AIManager.cs プロジェクト: Torrunt/SingleSwitchGame
        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);
            }
        }
コード例 #8
0
ファイル: Rowboat.cs プロジェクト: Torrunt/SingleSwitchGame
 private void AddInfantryman(Vector2f position)
 {
     Infantryman infantryman = new Infantryman(Game, 1, null);
     infantryman.Visible = true;
     infantryman.SetPosition(position);
     AddChild(infantryman);
     InfantryPassengers.Add(infantryman);
 }