Beispiel #1
0
    public void SetBuildableSquadronsList(ResearchManager researchManager)
    {
        buildableSquadrons.Clear();

        List<CampaignSquadron> squadrons = unitList.GetAllSquadrons();

        foreach (CampaignSquadron squadron in squadrons)
        {
            CampaignSquadron newSquadron = new CampaignSquadron();
            newSquadron.CopyData(squadron);
            newSquadron.canBuild = true;

            buildableSquadrons.Add(newSquadron);
        }

        foreach (CampaignSquadron squadron in buildableSquadrons)
        {
            foreach (Technology tech in researchManager.GetTechnologies())
            {
                if (tech.researched)
                {
                    tech.ModifiySquadron(squadron);
                }
            }
        }
    }
Beispiel #2
0
 public CampaignSquadron GetSquadronComponent()
 {
     //TEMP: AI Build command
     CampaignSquadron squadron = new CampaignSquadron();
     squadron.CopyData(squadrons[0]);
     return squadron;
 }
Beispiel #3
0
    public CampaignSquadron GetSquadron(string squadronName)
    {
        foreach (CampaignSquadron squadron in squadrons)
        {
            if (squadron.Name == squadronName)
            {
                CampaignSquadron newSquadron = new CampaignSquadron();
                newSquadron.CopyData(squadron);
                return newSquadron;
            }
        }
        CampaignSquadron defaultSquadron = new CampaignSquadron();
        defaultSquadron.CopyData(squadrons[0]);

        return defaultSquadron;
    }
Beispiel #4
0
    public CampaignSquadron BuySquadron(CampaignSquadron squadron)
    {
        if (buy(squadron.cost))
        {
            CampaignSquadron newSquadron = new CampaignSquadron();
            newSquadron.CopyData(squadron);
            buildQueue.Add(newSquadron);

            return newSquadron;
        }

        return null;
    }
Beispiel #5
0
    public void StartNewTurn()
    {
        if (buildQueue.Count > 0)
        {
            //ignore workers slider
            buildQueue[0].buildPointCost -= maxWorkers;

            if (buildQueue[0].buildPointCost <= 0)
            {
                CampaignSquadron squadron = null;

                if (buildQueue[0] is CampaignSquadron)
                {
                    squadron = (CampaignSquadron)buildQueue[0];

                    if (planet.fleets.Count > 0)
                    {
                        planet.fleets[0].AddSquadron((CampaignSquadron)buildQueue[0]);
                    }
                    else
                    {
                        GameObject fleetObject = (GameObject)Instantiate(campaignFleetPrefab);
                        CampaignFleet fleet = fleetObject.GetComponent<CampaignFleet>();
                        CampaignSquadron newSquadron = new CampaignSquadron();
                        newSquadron.CopyData(squadron);
                        fleet.AddSquadron(newSquadron);
                        fleet.ArriveAtPlanet(planet);
                        addFleet(fleet);
                    }

                }
                else if (buildQueue[0] is StationStructure)
                {
                    ApplyUpgrade((StationStructure)buildQueue[0]);
                }

                buildQueue.RemoveAt(0);
            }
        }

        population += populationGrowth;
        IncomeRate = (harvesterCount * harvesterHarvestRate);
        researchRate = (researcherCount * researcherResearchRate);
    }