public void RemoveContract() { Transform contractObj = EventSystem.current.currentSelectedGameObject.transform.parent.transform.parent; contractObj.GetChild(8).gameObject.SetActive(false); // string contractName = EventSystem.current.currentSelectedGameObject.transform.parent.transform.parent.name; int contractNumber = int.Parse(contractObj.name.Substring(9)); //this might need to be done exactly when contracts expire so difficulty updates doesn't require actual player input AvailableContracts.AdjustContractDifficulty(-PlayerContracts.GetContractAtIndex(contractNumber - 1).GetDifficulty().difficulty); PlayerContracts.RemoveContractAtIndex(contractNumber - 1); UpdateContracts(); }
public void TurnInContract() { string contractName = EventSystem.current.currentSelectedGameObject.transform.parent.name; int contractNumber = int.Parse(contractName.Substring(9)); activeContracts[contractNumber - 1].GetRequiredLumber().SubtractFromStockpile(); activeContracts[contractNumber - 1].GetPayout().AddToInventory(); contractsContent.GetChild(contractNumber - 1).GetChild(6).GetComponent <Button>().interactable = false; contractsContent.GetChild(contractNumber - 1).GetChild(6).GetChild(0).GetComponent <Text>().text = "Completed"; AvailableContracts.AdjustContractDifficulty(activeContracts[contractNumber - 1].GetDifficulty().difficulty); //do more visually to the contract object to show it has been turned in MarkContractForRemoval(contractNumber - 1); UpdateCompletionStatus(); }