void OnTriggerStay(Collider other) { if(other.tag.Equals("DroppedResource")) { } else if(other.tag.Equals("PlayerSpawn")) { } else { node = (ResourceNodeScript) other.collider.gameObject.GetComponent(typeof(ResourceNodeScript)); if( node.nodeMode == 0 && node.isBusy == false) { isNodeBusy = false; } else { isNodeBusy = true; } if(node.isBusy == false) { resourceCommandsText.text = "Hit C to add a drone \n"+ "Hit Z to remove a drone \n"+ "Hit X to collect mined resources"; } } }
private void nodeCommandResponse(ResourceNodeScript nodeScript) { //blocks commands if chosen node is busy. if (nodeMode == 0) { nodeScript.setMode (nodeMode); commandTimer = 0f; fButtonPressed = false; nodeSelected = false; commandText.text = "Test"; } if (nodeScript.isBusy == false) { if (nodeMode == 1) { if (nodeScript.minedAmount >= nodeScript.calculatedCapacityUpgradeCost ()) { commandTimer = 0f; commandText.text = "Cost: " + (nodeScript.calculatedCapacityUpgradeCost ()) + "\n" + "Hit ` Key again To Commit Command\n" + "Benefit: 25 capacity"; nodeSelected = true; } else { commandText.text = "Insuffient Materials"; commandTimer = 3f; } //confirmCommand(nodeScript); } if (nodeMode == 2) { if (nodeScript.minedAmount >= nodeScript.calculatedDurabilityUpgradeCost ()) { commandTimer = 0f; commandText.text = "Cost: " + (nodeScript.calculatedDurabilityUpgradeCost ()) + "\n" + "Hit ` Key again To Commit Command\n" + "Benefit: 50 Durability"; nodeSelected = true; } else { commandText.text = "Insuffient Materials"; commandTimer = 3f; } //confirmCommand(nodeScript); } if (nodeMode == 3) { if (nodeScript.minedAmount >= nodeScript.calculatedDefenseUpgradeCost () && nodeScript.droneCount > 1) { commandTimer = 0f; commandText.text = "Cost: 1 drone and" + (nodeScript.calculatedDefenseUpgradeCost ()) + "\n" + "Hit ` Key again To Commit Command\n" + "Benefit: 1 Turret Level"; nodeSelected = true; //confirmCommand(nodeScript); } else { commandText.text = "Insuffient Materials"; commandTimer = 3f; } } if (nodeMode == 4) { if (nodeScript.minedAmount >= nodeScript.calculatedReproductionUpgradeCost (getTotalDrones())) { commandTimer = 0f; commandText.text = "Cost: " + (nodeScript.calculatedReproductionUpgradeCost (getTotalDrones())) + "\n" + "Hit ` Key again To Commit Command\n" + "Benefit: 1 Drone"; nodeSelected = true; //confirmCommand(nodeScript); } else { commandText.text = "Insuffient Materials"; commandTimer = 3f; } } } else { commandText.text = "Node Busy"; commandTimer = 3f; } }
void OnTriggerEnter(Collider other) { if(other.tag.Equals("DroppedResource")) { collect = true; CollectDroppedResource collector = (CollectDroppedResource)other.GetComponent(typeof(CollectDroppedResource)); amount = collector.getResourceAmount(); cdr = (CollectDroppedResource) other.GetComponent(typeof(CollectDroppedResource)); dR = other.gameObject; } else if(other.tag.Equals("PlayerSpawn")) { } else { colliding = true; node = (ResourceNodeScript) other.collider.gameObject.GetComponent(typeof(ResourceNodeScript)); if(node.nodeMode == 0 && node.isBusy == false) { isNodeBusy = false; } else { isNodeBusy = true; } } }
void OnTriggerEnter(Collider other) { colliding = true; node = (ResourceNodeScript) other.collider.gameObject.GetComponent(typeof(ResourceNodeScript)); }