public void close() { GameObject.FindGameObjectWithTag("MainCamera").GetComponent <ManualCamera>().setTarget(null); GameObject.FindGameObjectWithTag("GridController").GetComponent <UIHandler>().manMenuOpen = false; man.setStatMenuOpen(false); if (manRequest) { manRequest.currentMenu = null; manRequest.gameObject.SetActive(false); } ControlFactors.setPlayerCast(true); Destroy(gameObject); }
// Start is called before the first frame update void Start() { closeButton.onClick.AddListener(() => { close(); }); ControlFactors.setPlayerCast(false); if (man != null) { man.setStatMenuOpen(true); if (man.activeRequest) { man.activeRequest.gameObject.SetActive(true); manRequest = man.activeRequest; manRequest.currentMenu = this; } } _Label.SetText(man.title); _Love.SetText("Love: " + ((man.brain.Love / man.brain.maxEmotion) * 100f).ToString("F0") + "%"); _Fear.SetText("Fear: " + ((man.brain.Fear / man.brain.maxEmotion) * 100f).ToString("F0") + "%"); _State.SetText("State: " + man.state); }
// choice: 1 = yes, 2 = no, 3 = ignore public void chooseOption(int choice) { if (choice == 1) { // Applies Yes value if Yes is chosen if (offer.yesVal >= 0) { ControlFactors.LOVE += offer.yesVal; ControlFactors.FEAR -= offer.yesVal; } else { ControlFactors.FEAR += Mathf.Abs(offer.yesVal); ControlFactors.LOVE -= Mathf.Abs(offer.yesVal); } } else if (choice == 2) { // Applies No value if no is chosen if (offer.noVal >= 0) { ControlFactors.LOVE += offer.noVal; ControlFactors.FEAR -= offer.noVal; } else { ControlFactors.FEAR += Mathf.Abs(offer.noVal); ControlFactors.LOVE -= Mathf.Abs(offer.noVal); } } else if (choice == 3) { float remainingLoss = offer.ignoreVal; // Takes what needs to be deducted and finds which factor is larger (Love or Fear), then deducteds the ignore val from the largest. // If there is a remainder, then the remainder is applied to the other value. if (ControlFactors.LOVE >= ControlFactors.FEAR) { if (ControlFactors.LOVE >= remainingLoss) { ControlFactors.LOVE -= remainingLoss; remainingLoss = 0; } else { remainingLoss -= ControlFactors.LOVE; ControlFactors.LOVE = 0; ControlFactors.FEAR -= remainingLoss; } } else { if (ControlFactors.FEAR >= remainingLoss) { ControlFactors.FEAR -= remainingLoss; remainingLoss = 0; } else { remainingLoss -= ControlFactors.FEAR; ControlFactors.FEAR = 0; ControlFactors.LOVE -= remainingLoss; } } } ControlFactors.setPlayerCast(true); SceneLoader.unloadOptionScene(); }
void Start() { offer = Offerings.getRandomOffer(Offerings.offeringList1); prompt.SetText(offer.Offering); ControlFactors.setPlayerCast(false); }