Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public List Required;
- private bool HasRequired = false;
- public Action[] SuccessActions;
- public Action[] FailActions;
- public void OnPointerClick(PointerEventData eventData)
- {
- if (eventData.button == PointerEventData.InputButton.Left)
- {
- HasRequired = true;
- foreach(Requirements r in Required)
- {
- switch (r.Type)//check to see if the player is doing it wrong
- {
- case Requirements.RequirementType.PickedUpItem:
- if (!GlobalGameVars.PickedUpItems[r.id].Active) HasRequired = false;
- break;
- case Requirements.RequirementType.ItemInHand:
- if (Inventory.IteminHand != r.id) HasRequired = false;
- break;
- case Requirements.RequirementType.GlobalVariableIsTrue:
- if (!GlobalGameVars.OtherVars[r.id].Active) HasRequired = false;
- break;
- case Requirements.RequirementType.HoldingJournalPages:
- if (GlobalGameVars.HeldPages < r.id) HasRequired = false;
- break;
- }
- }
- if (HasRequired) {
- for (int i = 0; i < SuccessActions.Length; i++)
- {
- SuccessActions[i].ClickedObject();
- }
- } else if (FailActions.Length!=0) {
- for (int i = 0; i < FailActions.Length; i++)
- {
- FailActions[i].ClickedObject();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment