public void AddFreighterToSector()
        {
            FreighterShip tempShip = new FreighterShip(game, spriteSheet);

            tempShip.Initialize(sector);
            overworld.AddOverworldObject(tempShip);
        }
        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;
            }
        }
Exemple #3
0
        public void Load()
        {
            int count = Game.saveFile.GetPropertyAsInt("spaceobjects", "count", 0);

            RemoveAllPirates();

            for (int i = 0; i < count; i++)
            {
                float posx = Game.saveFile.GetPropertyAsFloat("spaceobj" + i, "posx", 0);
                float posy = Game.saveFile.GetPropertyAsFloat("spaceobj" + i, "posy", 0);

                switch (Game.saveFile.GetPropertyAsString("spaceobj" + i, "name", "error"))
                {
                case "Rebel Ship":
                    string levelName = Game.saveFile.GetPropertyAsString("spaceobj" + i, "level", "");
                    sectorX.shipSpawner.AddRebelShip(new Vector2(posx, posy), levelName);
                    break;

                case "Freighter Ship":
                    String destName             = Game.saveFile.GetPropertyAsString("spaceobj" + i, "dest", "error");
                    GameObjectOverworld dest    = GetCelestialBodyFromString(destName);
                    FreighterShip       tmpShip = new FreighterShip(Game, Game.spriteSheetVerticalShooter);
                    tmpShip.Initialize();
                    tmpShip.SetSector(Game.stateManager.overworldState.GetSectorX);
                    tmpShip.SetDefaultBehaviour();
                    tmpShip.SetEndPlanet(dest);
                    sectorX.shipSpawner.AddFreighterToSector(tmpShip, new Vector2(posx, posy));
                    break;

                case "Alliance Ship":
                    sectorX.shipSpawner.AddAllianceShip(new Vector2(posx, posy));
                    break;

                case "Hangar Ship":
                    sectorX.shipSpawner.AddHangarShip(new Vector2(posx, posy));
                    break;
                }
            }

            // Load Shop Inventory
            foreach (GameObjectOverworld obj in GetImmobileObjects)
            {
                if (obj is SubInteractiveObject)
                {
                    ((SubInteractiveObject)obj).Load();
                }
            }
        }
Exemple #4
0
        private void Setup()
        {
            freighter1 = new FreighterShip(Game, Game.stateManager.shooterState.spriteSheet);
            freighter1.Initialize(Game.stateManager.overworldState.GetSectorX,
                                  Game.stateManager.overworldState.GetPlanet("Highfence"),
                                  Game.stateManager.overworldState.GetStation("Soelara Station"));
            freighter1.AIManager      = new TravelAction(freighter1, Game.stateManager.overworldState.GetStation("Soelara Station"));
            freighter1.collisionEvent = new RemoveOnCollisionEvent(Game, freighter1, Game.stateManager.overworldState.GetStation("Soelara Station"));
            freighter1.SaveShip       = false;

            enemies = Game.stateManager.overworldState.GetSectorX.shipSpawner.GetOverworldShips(2, "rebel");

            foreach (OverworldShip ship in enemies)
            {
                ship.AIManager = new FollowInViewAction(ship, freighter1);
            }

            SetDestinations();
            SetupObjectives();
        }