示例#1
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            ResourceManager manager = (ResourceManager)target;

            _amount = EditorGUILayout.IntField("Amount", _amount);
            if (GUILayout.Button("Add Gold"))
            {
                manager.AddGold(_amount);
            }
        }
示例#2
0
 private void DeliveryRequestFulfilled()
 {
     resourceManager.numberOfDiamondsOwned -= goalDiamondQuantity;
     resourceManager.AddGold(goalDiamondQuantity / 2);
     if (currentDeliveryNumber >= TotalNumberOfDeliveries)
     {
         TurnOtherCanvasGroupsOff(winScreenFinal.GetComponent <CanvasGroup>());
         winScreenFinal.SetActive(true);
     }
     else
     {
         TurnOtherCanvasGroupsOff(winScreen.GetComponent <CanvasGroup>());
         winScreen.SetActive(true);
     }
 }
示例#3
0
    private void DigEvent()
    {
        int eventRoll = UnityEngine.Random.Range(1, 100);

        if (eventRoll <= 35 + (rankLevel * 10))
        {
            resourceManager.AddGold(UnityEngine.Random.Range(4, 14));
            iTween.PunchPosition(resourceManager.GoldQuantity.gameObject, UnityEngine.Random.insideUnitSphere * 15, 1f);
            eventBar.AddEvent(EventBar.EventType.FoundGold);
        }
        else if (eventRoll >= 85 + (rankLevel * 10))
        {
            MinerGotHurt(UnityEngine.Random.Range(2, 3));
            eventBar.AddEvent(EventBar.EventType.MinerHurt);
        }
    }
示例#4
0
    public void DestroyBuilding()
    {
        if (buildingSelected == null && mouseOverUI)
        {
            return;
        }

        Debug.Log("Destroy");

        if (buildingSelected.tag == "House")
        {
            resource.AddWood(BuilderScript.houseCostWood / 2);
            resource.AddGold(BuilderScript.houseCostGold / 2);
            resource.RemoveMaxPop(BuilderScript.houseCostPop);
            resource.RemoveCurrentPop(BuilderScript.houseCostPop);
            resource.AddNonIdlePop(-BuilderScript.houseCostPop);
            resource.AddHouse(-1);

            Destroy(buildingSelected.transform.parent.gameObject);
            buildingSelected = null;
        }
        else if (buildingSelected.tag == "Farm")
        {
            Debug.Log("farm");
            resource.AddWood(BuilderScript.farmCostWood / 2);
            resource.AddGold(BuilderScript.farmCostGold / 2);

            /*resource.RemoveCurrentPop(BuilderScript.farmCostPop);
             * resource.AddNonIdlePop(-BuilderScript.farmCostPop);*/
            resource.AddFarm(-1);

            buildingSelected.GetComponent <FarmBehaviour>().DestroyBuilding();

            buildingSelected = null;
            Debug.Log("Destroy farm");
        }
        else if (buildingSelected.tag == "LumberMill")
        {
            resource.AddWood(BuilderScript.lumbMillCostWood / 2);
            resource.AddGold(BuilderScript.lumbMillCostGold / 2);
            buildingSelected.GetComponent <LumberMillBehaviour>().DestroyBuilding();
            buildingSelected = null;
        }
        else if (buildingSelected.tag == "GoldMine")
        {
            resource.AddWood(BuilderScript.mineCostWood / 2);
            resource.AddGold(BuilderScript.mineCostGold / 2);
            buildingSelected.GetComponent <GoldMineBehaviour>().DestroyBuilding();
            buildingSelected = null;
        }
        else if (buildingSelected.tag == "Warehouse")
        {
            resource.AddWood(BuilderScript.warehouseCostWood / 2);
            resource.AddGold(BuilderScript.warehouseCostGold / 2);
            resource.AddWareHouse(-1);
            resource.AddCurrentPop(BuilderScript.warehouseCostPop);
            resource.AddNonIdlePop(-BuilderScript.warehouseCostPop);
            Destroy(buildingSelected.transform.parent.gameObject);
            buildingSelected = null;
        }
        else if (buildingSelected.tag == "Bridge")
        {
            if (resource.wood > 100 * ResourceManager.bridgeCost)
            {
                //resource.wood -= 100 * resource.bridgeCost;
                resource.RemoveWood(100 * ResourceManager.bridgeCost);
                resource.RemoveGold(50 * ResourceManager.bridgeCost);
                ResourceManager.bridgeCost++;
                //buildingSelected.SetActive(false);
                buildingSelected.GetComponent <BridgeBehaviour>().RepareBridge();
            }
        }
        else if (buildingSelected.tag == "Tower")
        {
            resource.AddWood(BuilderScript.towerCostWood / 2);
            resource.AddGold(BuilderScript.towerCostGold / 2);
            resource.AddTower(-1);
            resource.AddCurrentPop(BuilderScript.towerCostPop);
            resource.AddNonIdlePop(-BuilderScript.towerCostPop);

            buildingSelected.GetComponent <TowerBehaviour>().DestroyBuilding();

            buildingSelected = null;
        }
        else if (buildingSelected.tag == "Barracks")
        {
            resource.AddWood(BuilderScript.barracksCostWood / 2);
            resource.AddGold(BuilderScript.barracksCostGold / 2);
            resource.AddBarracks(-1);
            resource.AddCurrentPop(BuilderScript.warehouseCostPop);
            resource.AddNonIdlePop(-BuilderScript.warehouseCostPop);
            Destroy(buildingSelected.transform.parent.gameObject);
            buildingSelected = null;
        }
        else if (buildingSelected.tag == "Church")
        {
            resource.AddWood(BuilderScript.churchCostWood / 2);
            resource.AddGold(BuilderScript.churchCostGold / 2);
            resource.AddChurch(-1);
            resource.AddCurrentPop(BuilderScript.churchCostPop);
            resource.AddNonIdlePop(-BuilderScript.churchCostPop);
            Destroy(buildingSelected.transform.parent.gameObject);
            buildingSelected = null;
        }
        else if (buildingSelected.tag == "FireStation")
        {
            resource.AddWood(BuilderScript.fireStationCostWood / 2);
            resource.AddGold(BuilderScript.fireStationCostGold / 2);
            resource.AddFireStation(-1);
            resource.AddCurrentPop(BuilderScript.fireStationCostPop);
            resource.AddNonIdlePop(-BuilderScript.fireStationCostPop);
            Destroy(buildingSelected.transform.parent.gameObject);
            buildingSelected = null;
        }
        else
        {
            Debug.Log("Edificio" + buildingSelected + "no se puede destruir");
        }
    }
示例#5
0
    void ResolveOutcome()
    {
        switch (currentOutcome.OutcomeType)
        {
        case (OutcomeEnum.AddEquipment):
            resourceManager.AddEquipment(currentOutcome.OutcomeNumber);
            break;

        case (OutcomeEnum.AddFood):
            resourceManager.AddFood(currentOutcome.OutcomeNumber);
            break;

        case (OutcomeEnum.AddGold):
            resourceManager.AddGold(currentOutcome.OutcomeNumber);
            break;

        case (OutcomeEnum.AllStopWorking):
            workerManager.RemoveFarmer(farmers);
            workerManager.RemoveMerchant(merchants);
            workerManager.RemoveBlacksmith(blacksmiths);
            workerManager.RemoveSoldier(soldiers);
            break;

        case (OutcomeEnum.BlacksmithDie):
            workerManager.RemoveBlacksmith(currentOutcome.OutcomeNumber);
            workerManager.DecreasePopulation(currentOutcome.OutcomeNumber);
            break;

        case (OutcomeEnum.DecreasePop):
            workerManager.DecreasePopulation(currentOutcome.OutcomeNumber);
            break;

        case (OutcomeEnum.FarmerDie):
            workerManager.RemoveFarmer(currentOutcome.OutcomeNumber);
            workerManager.DecreasePopulation(currentOutcome.OutcomeNumber);
            break;

        case (OutcomeEnum.IdleDie):
            workerManager.DecreasePopulation(idle);
            break;

        case (OutcomeEnum.IncreasePop):
            workerManager.IncreasePopulation(currentOutcome.OutcomeNumber);
            break;

        case (OutcomeEnum.MerchantDie):
            workerManager.RemoveMerchant(currentOutcome.OutcomeNumber);
            workerManager.DecreasePopulation(currentOutcome.OutcomeNumber);
            break;

        case (OutcomeEnum.RemoveBlacksmith):
            workerManager.RemoveBlacksmith(currentOutcome.OutcomeNumber);
            workerManager.DecreasePopulation(currentOutcome.OutcomeNumber);
            break;

        case (OutcomeEnum.RemoveEquipment):
            resourceManager.RemoveEquipment(currentOutcome.OutcomeNumber);
            break;

        case (OutcomeEnum.RemoveFarmer):
            workerManager.RemoveFarmer(currentOutcome.OutcomeNumber);
            break;

        case (OutcomeEnum.RemoveFood):
            resourceManager.RemoveFood(currentOutcome.OutcomeNumber);
            break;

        case (OutcomeEnum.RemoveGold):
            resourceManager.RemoveGold(currentOutcome.OutcomeNumber);
            break;

        case (OutcomeEnum.RemoveMerchant):
            workerManager.RemoveMerchant(currentOutcome.OutcomeNumber);
            break;

        case (OutcomeEnum.RemoveSoldier):
            workerManager.RemoveSoldier(currentOutcome.OutcomeNumber);
            break;

        case (OutcomeEnum.SoldierDie):
            workerManager.RemoveSoldier(currentOutcome.OutcomeNumber);
            workerManager.DecreasePopulation(currentOutcome.OutcomeNumber);
            break;

        default:
            return;
        }
    }
示例#6
0
 public void GatherResources()
 {
     resource.AddGold(25);
 }