fixed up the gui stoof
This commit is contained in:
parent
a9184abb34
commit
caa23f9f87
Binary file not shown.
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 2.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 5.8 KiB |
@ -11,7 +11,6 @@ public class mGUI : MonoBehaviour
|
|||||||
float nativeWidth = 640;
|
float nativeWidth = 640;
|
||||||
float nativeHeight = 400;
|
float nativeHeight = 400;
|
||||||
float percentHealth;
|
float percentHealth;
|
||||||
int healthBarLength = 400;
|
|
||||||
Matrix4x4 guiMatrix;
|
Matrix4x4 guiMatrix;
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
@ -34,20 +33,20 @@ public class mGUI : MonoBehaviour
|
|||||||
GUI.matrix = GetGUIMatrix();
|
GUI.matrix = GetGUIMatrix();
|
||||||
// Create one Group to contain both images
|
// Create one Group to contain both images
|
||||||
// Adjust the first 2 coordinates to place it somewhere else on-screen
|
// Adjust the first 2 coordinates to place it somewhere else on-screen
|
||||||
GUI.BeginGroup(new Rect(0, 0, 640, 400));
|
GUI.BeginGroup(new Rect(0, 0, 207, 82));
|
||||||
|
|
||||||
// Draw the background image
|
// Draw the background image
|
||||||
GUI.backgroundColor = new Color(0, 0, 0, 0.0f);
|
GUI.backgroundColor = new Color(0, 0, 0, 0.0f);
|
||||||
GUI.Box(new Rect(0, 0, 620, 400), bgImage);
|
GUI.Box(new Rect(0, 0, 207, 82), bgImage);
|
||||||
|
|
||||||
percentHealth = curHealth / maxHealth;
|
percentHealth = curHealth / maxHealth;
|
||||||
// Create a second Group which will be clipped
|
// Create a second Group which will be clipped
|
||||||
// We want to clip the image and not scale it, which is why we need the second Group
|
// We want to clip the image and not scale it, which is why we need the second Group
|
||||||
GUI.BeginGroup(new Rect(0, 0, percentHealth * 640, 400));
|
GUI.BeginGroup(new Rect(0, 0, percentHealth * 207, 82));
|
||||||
|
|
||||||
// Draw the foreground image
|
// Draw the foreground image
|
||||||
GUI.backgroundColor = new Color(0, 0, 0, 0.0f);
|
GUI.backgroundColor = new Color(0, 0, 0, 0.0f);
|
||||||
GUI.Box(new Rect(0, 0, 620, 400), fgImage);
|
GUI.Box(new Rect(0, 0, 207, 82), fgImage);
|
||||||
|
|
||||||
|
|
||||||
// End both Groups
|
// End both Groups
|
||||||
|
Reference in New Issue
Block a user