Expanding Action Bar Functionality

Following up with this healingAction. I was planning on adding the sound and animation that goes with triggering a heal.
what is the best practice for doing that? should i spawn the effects from The action(or its child) script or should the spawning be dealt by the health class and get called by the action script?

You can do it either way, though bear in mind that the SO can’t have an Animator or an AudioSource attached, so it’s going to need to grab those references from the player… It might be better to have the sound attached to a GameObject under the player and let Health get a reference to it. As to the Animation, it needs to be in the Animator’s state tree, so again, I’d probably reference that through Health.

Thanks for the respond!
so after reading your response what i think ill do is, let the health component handle spawning the effect & sound, But let the SO have reference to which animation and sound to be used(to allow different potions to feel different

1 Like

I would probably create similar (but noticably different) particle systems to spawn as well, prefabs of which would of course be stored in the SO

1 Like

public void OnPointerClick(PointerEventData eventData)
{
store.Use(index, player);
}

Hi Brian, again… sorry hah:)
tried implementing this though it doesn’t get the index, what am I missing?
tried:

GetComponent<ActionSlotUI|>().index

Have you implemented this in the ActionSlotUI script? index should be one of the variables. It doesn’t make much sense to put the IOnPointerClickHandler anywhere else.

I did the same But i still can’t use Mana Potion after its on action Bar , pressing 0, 1 should increase my health but doesnt not do,

Privacy & Terms