Exemplo n.º 1
0
        // spawns a snake enemy
        public void SpawnSnakeEnemy(int count)
        {
            Vector2 pos = RandomSpawnPosition(300 - ((Pods.Count) * 50));
            float OriginalRotation = (float)(r.Next(628) / 10.0f);
            for (int i = 0; i < count; i++)
            {
                Enemy e = new Enemy(SnakeEnemy, this);
                e.Position = pos;
                e.InitializeTimer = 250 * i;
                e.OriginalRotation = OriginalRotation;
                e.r = r;

                Enemies.Add(e);
            }
        }
Exemplo n.º 2
0
        // Spawns an enemy in a random position
        public void SpawnEnemy(EnemyType type, Vector2 pos)
        {
            // Make a new enemy
            Enemy e = new Enemy(type, this);

            // Let the enemy use our random number generator (for randomness amongst enemies)
            e.r = this.r;

            // Choose closest pod if we behave that way
            if (type.Behavior.Equals(EnemyType.EnemyBehavior.DashTowardsPlayer) || type.Behavior.Equals(EnemyType.EnemyBehavior.MoveTowardsPlayer))
            {
                Pod pod = GetClosestPod(pos);
                e.DestinationPod = pod;
            }

            // float in random direction
            e.Position = pos;

            // Start by fading in
            e.Alpha = 0;

            Enemies.Add(e);
        }