public override void Update(CampaignFaction faction)
    {
        ShipConfiguration config = shipConfigurationManager.shipConfigurations[0];
        CampaignSquadron squadron = new CampaignSquadron();
        squadron.SetData(config);
        station.BuySquadron(squadron);
        squadronsBuilt++;

        if (squadronsBuilt >= 3)
        {
            objectiveComplete = true;
        }
    }
Beispiel #2
0
    /// <summary>
    /// Called by Unity when a level is loaded
    /// </summary>
    /// <param name="level">The level number that was loaded</param>
    private void OnLevelWasLoaded(int level)
    {
        if (Application.loadedLevelName == "BattleMode" || Application.loadedLevelName == "CombatTest")
        {
            if (Application.loadedLevelName == "CombatTest")
            {
                ShipConfiguration config = new ShipConfiguration();
                config.SetShip(testShipPrefab.GetComponent<Ship>());
                config.SetShipComponentSlot(0, testWeaponComponent);
                config.SetShipComponentSlot(1, testMissileComponent);
                CampaignSquadron squadron = new CampaignSquadron();
                squadron.SetData(config);
                squadron.ShipCount = 1;

                ShipConfiguration bomber = new ShipConfiguration();
                bomber.SetShip(testBomberPrefab.GetComponent<Ship>());
                bomber.SetShipComponentSlot(0, testTorpedoComponent);
                CampaignSquadron bomberSquadron = new CampaignSquadron();
                bomberSquadron.SetData(bomber);
                bomberSquadron.ShipCount = 2;

                ShipConfiguration config2 = new ShipConfiguration();
                config2.SetShip(testShipPrefab2.GetComponent<Ship>());
                config2.SetShipComponentSlot(0, turretComponent);
                config2.SetShipComponentSlot(1, turretComponent);
                config2.SetShipComponentSlot(2, turretComponent);
                config2.SetShipComponentSlot(3, turretComponent);
                CampaignSquadron squadron2 = new CampaignSquadron();
                squadron2.SetData(config2);
                squadron2.ShipCount = 1;

                for (int i = 0; i < 1; i++)
                {
                    campaignFleetAttackingFleet.squadrons.Add(squadron);
                }

                for (int i = 0; i < 1; i++)
                {
                    campaignFleetDefendingFleet.squadrons.Add(squadron);
                }
            }

            battlestate = BattleManager.BattleStates.setup;

            GameObject atkFleetObject = (GameObject)Instantiate(fleetObject);
            GameObject dfFleetObject = (GameObject)Instantiate(fleetObject);

            atkFleet = atkFleetObject.GetComponent<Fleet>();
            dfFleet = dfFleetObject.GetComponent<Fleet>();

            atkFleet.CopyCampaignFleet(campaignFleetAttackingFleet, new Vector3(000, 0, 0), new Vector3(1, 0, 0));
            campaignFleetAttackingFleet.gameObject.SetActive(false);

            dfFleet.CopyCampaignFleet(campaignFleetDefendingFleet, new Vector3(2000, 0, 0), new Vector3(-1, 0, 0));
            campaignFleetDefendingFleet.gameObject.SetActive(false);

            //fill list of all ships
            foreach(Squadron squadron in atkFleet.squadrons)
            {
                foreach(Ship ship in squadron.ships)
                {
                    ship.shipDestroyed += OnShipDestroyed;
                    allShips.Add(ship);
                }
            }

            foreach(Squadron squadron in dfFleet.squadrons)
            {
                allSquadrons.Add(squadron);

                foreach(Ship ship in squadron.ships)
                {
                    ship.shipDestroyed += OnShipDestroyed;
                    allShips.Add(ship);
                }
            }

            atkFleet.fleetDestroyed += FleetDestroyed;
            dfFleet.fleetDestroyed += FleetDestroyed;
        }
    }
Beispiel #3
0
 public bool DrawRecruitmentWindow()
 {
     for (int i = 0; i < shipConfigurations.Count; i++)
     {
         if (GUI.Button(new Rect(0, i * 25 + 5, 200, 25), shipConfigurations[i].configurationName))
         {
             ShipConfiguration config = shipConfigurations[i];
             CampaignSquadron squadron = new CampaignSquadron();
             squadron.SetData(config);
             BuySquadron(squadron);
         }
     }
     return false;
 }