Esempio n. 1
0
 public void addEnemy(Enemy e)
 {
     enemies.Add(e);
 }
Esempio n. 2
0
 public void requestDeleteOf(Enemy e)
 {
     enemiesToDelete.Add(e);
 }
        void loadSpeechCinematic(Enemy kingTomato)
        {
            Cinematic cinematic = new Cinematic();

            ActorEvent ae1 = new ActorEvent(GamerManager.getMainPlayer(), false);
            ae1.moveTo(new Vector3(0.0f, 0, 0.0f), Player.SPEED, true);

            ActorEvent ae2 = new ActorEvent(GamerManager.getMainPlayer(), false);
            ae2.setOrientation(-Calc.PiOver4);

            ActorEvent ae3 = new ActorEvent(kingTomato, false);
            ae3.setAt(new Vector3(1200.0f, 1000.0f, 0.0f));
            ae3.moveTo(new Vector3(600.0f, 360.0f, 0.0f), KingTomato.SPEED);

            DialogEvent de1 = new DialogEvent(tDialogCharacter.KingTomato, TextKey.DialogTomatoComes1.Translate());
            DialogEvent de2 = new DialogEvent(tDialogCharacter.Wish, TextKey.DialogTomatoComes2.Translate());
            DialogEvent de3 = new DialogEvent(tDialogCharacter.KingTomato, TextKey.DialogTomatoComes3.Translate());

            cinematic.events.Add((CinematicEvent)ae1);
            cinematic.events.Add((CinematicEvent)ae2);
            cinematic.events.Add((CinematicEvent)ae3);
            cinematic.events.Add((CinematicEvent)de1);
            cinematic.events.Add((CinematicEvent)de2);
            cinematic.events.Add((CinematicEvent)de3);
            CinematicManager.Instance.addCinematic("kingTomatoSpeech", cinematic);
        }
 private void AddEnemy(Vector2 position)
 {
     Enemy enemy = new Enemy ();
     enemy.Initialize (Graphics.Enemy, position);
     enemies.Add (enemy);
 }
        void setNewSpawnPosition(float cameraTopY, Enemy enemy)
        {
            Vector2 spawnPosition = Vector2.Zero;

            if (enemy is Orange)
            {
                ((Orange)enemy).initialize();
                spawnPosition.Y = enemy.positionY;
            }
            else
            {
                spawnPosition.Y = cameraTopY + enemy.getRadius();
            }
            bool found = false;
            float allowedDistance = enemy.getRadius();
            float allowedDistanceSquared;
            int step = -1;
            do
            {
                ++step;
                allowedDistance += 5.0f;
                allowedDistanceSquared = allowedDistance * allowedDistance;
                spawnPosition.X = Calc.randomScalar(zone.Left, zone.Right);
                for (int i = 0; i < spawnPositions.Length; ++i)
                {
                    if (Vector2.DistanceSquared(spawnPosition, spawnPositions[i]) > allowedDistanceSquared)
                    {
                        found = true;
                        break;
                    }
                }

            }
            while (!found);

            enemy.position2D = spawnPosition;
        }