void Start() { Player = GameObject.FindGameObjectWithTag("Player"); RM = GameObject.FindGameObjectWithTag("Resource_Manager").GetComponent <Resource_Manager>(); PlayerLevel = GameObject.FindGameObjectWithTag("Experience_Manager").GetComponent <Experience_Manager>().ReturnLevel(); Damage = DamageScale * PlayerLevel; }
} // end UPDATE public void _IronClicker() { Resource_Manager resourceManagerScript = resourceManager.GetComponent <Resource_Manager>(); if (mineIronOffCooldown) { mineIronCooldownTimer = Time.time + mineIronCooldownLength; resourceManagerScript.ironOre += resourceManagerScript.ironOreClickIncrease; } } // end IRONCLICKER
} // end IRONCLICKER public void _CoalClicker() { Resource_Manager resourceManagerScript = resourceManager.GetComponent <Resource_Manager>(); if (mineCoalOffCooldown) { mineCoalCooldownTimer = Time.time + mineCoalCooldownLength; resourceManagerScript.coal += resourceManagerScript.coalClickIncrease; } } // end COALCLIKER
} // end COALCLIKER public void _ExploreRuinsClicker() { Resource_Manager resourceManagerScript = resourceManager.GetComponent <Resource_Manager>(); if (exploreRuinsOffCooldown) { exploreRuinsCooldownTimer = Time.time + exploreRuinsCooldownLength; resourceManagerScript.relic += resourceManagerScript.relicClickIncrease; } } // end EXPLORERUINSCLICKER
} // end PERFORMRITUALCLICKER public void _SmeltIron() { Resource_Manager resourceManagerScript = resourceManager.GetComponent <Resource_Manager>(); if (resourceManagerScript.ironOre > 0) { resourceManagerScript.ironOre--; resourceManagerScript.iron++; } }
} // end UPDATE public void _WoodClicked() { Resource_Manager resourceManagerScript = resourceManager.GetComponent <Resource_Manager>(); if (stoneOffCooldown) { stoneCooldownTimer = Time.time + stoneCooldownLength; resourceManagerScript.stone += resourceManagerScript.woodClickIncrease; } // end WOODOFFCOOLDOWN } // end CLICKED
} // end _WOODCLICKER public void _StoneClicker() { // update the resource manager when the button is clicked Resource_Manager resourceManagerScript = resourceManager.GetComponent<Resource_Manager>(); // if the button is off cooldown add time to cooldown then increase the resource count if (stoneOffCooldown) { stoneCooldownTimer = Time.time + stoneCooldownLength; resourceManagerScript.stone += resourceManagerScript.stoneClickIncrease; } } // end _STONECLICKER
} // end UPDATE public void _WoodClicker() { // update the resource manager when the button is clicked Resource_Manager resourceManagerScript = resourceManager.GetComponent<Resource_Manager>(); // if the button is off cooldown add time to cooldown then increase the resource count if (woodOffCooldown) { woodCooldownTimer = Time.time + woodCooldownLength; resourceManagerScript.wood += resourceManagerScript.woodClickIncrease; } } // end _WOODCLICKER
} // end EXPLORERUINSCLICKER public void _ExpandMineClicker() { Resource_Manager resourceManagerScript = resourceManager.GetComponent <Resource_Manager>(); if (expandMineOffCooldown) { expandMineCooldownTimer = Time.time + expandMineCooldownLength; resourceManagerScript.ironOreClickUpgradeMultiplier += 1; resourceManagerScript.coalClickUpgradeMultiplier += 1; resourceManagerScript.stone += 100; } } // end EXPANDMINECLICKER
public void _MakeSteel() { Resource_Manager resourceManagerScript = resourceManager.GetComponent <Resource_Manager>(); if (resourceManagerScript.iron > 5 && resourceManagerScript.coal > 5) { resourceManagerScript.iron -= 5; resourceManagerScript.coal -= 5; resourceManagerScript.steel++; } }
} // end HERBSCLICKER public void _FishingClicker() { // update the resource manager when the button is clicked Resource_Manager resourceManagerScript = resourceManager.GetComponent<Resource_Manager>(); // if the button is off cooldown add time to the cooldown then increase the resource count if (fishingOffCooldown) { fishingCooldownTimer = Time.time + fishingCooldownLenth; resourceManagerScript.food += resourceManagerScript.fishClickIncrease; } } // end FISHINGCLICKER
private void Awake() { RM = GameObject.FindGameObjectWithTag("Resource_Manager").GetComponent <Resource_Manager>(); PlayerLevel = GameObject.FindGameObjectWithTag("Experience_Manager").GetComponent <Experience_Manager>().ReturnLevel(); Mana = ManaScale * PlayerLevel; if (RM.ReturnMana() < Mana) { Destroy(gameObject); } else { RM.MinusMana(Mana); } }
} // end MHUNTCLICKER public void _HerbsClicker() { // update the resource manager when the button is clicked Resource_Manager resourceManagerScript = resourceManager.GetComponent<Resource_Manager>(); // if the button is off cooldown add time to the cooldown then increase the resource count if (herbsOffCooldown) { herbsCooldownTimer = Time.time + herbsCooldownLength; resourceManagerScript.herb += resourceManagerScript.herbClickIncrease; } } // end HERBSCLICKER
} // end _STONECLICKER public void _RHuntClicker() { // update the resource manager when the button is clicked Resource_Manager resourceManagerScript = resourceManager.GetComponent<Resource_Manager>(); // if the button is off cooldown add time to cooldown then increase the resource count if (rHuntOffCooldown) { rHuntCooldownTimer = Time.time + rHuntCooldownLength; resourceManagerScript.food += resourceManagerScript.meatClickIncrease; resourceManagerScript.bone += resourceManagerScript.boneClickIncrease; resourceManagerScript.teeth += resourceManagerScript.teethClickIncrease; resourceManagerScript.fur += resourceManagerScript.furClickIncrease; } } // end _RHUNTCLICKER(
public void _SkinningKnife() { Resource_Manager resourceManagerScript = resourceManager.GetComponent <Resource_Manager>(); if (resourceManagerScript.wood >= skinningCostWood && resourceManagerScript.stone >= skinningCostStone) { ++skinningLevel; resourceManagerScript.wood -= skinningCostWood; resourceManagerScript.stone -= skinningCostStone; float newSkinningCostWood = (float)skinningCostWood * upgradeCostMultiplier; skinningCostWood = (int)newSkinningCostWood; float newSkinningCostStone = (float)skinningCostStone * upgradeCostMultiplier; skinningCostStone = (int)newSkinningCostStone; } }
public void _Axes() { Resource_Manager resourceManagerScript = resourceManager.GetComponent <Resource_Manager>(); if (resourceManagerScript.wood >= axeCostWood && resourceManagerScript.stone >= axeCostStone) { ++axeLevel; resourceManagerScript.wood -= axeCostWood; resourceManagerScript.stone -= axeCostStone; float newAxesCostWood = (float)axeCostWood * upgradeCostMultiplier; axeCostWood = (int)newAxesCostWood; float newAxesCostStone = (float)axeCostStone * upgradeCostMultiplier; axeCostStone = (int)newAxesCostStone; resourceManagerScript.woodClickUpgradeMultiplier += 1; } }
public void _Pickaxe() { Resource_Manager resourceManagerScript = resourceManager.GetComponent <Resource_Manager>(); if (resourceManagerScript.wood >= pickaxeCostWood && resourceManagerScript.stone >= pickaxeCostStone) { ++pickaxeLevel; resourceManagerScript.wood -= pickaxeCostWood; resourceManagerScript.stone -= pickaxeCostStone; float newPickCostWood = (float)pickaxeCostWood * upgradeCostMultiplier; pickaxeCostWood = (int)newPickCostWood; float newPickCostStone = (float)pickaxeCostStone * upgradeCostMultiplier; pickaxeCostStone = (int)newPickCostStone; resourceManagerScript.stoneClickUpgradeMultiplier += 1; } }
public void _fishingPole() { Resource_Manager resourceManagerScript = resourceManager.GetComponent <Resource_Manager>(); if (resourceManagerScript.wood >= fishingCostWood && resourceManagerScript.stone >= fishingCostStone) { ++fishingLevel; resourceManagerScript.wood -= fishingCostWood; resourceManagerScript.stone -= fishingCostStone; float newFishCostWood = (float)fishingCostWood * upgradeCostMultiplier; fishingCostWood = (int)newFishCostWood; float newFishCostStone = (float)fishingCostStone * upgradeCostMultiplier; fishingCostStone = (int)newFishCostStone; resourceManagerScript.fishClickUpgradeMultiplier += 1; } }
public void _ButcherKnife() { Resource_Manager resourceManagerScript = resourceManager.GetComponent <Resource_Manager>(); if (resourceManagerScript.wood >= butcherCostWood && resourceManagerScript.stone >= butcherCostStone) { ++butcherLevel; resourceManagerScript.wood -= butcherCostWood; resourceManagerScript.stone -= butcherCostStone; float newButcherCostWood = (float)butcherCostWood * upgradeCostMultiplier; butcherCostWood = (int)newButcherCostWood; float newButcherCostStone = (float)butcherCostStone * upgradeCostMultiplier; newButcherCostStone = (int)newButcherCostStone; resourceManagerScript.meatClickUpgradeMultiplier += 1; resourceManagerScript.mMeatClickUpgradeMultiplier += 1; } }
} // end update public void _HousingUpgrade() { Resource_Manager resourceManagerScript = resourceManager.GetComponent <Resource_Manager>(); Worker_Manager workerManagerScript = workerManager.GetComponent <Worker_Manager>(); if (resourceManagerScript.wood >= housingCostWood && resourceManagerScript.stone >= housingCostStone) { ++housingLevel; resourceManagerScript.wood -= housingCostWood; resourceManagerScript.stone -= housingCostWood; float newHousingCostWood = (float)housingCostWood * upgradeCostMultiplier; housingCostWood = (int)newHousingCostWood; float newHousingCostStone = (float)housingCostStone * upgradeCostMultiplier; housingCostStone = (int)newHousingCostStone; workerManagerScript.workersIdle += 5; } }
} // end _RHUNTCLICKER( public void _MHuntClicker() { // update the resource manager when the button is clicked Resource_Manager resourceManagerScript = resourceManager.GetComponent<Resource_Manager>(); Worker_Manager workerManagerScript = workerManager.GetComponent<Worker_Manager>(); Event_Manager_System eventManagerScript = eventManager.GetComponent<Event_Manager_System>(); // if the button is off cooldown add time to cooldown then increase the resource count if (mHuntOffCooldown) { if (Random.Range(1, 10) + mHuntDeathMod + ((float)workerManagerScript.workersMonsterHunt / 2) <= 7) { if (workerManagerScript.workersMonsterHunt > 0) { workerManagerScript.workersMonsterHunt -= Random.Range(1, 3); if (workerManagerScript.workersMonsterHunt < 0) { workerManagerScript.workersMonsterHunt = 0; } // end setting the workers to 0 is they are lower } // end REMOVE WORKER eventManagerScript.mHuntCount += 1; } // end CHECK IF HUNT SUCCESSFUL else { mHuntCooldownTimer = Time.time + mHuntCooldownLength; resourceManagerScript.mBone += resourceManagerScript.mBoneClickIncrease; resourceManagerScript.mTeeth += resourceManagerScript.mTeethClickIncrease; resourceManagerScript.mPelt += resourceManagerScript.mPeltClickIncrease; resourceManagerScript.food += resourceManagerScript.mMeatClickIncrease; resourceManagerScript.mScale += resourceManagerScript.mScaleClickIncrease; } // end ELSE } } // end MHUNTCLICKER
public void _mineStabilityUpgrade() { Resource_Manager resourceManagerScript = resourceManager.GetComponent <Resource_Manager>(); Build_Manager buildManagerScript = buildManager.GetComponent <Build_Manager>(); if (resourceManagerScript.wood >= mineStabilityCostWood && resourceManagerScript.stone >= mineStabilityCostStone && buildManagerScript.mineBuilt == false) { ++mineStablityLevel; resourceManagerScript.wood -= mineStabilityCostWood; resourceManagerScript.stone -= mineStabilityCostStone; float newStabilityCostWood = (float)mineStabilityCostWood * upgradeCostMultiplier; mineStabilityCostWood = (int)newStabilityCostWood; float newStabilityCostStone = (float)mineStabilityCostStone * upgradeCostMultiplier; mineStabilityCostStone = (int)newStabilityCostStone; if (buildManagerScript.mineBuilt == false) { buildManagerScript.mineBuilt = true; } } }
// Update is called once per frame void Update() { Resource_Manager resourceManagerScript = resourceManager.GetComponent <Resource_Manager>(); Event_Manager_System eventManagerScript = eventManager.GetComponent <Event_Manager_System>(); if (Input.GetKey(KeyCode.P)) { resourceManagerScript.wood += 1000; } if (Input.GetKey(KeyCode.O)) { resourceManagerScript.stone += 1000; } if (Input.GetKey(KeyCode.I)) { resourceManagerScript.bone += 1000; } if (Input.GetKey(KeyCode.U)) { resourceManagerScript.teeth += 1000; } if (Input.GetKey(KeyCode.Y)) { resourceManagerScript.fur += 1000; } if (Input.GetKey(KeyCode.L)) { resourceManagerScript.mBone += 1000; } if (Input.GetKey(KeyCode.K)) { resourceManagerScript.mTeeth += 1000; } if (Input.GetKey(KeyCode.J)) { resourceManagerScript.mPelt += 1000; } if (Input.GetKey(KeyCode.H)) { resourceManagerScript.iron += 1000; } if (Input.GetKey(KeyCode.M)) { resourceManagerScript.steel += 1000; } if (Input.GetKey(KeyCode.N)) { resourceManagerScript.coal += 1000; } if (Input.GetKey(KeyCode.B)) { resourceManagerScript.leather += 1000; } if (Input.GetKey(KeyCode.I)) { resourceManagerScript.mScale += 1000; } if (Input.GetKey(KeyCode.G)) { resourceManagerScript.food += 1000; } if (Input.GetKey(KeyCode.V)) { resourceManagerScript.herb += 1000; } if (Input.GetKey(KeyCode.R)) { resourceManagerScript.ironOre += 1000; } if (Input.GetKey(KeyCode.F)) { resourceManagerScript.relic += 1000; } if (Input.GetKey(KeyCode.C)) { eventManagerScript.mHuntCount += 10; } }
// Update is called once per frame void Update() { Resource_Manager resourceManagerScript = resourceManager.GetComponent <Resource_Manager>(); Upgrade_Manager upgradeManagerScript = upgradeManager.GetComponent <Upgrade_Manager>(); Worker_Manager workerManagerScript = workerManager.GetComponent <Worker_Manager>(); Build_Manager buildManagerScript = buildManager.GetComponent <Build_Manager>(); // start game if (eventOne) { eventPanel.gameObject.SetActive(true); eventText.text = "You wake up on the bank of a river with no knowledge of where or who you are."; eventOne = false; eventTwo = true; woodResource.gameObject.SetActive(true); woodButton.gameObject.SetActive(true); } // end event One // over 100 wood if (resourceManagerScript.wood >= 50 && eventTwo) { eventPanel.gameObject.SetActive(true); eventText.text = "While the environment isn't foreign you can't remember how to get back where you came from."; eventTwo = false; eventThree = true; buildPanel.gameObject.SetActive(true); houseUpgrade.gameObject.SetActive(true); stoneResource.gameObject.SetActive(true); stoneButton.gameObject.SetActive(true); } // end event two // build house if (upgradeManagerScript.housingLevel >= 1 && eventThree) { eventPanel.gameObject.SetActive(true); eventText.text = "A stranger stumbles out of the woods with wounds all over his body. A giant beast appears behind him and with" + "a struggle you both bring the beast down. He like your house but says when he heals he could do it better"; eventThree = false; eventFour = true; workerPanel.gameObject.SetActive(true); lumberjacksWorker.gameObject.SetActive(true); stoneWorker.gameObject.SetActive(true); hunterWorker.gameObject.SetActive(true); fisherWorker.gameObject.SetActive(true); fishingButton.gameObject.SetActive(true); huntButton.gameObject.SetActive(true); boneResource.gameObject.SetActive(true); teethResource.gameObject.SetActive(true); furResource.gameObject.SetActive(true); meatResource.gameObject.SetActive(true); fishResource.gameObject.SetActive(true); axeUpgrade.gameObject.SetActive(true); carvingUpgrade.gameObject.SetActive(true); bowUpgrade.gameObject.SetActive(true); skinningUpgrade.gameObject.SetActive(true); fishingUpgrade.gameObject.SetActive(true); } // end event three // pop over 40 if (workerManagerScript.totalWorkers >= 40 && eventFour) { eventPanel.gameObject.SetActive(true); eventText.text = "The village has gotten big enough, to start fighting back."; eventFour = false; eventFive = true; huntMonsterButton.gameObject.SetActive(true); monsterBoneResource.gameObject.SetActive(true); monsterTeethResource.gameObject.SetActive(true); monsterPeltResource.gameObject.SetActive(true); monsterMeatResource.gameObject.SetActive(true); monsterScalesResource.gameObject.SetActive(true); } // end event four // gone on 10 monster hunts if (mHuntCount >= 10 && eventFive) { eventPanel.gameObject.SetActive(true); eventText.text = "You find what looks like a cave opening on your latest hunt. It looks full of resources. It may be mineable."; eventFive = false; eventSix = true; mineStabilityUpgrade.gameObject.SetActive(true); } // end event five // built mine if (buildManagerScript.mineBuilt && eventSix) { eventPanel.gameObject.SetActive(true); eventText.text = "This mine will help us advance our town and better defend ourselves from the monsters"; eventSix = false; eventSeven = true; mineWorker.gameObject.SetActive(true); ironResource.gameObject.SetActive(true); ironOreResource.gameObject.SetActive(true); coalResource.gameObject.SetActive(true); steelResource.gameObject.SetActive(true); mineStabilityUpgrade.gameObject.SetActive(true); pickaxeUpgrade.gameObject.SetActive(true); blacksmithBuild.gameObject.SetActive(true); mineSwitch.gameObject.SetActive(true); } // end event six // on blacksmithBuild if (buildManagerScript.blacksmithBuilt && eventSeven) { eventPanel.gameObject.SetActive(true); eventText.text = "You have the tools to build a might city now that will attract people scattered all around the land."; eventSeven = false; buildPanel.gameObject.SetActive(true); herbButton.gameObject.SetActive(true); leatherResource.gameObject.SetActive(true); herbResource.gameObject.SetActive(true); RelicsResource.gameObject.SetActive(true); tradingPostBuild.gameObject.SetActive(true); wallBuild.gameObject.SetActive(true); tanneryBuild.gameObject.SetActive(true); ironForgeBuild.gameObject.SetActive(true); trainingHutBuild.gameObject.SetActive(true); smokeHouseBuild.gameObject.SetActive(true); herbalistBuild.gameObject.SetActive(true); enchanterBuild.gameObject.SetActive(true); ritualTable.gameObject.SetActive(true); chiefsHut.gameObject.SetActive(true); } } // end update