Ejemplo n.º 1
0
        protected override void OnTick(float interval)
        {
            if (!SPM.IsTooCloseToPlayer(nextSpawnLocation, 150))
            {
                ChasingEnemyEntity.Spawn(Engine, ProcessManager, nextSpawnLocation, SPM.AngleFacingNearestPlayerShip(nextSpawnLocation));
                spawnNumber += 1;
            }

            if (spawnNumber > 2 && (nextSpawnLocation == originalSpawnLocation))
            {
                Kill();
            }

            if (spawnerDirection.X != 0)
            {
                nextSpawnLocation.X += spawnerDirection.X * spacingInterval;
                if (nextSpawnLocation.X > maxWidth / 2 || nextSpawnLocation.X < -maxWidth / 2)
                {
                    nextSpawnLocation = new Vector2(spawnerDirection.X * maxWidth / 2 - (spawnerDirection.X * horizontalSpacing),
                                                    spawnerDirection.X * maxHeight / 2 - (spawnerDirection.X * (verticalSpacing + spacingInterval)));
                    spawnerDirection = new Vector2(0, -spawnerDirection.X);
                }
            }
            else if (spawnerDirection.Y != 0)
            {
                nextSpawnLocation.Y += spawnerDirection.Y * spacingInterval;
                if (nextSpawnLocation.Y > maxHeight / 2 || nextSpawnLocation.Y < -maxHeight / 2)
                {
                    nextSpawnLocation = new Vector2(spawnerDirection.Y * -maxWidth / 2 + (spawnerDirection.Y * (horizontalSpacing + spacingInterval)),
                                                    spawnerDirection.Y * maxHeight / 2 - (spawnerDirection.Y * verticalSpacing));

                    spawnerDirection = new Vector2(spawnerDirection.Y, 0);
                }
            }
        }
        protected override void OnTick(float interval)
        {
            if (!spawnedUniqueEnemies)
            {
                /*LaserEnemyEntity.Spawn(Engine, ProcessManager, new Vector2(-maxWidth / 2 + 50, maxHeight / 2 - 50), SPM.AngleFacingNearestPlayerShip(new Vector2 (-maxWidth / 2, maxHeight / 2)));
                *  LaserEnemyEntity.Spawn(Engine, ProcessManager, new Vector2(maxWidth / 2 - 50, maxHeight / 2 - 50), SPM.AngleFacingNearestPlayerShip(new Vector2 (-maxWidth / 2, maxHeight / 2)));
                *  LaserEnemyEntity.Spawn(Engine, ProcessManager, new Vector2(-maxWidth / 2 + 50, -maxHeight / 2 + 50), SPM.AngleFacingNearestPlayerShip(new Vector2 (-maxWidth / 2, maxHeight / 2)));
                *  LaserEnemyEntity.Spawn(Engine, ProcessManager, new Vector2(maxWidth / 2 - 50, -maxHeight / 2 + 50), SPM.AngleFacingNearestPlayerShip(new Vector2 (-maxWidth / 2, maxHeight / 2)));*/
                ShootingEnemyEntity.Spawn(Engine, ProcessManager, new Vector2(-maxWidth / 2 + 50, maxHeight / 2 - 50), SPM.AngleFacingNearestPlayerShip(new Vector2(-maxWidth / 2, maxHeight / 2)));
                ShootingEnemyEntity.Spawn(Engine, ProcessManager, new Vector2(maxWidth / 2 - 50, maxHeight / 2 - 50), SPM.AngleFacingNearestPlayerShip(new Vector2(-maxWidth / 2, maxHeight / 2)));
                ShootingEnemyEntity.Spawn(Engine, ProcessManager, new Vector2(-maxWidth / 2 + 50, -maxHeight / 2 + 50), SPM.AngleFacingNearestPlayerShip(new Vector2(-maxWidth / 2, maxHeight / 2)));
                ShootingEnemyEntity.Spawn(Engine, ProcessManager, new Vector2(maxWidth / 2 - 50, -maxHeight / 2 + 50), SPM.AngleFacingNearestPlayerShip(new Vector2(-maxWidth / 2, maxHeight / 2)));
                spawnedUniqueEnemies = true;
                spawnCount          += 4;
            }

            ChasingEnemyEntity.Spawn(Engine, ProcessManager, new Vector2(-maxWidth / 2 + 150, maxHeight / 2 - 50), SPM.AngleFacingNearestPlayerShip(new Vector2(-maxWidth / 2, maxHeight / 2)));
            ChasingEnemyEntity.Spawn(Engine, ProcessManager, new Vector2(-maxWidth / 2 + 50, maxHeight / 2 - 150), SPM.AngleFacingNearestPlayerShip(new Vector2(-maxWidth / 2, maxHeight / 2)));

            ChasingEnemyEntity.Spawn(Engine, ProcessManager, new Vector2(maxWidth / 2 - 150, maxHeight / 2 - 50), SPM.AngleFacingNearestPlayerShip(new Vector2(-maxWidth / 2, maxHeight / 2)));
            ChasingEnemyEntity.Spawn(Engine, ProcessManager, new Vector2(maxWidth / 2 - 50, maxHeight / 2 - 150), SPM.AngleFacingNearestPlayerShip(new Vector2(-maxWidth / 2, maxHeight / 2)));

            ChasingEnemyEntity.Spawn(Engine, ProcessManager, new Vector2(-maxWidth / 2 + 150, -maxHeight / 2 + 50), SPM.AngleFacingNearestPlayerShip(new Vector2(-maxWidth / 2, maxHeight / 2)));
            ChasingEnemyEntity.Spawn(Engine, ProcessManager, new Vector2(-maxWidth / 2 + 50, -maxHeight / 2 + 150), SPM.AngleFacingNearestPlayerShip(new Vector2(-maxWidth / 2, maxHeight / 2)));

            ChasingEnemyEntity.Spawn(Engine, ProcessManager, new Vector2(maxWidth / 2 - 150, -maxHeight / 2 + 50), SPM.AngleFacingNearestPlayerShip(new Vector2(-maxWidth / 2, maxHeight / 2)));
            ChasingEnemyEntity.Spawn(Engine, ProcessManager, new Vector2(maxWidth / 2 - 50, -maxHeight / 2 + 150), SPM.AngleFacingNearestPlayerShip(new Vector2(-maxWidth / 2, maxHeight / 2)));
            spawnCount += 8;

            if (spawnCount >= spawnLimit)
            {
                Kill();
            }
        }
 protected override void OnTrigger()
 {
     for (int i = 0; i < Count; i++)
     {
         Vector2 spawnPosition = SPM.GenerateValidCenter(radius);
         float   angle         = SPM.AngleFacingNearestPlayerShip(spawnPosition);
         ChasingEnemyEntity.Spawn(Engine, ProcessManager, spawnPosition, angle);
     }
 }
        protected override void OnTrigger()
        {
            //Console.WriteLine("Triggered SpawnChasingTrianlge");
            Center = SPM.GenerateValidCenter(radius);

            ChasingEnemyEntity.Spawn(Engine, ProcessManager, new Vector2(Center.X, Center.Y + 25), SPM.AngleFacingNearestPlayerShip(new Vector2(Center.X, Center.Y + 25)));
            ChasingEnemyEntity.Spawn(Engine, ProcessManager, new Vector2(Center.X - 29, Center.Y - 25), SPM.AngleFacingNearestPlayerShip(new Vector2(Center.X - 29, Center.Y - 25)));
            ChasingEnemyEntity.Spawn(Engine, ProcessManager, new Vector2(Center.X + 29, Center.Y - 25), SPM.AngleFacingNearestPlayerShip(new Vector2(Center.X + 29, Center.Y - 25)));
        }
        protected override void OnTick(float interval)
        {
            if (_enemyEntities.Count < CVars.Get <int>("spawner_max_enemy_count"))
            {
                Vector2 spawnPosition = new Vector2(0, 0);
                do
                {
                    spawnPosition.X = random.NextSingle(-CVars.Get <float>("screen_width") / 2 * 0.9f, CVars.Get <float>("screen_width") / 2 * 0.9f);
                    spawnPosition.Y = random.NextSingle(-CVars.Get <float>("screen_height") / 2 * 0.9f, CVars.Get <float>("screen_height") / 2 * 0.9f);
                } while (IsTooCloseToPlayer(spawnPosition));

                float facingNearestPlayer = AngleFacingNearestPlayerShip(spawnPosition);
                ChasingEnemyEntity.Spawn(Engine, ProcessManager, spawnPosition, facingNearestPlayer);
            }

            Interval = MathHelper.Max(Interval * CVars.Get <float>("spawner_chasing_enemy_period_multiplier"),
                                      CVars.Get <float>("spawner_chasing_enemy_period_min"));
        }
Ejemplo n.º 6
0
        protected override void OnTrigger()
        {
            // If Gravity hole is re-implemented, make it so that the two gravity holes are either
            // 1) randomly placed, or 2) Mirrored from each-other

            /*Center = SPM.GenerateValidCenter(radius);
             * GravityHoleEntity.Spawn(Engine, ProcessManager, new Vector2(Center.X - 50, Center.Y));
             * GravityHoleEntity.Spawn(Engine, ProcessManager, new Vector2(Center.X + 50, Center.Y));*/

            Center = SPM.GenerateValidCenter(radius);
            ChasingEnemyEntity.Spawn(Engine, ProcessManager, new Vector2(Center.X + 50, Center.Y + 50), SPM.AngleFacingNearestPlayerShip(Center));
            ChasingEnemyEntity.Spawn(Engine, ProcessManager, new Vector2(Center.X - 50, Center.Y - 50), SPM.AngleFacingNearestPlayerShip(Center));

            Center = SPM.GenerateValidCenter(radius);
            ShootingEnemyEntity.Spawn(Engine, ProcessManager, new Vector2(Center.X + 50, Center.Y + 50), SPM.AngleFacingNearestPlayerShip(Center));
            ShootingEnemyEntity.Spawn(Engine, ProcessManager, new Vector2(Center.X - 50, Center.Y - 50), SPM.AngleFacingNearestPlayerShip(Center));

            Center = SPM.GenerateValidCenter(radius);
            LaserEnemyEntity.Spawn(Engine, ProcessManager, new Vector2(Center.X + 50, Center.Y - 50), SPM.AngleFacingNearestPlayerShip(Center));
            LaserEnemyEntity.Spawn(Engine, ProcessManager, new Vector2(Center.X - 50, Center.Y + 50), SPM.AngleFacingNearestPlayerShip(Center));
        }