|
I have this idea where depending upon whether Lerpz triggers the enemy or not, the timer decreases in value (along with continuously decreasing by seconds). The function of the timer is to allow game time (and can in essence decrease regularly and by a trigger point). I would want this timer to show up as a, "GUI" object like the fuel cells and life icons at the bottom of the screen. The timer can be in the upper top right or left corner of the screen, and I thought of writing it in the GameHUD script of the Lerpz game. Please take a look and let me know if it makes sense to add the timer script here. The GUISkin is basically what I need. So, I need it to be in the same format as the others. Thanks for the help in advance. // GameHUD: Platformer Tutorial Master GUI script. // This script handles the in-game HUD, showing the lives, number of fuel cells remaining, etc. var guiSkin: GUISkin; var nativeVerticalResolution = 1200.0; // main decoration textures: var healthImage: Texture2D; var healthImageOffset = Vector2(0, 0); // the health 'pie chart' assets consist of six textures with alpha channels. Only one is ever shown: var healthPieImages : Texture2D[]; var healthPieImageOffset = Vector2(10, 147); // the lives count is displayed in the health image as a text counter var livesCountOffset = Vector2(425, 160); // The fuel cell decoration image on the right side var fuelCellsImage: Texture2D; var fuelCellOffset = Vector2(0, 0); // The counter text inside the fuel cell image var fuelCellCountOffset = Vector2(391, 161); private var playerInfo : ThirdPersonStatus; // Cache link to player's state management script for later use. function Awake() { playerInfo = FindObjectOfType(ThirdPersonStatus);
} function OnGUI () {
} function DrawImageBottomAligned (pos : Vector2, image : Texture2D) { GUI.Label(Rect (pos.x, nativeVerticalResolution - image.height - pos.y, image.width, image.height), image); } function DrawLabelBottomAligned (pos : Vector2, text : String) { GUI.Label(Rect (pos.x, nativeVerticalResolution - pos.y, 100, 100), text); } function DrawImageBottomRightAligned (pos : Vector2, image : Texture2D) { var scaledResolutionWidth = nativeVerticalResolution / Screen.height * Screen.width; GUI.Label(Rect (scaledResolutionWidth - pos.x - image.width, nativeVerticalResolution - image.height - pos.y, image.width, image.height), image); } function DrawLabelBottomRightAligned (pos : Vector2, text : String) { var scaledResolutionWidth = nativeVerticalResolution / Screen.height * Screen.width; GUI.Label(Rect (scaledResolutionWidth - pos.x, nativeVerticalResolution - pos.y, 100, 100), text); }
(comments are locked)
|
