Пример #1
0
        private void InitializeRebelShips2()
        {
            for (int i = 0; i < numberOfRebelShips; i++)
            {
                CompositeAction actions = new SequentialAction();

                rebelShips2.Add(new RebelShip(Game, Game.stateManager.shooterState.spriteSheet));
                rebelShips2[i].Initialize();
                rebelShips2[i].RemoveOnStationEnter = false;
                rebelShips2[i].position             = new Vector2(
                    Game.stateManager.overworldState.GetStation("Lavis Station").position.X - 500 + (i * 50),
                    Game.stateManager.overworldState.GetStation("Lavis Station").position.Y - 200);
                rebelShips2[i].collisionEvent = new RemoveOnCollisionEvent(Game, rebelShips2[i],
                                                                           Game.stateManager.overworldState.GetRebelOutpost.GetGameObject("Rebel Base"));
                rebelShips2[i].SaveShip = false;

                actions.Add(new WaitAction(rebelShips2[i],
                                           delegate
                {
                    return(ObjectiveIndex >= 8);
                }));

                actions.Add(new TravelAction(rebelShips2[i],
                                             Game.stateManager.overworldState.GetRebelOutpost.GetGameObject("Rebel Base")));

                rebelShips2[i].AIManager = actions;
            }
        }
Пример #2
0
        private void InitializeShips()
        {
            freighter = new FreighterShip(Game, Game.stateManager.shooterState.spriteSheet);
            freighter.Initialize(Game.stateManager.overworldState.GetSectorX,
                                 Game.stateManager.overworldState.GetStation("Soelara Station"),
                                 Game.stateManager.overworldState.GetStation("Fortrun Station"));

            alliance1          = new AllianceShip(Game, Game.stateManager.shooterState.spriteSheet);
            alliance1.SaveShip = false;
            alliance1.Initialize(Game.stateManager.overworldState.GetSectorX);
            alliance1.rotationSpeed = 2.5f;
            alliance1.speed         = 0.7f;

            rebelShips = new List <RebelShip>();

            for (int i = 0; i < numberOfRebelShips; i++)
            {
                CompositeAction actions = new SequentialAction();

                rebelShips.Add(new RebelShip(Game, Game.stateManager.shooterState.spriteSheet));
                rebelShips[i].Initialize();
                rebelShips[i].RemoveOnStationEnter = false;
                rebelShips[i].position             = new Vector2(destination.X + (i * 50), destination.Y);
                rebelShips[i].collisionEvent       = null;
                rebelShips[i].SaveShip             = false;

                actions.Add(new WaitAction(rebelShips[i],
                                           delegate
                {
                    return(ObjectiveIndex >= 7);
                }));

                actions.Add(new TravelAction(rebelShips[i], freighter));
                switch (i)
                {
                case 0:
                    actions.Add(new TravelAction(rebelShips[i], Game.stateManager.overworldState.GetSectorX.GetGameObject("Lavis")));
                    break;

                case 1:
                    actions.Add(new TravelAction(rebelShips[i], Game.stateManager.overworldState.GetStation("Rebel Base")));
                    break;

                case 2:
                    actions.Add(new TravelAction(rebelShips[i], Game.stateManager.overworldState.GetPlanet("New Norrland")));
                    break;
                }

                rebelShips[i].AIManager = actions;
            }
        }