Example #1
0
    // Start is called before the first frame update
    private void Start()
    {
        // Make the menu capable of invoking the end of a turn
        turnInvoker = gameObject.AddComponent <TurnInvoker>();

        EventManager.AddListener_Battle_InvSelect(MakeSelection);

        // for displaying "You are at full."
        messageTimer          = gameObject.AddComponent <EventTimer>();
        messageTimer.Duration = messageTimerDuration;
        messageTimer.AddListener_Finished(ResetMessage);

        // show gold
        goldText.text = BattleLoader.Party.Gold.ToString();
        // cannot use until a selection is made
        useButton.GetComponent <Button>().interactable = false;

        // retrieve inventory from HeroParty
        partyStash = BattleLoader.Party.Inventory;

        messageText.text = "";

        // Only used for invoking disable. No button.
        uiEnabler = gameObject.AddComponent <UIEnabler>();

        PopulateGrid();
    }
Example #2
0
 public static void AddInvoker_Battle_UIEnabler(UIEnabler uiEnabler)
 {
     invokers_Battle_UIEnabler.Add(uiEnabler);
     //if (listener_Battle_InvSelect != null)
     foreach (UnityAction <bool, HeroType> listener in listeners_Battle_UIEnabler)
     {
         uiEnabler.AddListener_Battle_UIEnabler(listener);
     }
 }
    // Start is called before the first frame update
    protected override void Start()
    {
        base.Start();
        // Both a listener and an invoker of ChoiceSelection
        EventManager.AddInvoker_Battle_ChoiceSelection(this);
        EventManager.AddListener_Battle_ChoiceSelection(MakeSelection);
        selected = false;

        // adds a UIEnabler. This is for enemy sprites and menu items alike.
        // Menu items will self-register when created.
        uiEnabler = gameObject.AddComponent <UIEnabler>();
    }