Update HUD, add TextMeshPro and add Gun to HUD

This commit is contained in:
Sofia 2019-08-22 21:12:10 +03:00
parent bac1c0227d
commit f01ef21394
15 changed files with 3151 additions and 194 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f8aeb2d30df20474c9d9f4323c4f89e5
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 47aa452daa3e16648bb485c705810ff8
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -131,12 +131,15 @@ MonoBehaviour:
Sprite: {fileID: 4462327695001662280} Sprite: {fileID: 4462327695001662280}
MaxCooldown: 0.4 MaxCooldown: 0.4
MinCooldown: 0.4 MinCooldown: 0.4
IsAutomatic: 0
BulletHole: {fileID: 427857587156450783} BulletHole: {fileID: 427857587156450783}
Bobbing: {fileID: 3522608540502111974} Bobbing: {fileID: 3522608540502111974}
LaunchExplosion: {fileID: 4723857831747480546} LaunchExplosion: {fileID: 4723857831747480546}
LaunchLight: {fileID: 3766947302535072744} LaunchLight: {fileID: 3766947302535072744}
LaunchLightIntensity: 2 LaunchLightIntensity: 2
LaunchLightIntensityDegrade: 6 LaunchLightIntensityDegrade: 6
Name: Grenade Launcher
GunSprite: {fileID: 21300000, guid: 02893cc210ed31340a8374c7c454c04b, type: 3}
--- !u!114 &3522608540502111974 --- !u!114 &3522608540502111974
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -137,6 +137,8 @@ MonoBehaviour:
LaunchLight: {fileID: 0} LaunchLight: {fileID: 0}
LaunchLightIntensity: 2 LaunchLightIntensity: 2
LaunchLightIntensityDegrade: 2 LaunchLightIntensityDegrade: 2
Name: The "RRRR" Gun
GunSprite: {fileID: 21300000, guid: 4f4bf33d21e18b74bbc94447866079a9, type: 3}
--- !u!114 &3522608540502111974 --- !u!114 &3522608540502111974
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -128,10 +128,17 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
Bullet: {fileID: 4482402865533696887, guid: a3bd810156720f24a9fe5e1ba27d7da8, type: 3} Bullet: {fileID: 4482402865533696887, guid: a3bd810156720f24a9fe5e1ba27d7da8, type: 3}
Sprite: {fileID: 4462327695001662280} Sprite: {fileID: 4462327695001662280}
BulletHole: {fileID: 427857587156450783}
MaxCooldown: 0.3 MaxCooldown: 0.3
MinCooldown: 0.3 MinCooldown: 0.3
IsAutomatic: 0
BulletHole: {fileID: 427857587156450783}
Bobbing: {fileID: 3522608540502111974} Bobbing: {fileID: 3522608540502111974}
LaunchExplosion: {fileID: 0}
LaunchLight: {fileID: 0}
LaunchLightIntensity: 2
LaunchLightIntensityDegrade: 2
Name: Revolver
GunSprite: {fileID: 21300000, guid: 918f808d2d9fc104696617ebfe2a323e, type: 3}
--- !u!114 &3522608540502111974 --- !u!114 &3522608540502111974
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -4803,11 +4803,17 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
Bullet: {fileID: 4482402865533696887, guid: 7af615d932452d5499b121288152e0bf, type: 3} Bullet: {fileID: 4482402865533696887, guid: 7af615d932452d5499b121288152e0bf, type: 3}
Sprite: {fileID: 2523517585734629853} Sprite: {fileID: 2523517585734629853}
BulletHole: {fileID: 2523517586496120961}
MaxCooldown: 1 MaxCooldown: 1
MinCooldown: 0.4 MinCooldown: 0.4
IsAutomatic: 0
BulletHole: {fileID: 2523517586496120961}
Bobbing: {fileID: 2523517584660005061} Bobbing: {fileID: 2523517584660005061}
LaunchExplosion: {fileID: 3219625380724796208} LaunchExplosion: {fileID: 3219625380724796208}
LaunchLight: {fileID: 0}
LaunchLightIntensity: 2
LaunchLightIntensityDegrade: 2
Name: Rocket Launcher
GunSprite: {fileID: 21300000, guid: f0bff237f714fd44d87135c9fdb7237d, type: 3}
--- !u!61 &2523517584660005059 --- !u!61 &2523517584660005059
BoxCollider2D: BoxCollider2D:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -128,10 +128,17 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
Bullet: {fileID: 4094504807648883912, guid: 3e6dd1945fe63a74bb9e9ef31a661b65, type: 3} Bullet: {fileID: 4094504807648883912, guid: 3e6dd1945fe63a74bb9e9ef31a661b65, type: 3}
Sprite: {fileID: 4462327695001662280} Sprite: {fileID: 4462327695001662280}
BulletHole: {fileID: 427857587156450783}
MaxCooldown: 0.6 MaxCooldown: 0.6
MinCooldown: 0.6 MinCooldown: 0.6
IsAutomatic: 0
BulletHole: {fileID: 427857587156450783}
Bobbing: {fileID: 3522608540502111974} Bobbing: {fileID: 3522608540502111974}
LaunchExplosion: {fileID: 0}
LaunchLight: {fileID: 0}
LaunchLightIntensity: 2
LaunchLightIntensityDegrade: 2
Name: Shotgun
GunSprite: {fileID: 21300000, guid: a7290ef708bb1064fbe466f56eb95ac6, type: 3}
--- !u!114 &3522608540502111974 --- !u!114 &3522608540502111974
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

File diff suppressed because it is too large Load Diff

View File

@ -97,7 +97,7 @@ LightmapSettings:
m_ExportTrainingData: 0 m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData m_TrainingDataDestination: TrainingData
m_LightingDataAsset: {fileID: 0} m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 0 m_UseShadowmask: 1
--- !u!196 &4 --- !u!196 &4
NavMeshSettings: NavMeshSettings:
serializedVersion: 2 serializedVersion: 2

View File

@ -2,25 +2,38 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
using TMPro;
using Saltosion.OneWeapon.Player; using Saltosion.OneWeapon.Player;
using Saltosion.OneWeapon.Guns;
namespace Saltosion.OneWeapon.GUI { namespace Saltosion.OneWeapon.GUI {
public class HUDController : MonoBehaviour { public class HUDController : MonoBehaviour {
[Header("General")]
public PlayerController Player;
public PlayerFun PlayerFun; public PlayerFun PlayerFun;
public RawImage FunMeter; public RawImage FunMeter;
public Image GunImage;
public Text DamageTextGore; [Header("Gore Texts")]
public Text DamageTextFun; public TMP_Text DamageTextGore;
public TMP_Text FunTextGore;
public TMP_Text GunTextGore;
public Text FunTextGore; [Header("Fun Texts")]
public Text FunTextFun; public TMP_Text DamageTextFun;
public TMP_Text FunTextFun;
public TMP_Text GunTextFun;
private string[] GoreTexts = new string[] { "I'm gonna die of boredom!", "Ultra lame!", "Oof, boring!", "That's cool!", "Holy fuck!", "Bloody awesome!" }; private string[] GoreTexts = new string[] { "I'm gonna die of boredom!", "Ultra lame!", "Oof, boring!", "That's cool!", "Holy fuck!", "Bloody awesome!" };
private string[] FunTexts = new string[] { "I'm gonna fall asleep!", "You should try doing something!", "There aren't enough flowers", "Now that's pretty!", "You're doing great!", "Faboulous!" }; private string[] FunTexts = new string[] { "I'm gonna fall asleep!", "You should try doing something!", "There aren't enough flowers", "Now that's pretty!", "You're doing great!", "Faboulous!" };
void Start() { private Gun LastGun;
void Start() {
GunTextGore.text = "";
GunTextFun.text = "";
} }
void Update() { void Update() {
@ -60,6 +73,19 @@ namespace Saltosion.OneWeapon.GUI {
FunTextGore.text = GoreTexts[FunLevelInt]; FunTextGore.text = GoreTexts[FunLevelInt];
FunTextFun.text = FunTexts[FunLevelInt]; FunTextFun.text = FunTexts[FunLevelInt];
if (Player.Gun != LastGun) {
LastGun = Player.Gun;
if (LastGun == null) {
GunTextGore.text = "";
GunTextFun.text = "";
GunImage.color = new Color(0, 0, 0, 0);
} else {
GunTextGore.text = LastGun.Name;
GunTextFun.text = LastGun.Name;
GunImage.sprite = LastGun.GunSprite;
GunImage.color = new Color(1, 1, 1, 1);
}
}
} }
} }
} }

View File

@ -22,6 +22,10 @@ namespace Saltosion.OneWeapon.Guns {
public float LaunchLightIntensity = 2; public float LaunchLightIntensity = 2;
public float LaunchLightIntensityDegrade = 2; public float LaunchLightIntensityDegrade = 2;
[Header("HUD Stuff")]
public string Name = "NULL";
public Sprite GunSprite;
private bool IsHeld = false; private bool IsHeld = false;
private float CurrCooldown = 0; private float CurrCooldown = 0;
private float CurrLaunchLight = 0; private float CurrLaunchLight = 0;

View File

@ -30,7 +30,7 @@ namespace Saltosion.OneWeapon.Player {
public PlayerFun PlayerFun; public PlayerFun PlayerFun;
private Gun Gun; public Gun Gun { private set; get; }
private Vector2 GunLocation = new Vector2(0, -0.6f); private Vector2 GunLocation = new Vector2(0, -0.6f);
private Vector3 GunRotation = new Vector3(0, 0, -90); private Vector3 GunRotation = new Vector3(0, 0, -90);
private bool IsHoldingShoot = false; private bool IsHoldingShoot = false;

8
Assets/TextMesh Pro.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f54d1bd14bd3ca042bd867b519fee8cc
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: