Click to use Ability

How do I enable “click to use ability”? Say I click/touch ability icon in slot 0 ( key 1), the circle effect appears, I click again to release the aoe. If I click the ability in slot 1, another ability will get triggered.

//in playerController
private void UseAbilities()
        {
            for (int i = 0; i < numberOfAbilities; i++)
            {
                if (Input.GetKeyDown(KeyCode.Alpha1 + i))
                {
                    actionStore.Use(i, gameObject);
                } 

                // should I modify here?
            }
        }

The place for this modification will be in ActionSlotUI.cs. You’ll need to add a button script to the ActionSlot.

Then add this script to ActionSlotUI.cs

        public void UseAbility()
        {
            store.Use(index, store.gameObject);
        }

Link the button to the ActionSlotUI.UseAbility() method.

1 Like

Thanks Brian!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms