diff --git a/Assets/AITestMap.unity b/Assets/AITestMap.unity index 7c78468..ecf2c18 100644 Binary files a/Assets/AITestMap.unity and b/Assets/AITestMap.unity differ diff --git a/Assets/GUI/Healthbar.png b/Assets/GUI/Healthbar.png new file mode 100644 index 0000000..e0f11be Binary files /dev/null and b/Assets/GUI/Healthbar.png differ diff --git a/Assets/GUI/Healthbar.png.meta b/Assets/GUI/Healthbar.png.meta new file mode 100644 index 0000000..b64db9e --- /dev/null +++ b/Assets/GUI/Healthbar.png.meta @@ -0,0 +1,57 @@ +fileFormatVersion: 2 +guid: 74267eec14d0a3740b66cdaf403f3a88 +timeCreated: 1454189771 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 8 + buildTargetSettings: [] + spriteSheet: + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GUI/HealthbarFilled.png b/Assets/GUI/HealthbarFilled.png new file mode 100644 index 0000000..9dc8246 Binary files /dev/null and b/Assets/GUI/HealthbarFilled.png differ diff --git a/Assets/GUI/HealthbarFilled.png.meta b/Assets/GUI/HealthbarFilled.png.meta new file mode 100644 index 0000000..156d332 --- /dev/null +++ b/Assets/GUI/HealthbarFilled.png.meta @@ -0,0 +1,57 @@ +fileFormatVersion: 2 +guid: 855e9e69ccc2916489351dda7cbbf398 +timeCreated: 1454189771 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 8 + buildTargetSettings: [] + spriteSheet: + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GUI/mGUI.cs b/Assets/GUI/mGUI.cs new file mode 100644 index 0000000..ab298d8 --- /dev/null +++ b/Assets/GUI/mGUI.cs @@ -0,0 +1,58 @@ +using UnityEngine; +using System.Collections; + +public class mGUI : MonoBehaviour +{ + public GUISkin mySkin; + public float curHealth = 100; + public float maxHealth = 100; + public Texture2D bgImage; + public Texture2D fgImage; + float nativeWidth = 640; + float nativeHeight = 400; + float percentHealth; + int healthBarLength = 400; + Matrix4x4 guiMatrix; + + void Start() + { + Vector3 scale = new Vector3(.5f, .5f, 1.0f); + print(scale); + guiMatrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, scale); + } + + + Matrix4x4 GetGUIMatrix() + { + return guiMatrix; + } + + + + void OnGUI() + { + GUI.matrix = GetGUIMatrix(); + // Create one Group to contain both images + // Adjust the first 2 coordinates to place it somewhere else on-screen + GUI.BeginGroup(new Rect(0, 0, 640, 400)); + + // Draw the background image + GUI.backgroundColor = new Color(0, 0, 0, 0.0f); + GUI.Box(new Rect(0, 0, 620, 400), bgImage); + + percentHealth = curHealth / maxHealth; + // 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 + GUI.BeginGroup(new Rect(0, 0, percentHealth * 640, 400)); + + // Draw the foreground image + GUI.backgroundColor = new Color(0, 0, 0, 0.0f); + GUI.Box(new Rect(0, 0, 620, 400), fgImage); + + + // End both Groups + GUI.EndGroup(); + + GUI.EndGroup(); + } +} diff --git a/Assets/GUI/mGUI.cs.meta b/Assets/GUI/mGUI.cs.meta new file mode 100644 index 0000000..27791fb --- /dev/null +++ b/Assets/GUI/mGUI.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 648f4d518e7553e43bfc19b27ce55c9b +timeCreated: 1454186720 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: + - mySkin: {fileID: 11400000, guid: 35ff26cd2821a324b9bfa066cd48b571, type: 2} + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: