Tuesday, 19 April 2016

Player UI and Enemy UI


We wanted the UI for the player to be represented both by text and a bar that would decrease and increase.

In the code, in Prem's Health Manager script, I added a field to place the health bar and stamina bar. Using a float and calling the local scale of the GUI image game object I was able to reduce the width of the game object on the local scale proportionate to the amount of health and stamina the player currently has. This will also increase should the player recover HP and/or stamina.


(Figure 1.)
The buttons on the main menu all act as on and off switches. To create the main menu system I created all the GUI buttons and input fields we would need to progress the main menu. On Click() the button pressed would set active (true or false) the boolean value of the game object attached depending on the context of the button. For example with the New Game button it switches on the text fields and input fields for the character creation work, the Back and Start Game buttons and switches off the exit game button; clicking on the Start Game button activates a script which loads the game level using the name space using UnityEngine.SceneManager; and then typing into the appropriate function Application.LoadLevel and then the appropriate level within () brackets.

Prem added to the character creation system the ability to store and save the text inputed into the character name and bio text fields which could be stored and accessed later onion the game proper and be displayed on the character sheet option, seen in Figure 1.

No comments:

Post a Comment