Integrating the code

Now that we have our HUD design up and running, we will need to integrate the UI elements with the actual code that will be deriving them. There are a few scripts that will be created to support the new UI features and a few that will be updated to glue everything together.

The following scripts have been created: ActiveInventoryItemUi.cs, ActiveSpecialItemUi.cs, and HudElementUi.cs.

The listing of these scripts is as follows:

using UnityEngine.EventSystems;namespace com.noorcon.rpg2e{public class ActiveSpecialItemUi : EventTrigger{public override void OnPointerClick(PointerEventData data){InventoryItem iia =gameObject.GetComponent<ActiveInventoryItemUi>().item;switch (iia.Category){case BaseItem.ItemCatrgory.Health: ...

Get Building an RPG with Unity 2018 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.