예제 #1
0
    public void Upgrade()
    {
        if (!IsUpgradable())
        {
            throw new InvalidOperationException("The upgrade condition is not met!");
        }

        POPWorkingSlot[] newArray = new POPWorkingSlot[2];
        for (int i = 0; i < newArray.Length; i++)
        {
            newArray[i] = new POPWorkingSlot();
        }

        for (int i = 0; i < workingPOPSlotList.Length; i++)
        {
            newArray[i] = workingPOPSlotList[i];
        }

        workingPOPSlotList = newArray;

        workingPOPSlotList[1].upkeeps.Add(new JobUpkeep((GlobalResourceType.Money, 2), null));
        workingPOPSlotList[1].job = Job.Admiral;

        name              = "Planetary Comm Hub";
        buildingType      = BuildingType.PlanetaryCommHub;
        baseUpkeep.amount = 1;
    }
예제 #2
0
    public void Upgrade()
    {
        if (!IsUpgradable())
        {
            throw new InvalidOperationException("The upgrade condition is not met!");
        }

        POPWorkingSlot[] newArray = new POPWorkingSlot[5];
        for (int i = 0; i < newArray.Length; i++)
        {
            newArray[i] = new POPWorkingSlot();
        }

        for (int i = 0; i < workingPOPSlotList.Length; i++)
        {
            newArray[i] = workingPOPSlotList[i];
        }

        workingPOPSlotList = newArray; // Resizes workingPOPSlotList.

        workingPOPSlotList[3].upkeeps.Add(new JobUpkeep((GlobalResourceType.Money, 1f), null));
        workingPOPSlotList[3].upkeeps.Add(new JobUpkeep((GlobalResourceType.Mineral, 4f), null));
        workingPOPSlotList[3].yields.Add(new JobYield((GlobalResourceType.Alloy, 2f), null));
        workingPOPSlotList[3].job = Job.Technician;

        workingPOPSlotList[4].upkeeps.Add(new JobUpkeep((GlobalResourceType.Money, 1f), null));
        workingPOPSlotList[4].upkeeps.Add(new JobUpkeep((GlobalResourceType.Mineral, 4f), null));
        workingPOPSlotList[4].yields.Add(new JobYield((GlobalResourceType.Alloy, 2f), null));
        workingPOPSlotList[4].job = Job.Technician;

        name              = "Alloy Foundry";
        buildingType      = BuildingType.AlloyFoundry;
        baseUpkeep.amount = 2;
    }
 protected void InitiallizePOPWorkingList(int n)
 {
     workingPOPSlotNumber = n;
     workingPOPSlotList   = new POPWorkingSlot[workingPOPSlotNumber];
     for (int i = 0; i < workingPOPSlotNumber; i++)
     {
         workingPOPSlotList[i] = new POPWorkingSlot();
     }
 }
예제 #4
0
    public void Upgrade()
    {
        if (!IsUpgradable())
        {
            throw new InvalidOperationException("The upgrade condition is not met!");
        }

        POPWorkingSlot[] newArray = new POPWorkingSlot[12];
        for (int i = 0; i < newArray.Length; i++)
        {
            newArray[i] = new POPWorkingSlot();
        }

        for (int i = 0; i < workingPOPSlotList.Length; i++)
        {
            newArray[i] = workingPOPSlotList[i];
        }

        workingPOPSlotList = newArray;                                                            // Resizes workingPOPSlotList.

        workingPOPSlotList[6].upkeeps.Add(new JobUpkeep((GlobalResourceType.Money, 0.5f), null)); // Initiallize Technician job slot.
        workingPOPSlotList[6].yields.Add(new JobYield((GlobalResourceType.Electricity, 1.5f), null));
        workingPOPSlotList[6].job = Job.Technician;

        workingPOPSlotList[7].upkeeps.Add(new JobUpkeep((GlobalResourceType.Money, 0.5f), null));
        workingPOPSlotList[7].yields.Add(new JobYield((GlobalResourceType.Mineral, 6f), null));
        workingPOPSlotList[7].job = Job.Miner;

        workingPOPSlotList[8].upkeeps.Add(new JobUpkeep((GlobalResourceType.Money, 0.5f), null));
        workingPOPSlotList[8].yields.Add(new JobYield((GlobalResourceType.Food, 6f), null));
        workingPOPSlotList[8].job = Job.Farmer;

        workingPOPSlotList[9].upkeeps.Add(new JobUpkeep((GlobalResourceType.Money, 1f), null));
        workingPOPSlotList[9].yields.Add(new JobYield((GlobalResourceType.Money, 3f), null));
        workingPOPSlotList[9].job = Job.Clerk;

        workingPOPSlotList[10].upkeeps.Add(new JobUpkeep((GlobalResourceType.Money, 1f), null));
        workingPOPSlotList[10].job = Job.Enforcer;

        workingPOPSlotList[11].upkeeps.Add(new JobUpkeep((GlobalResourceType.Money, 1.5f), null));
        workingPOPSlotList[11].job = Job.Administrator;

        Array.Sort(workingPOPSlotList, (POPWorkingSlot a, POPWorkingSlot b) => a.job.CompareTo(b.job));

        name                    = "Planetary Capital";
        buildingType            = BuildingType.PlanetaryCapital;
        baseUpkeep.amount       = 3;
        planet.providedHousing += 10;
        planet.providedAmenity += 5;
    }
예제 #5
0
    private void _StartTraining(POPWorkingSlot futureSlot) // Removes current job, sets future job, and start training.
    {
        if (isTraining)
        {
            throw new InvalidOperationException("Trying to train POP already training!");
        }

        futureSlot.isPOPTrainingForHere = true;

        futureWorkingSlot = futureSlot;

        isTraining = true;

        remainTrainingDay = _GetTrainingDay();

        currentWorkingSlot = null;

        planet.trainingPOPs.Add(this); // Add POP to the training queue.
    }
예제 #6
0
    public void ActivatePOP(POPWorkingSlot futureSlot) // Activate just created POP, which must be unemployed
    {
        if (futureSlot.pop != null)
        {
            throw new InvalidOperationException("Trying to move to already occupied slot!");
        }

        if (futureSlot.isPOPTrainingForHere)
        {
            throw new InvalidOperationException("Someone is already training for there!");
        }

        if (!isUnemployed)
        {
            throw new InvalidOperationException("Trying to activate employed POP!");
        }
        else
        {
            _StartTraining(futureSlot);
            planet.unemployedPOPs.Remove(this);
            UnityEngine.Debug.Log("Start Training.");
        }
    }
예제 #7
0
    public void Upgrade()
    {
        if (!IsUpgradable())
        {
            throw new InvalidOperationException("The upgrade condition is not met!");
        }

        POPWorkingSlot[] newArray = new POPWorkingSlot[6];
        for (int i = 0; i < newArray.Length; i++)
        {
            newArray[i] = new POPWorkingSlot();
        }

        for (int i = 0; i < workingPOPSlotList.Length; i++)
        {
            newArray[i] = workingPOPSlotList[i];
        }

        workingPOPSlotList = newArray; // Resizes workingPOPSlotList.

        workingPOPSlotList[3].upkeeps.Add(new JobUpkeep((GlobalResourceType.Money, 1.5f), null));
        workingPOPSlotList[3].yields.Add(new JobYield((GlobalResourceType.Physics, 4f), null));
        workingPOPSlotList[3].job = Job.Physicist;

        workingPOPSlotList[4].upkeeps.Add(new JobUpkeep((GlobalResourceType.Money, 1.5f), null));
        workingPOPSlotList[4].yields.Add(new JobYield((GlobalResourceType.Sociology, 4f), null));
        workingPOPSlotList[4].job = Job.Sociologist;

        workingPOPSlotList[5].upkeeps.Add(new JobUpkeep((GlobalResourceType.Money, 1.5f), null));
        workingPOPSlotList[5].yields.Add(new JobYield((GlobalResourceType.Engineering, 4f), null));
        workingPOPSlotList[5].job = Job.Engineer;

        name              = "Research Lab";
        buildingType      = BuildingType.ResearchLab;
        baseUpkeep.amount = 2;
    }
예제 #8
0
    public void MovePOPJob(POPWorkingSlot futureSlot)
    {
        futureWorkingSlot = futureSlot;

        if (futureWorkingSlot.pop != null)
        {
            throw new InvalidOperationException("Trying to move to already occupied slot!");
        }

        if (futureWorkingSlot.isPOPTrainingForHere)
        {
            throw new InvalidOperationException("Someone is already training for there!");
        }

        if (currentWorkingSlot.pop == null)
        {
            throw new InvalidOperationException("Trying to move pop which doesn't exist!");
        }

        foreach (var upkeep in currentWorkingSlot.upkeeps)
        {
            upkeep.pop = null;
            planet.planetJobUpkeeps.Remove(upkeep);
        }

        foreach (var yield in currentWorkingSlot.yields)
        {
            yield.pop = null;
            planet.planetJobYields.Remove(yield);
        }

        currentWorkingSlot.pop = null;

        switch (currentWorkingSlot.job)
        {
        case Job.Administrator:
            planet.stabilityModifier -= 5;
            planet.providedAmenity   -= 5;
            break;

        case Job.Admiral:
            planet.game.fleetNum--;
            break;

        case Job.Enforcer:
            planet.crimeReducedByEnforcer -= 30;
            planet.stabilityModifier      -= 2;
            break;

        case Job.Clerk:
            planet.providedAmenity -= 3;
            break;

        case Job.Staff:
            planet.game.fleetAttackModifier -= 0.05f;
            break;

        case Job.Soldier:
            planet.game.defencePlatformAttackModifier -= 0.05f;
            break;
        }

        _StartTraining(futureSlot);
    }