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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.