2019-08-04 16:18:01 +02:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
2019-08-04 17:35:05 +02:00
|
|
|
|
using UnityEngine.UI;
|
2019-08-04 16:18:01 +02:00
|
|
|
|
|
|
|
|
|
namespace Saltosion.OneWeapon {
|
|
|
|
|
public class HUDController : MonoBehaviour {
|
|
|
|
|
|
2019-08-04 17:35:05 +02:00
|
|
|
|
public PlayerFun PlayerFun;
|
|
|
|
|
public RawImage FunMeter;
|
|
|
|
|
|
|
|
|
|
public Text DamageTextGore;
|
|
|
|
|
public Text DamageTextFun;
|
2019-08-04 16:18:01 +02:00
|
|
|
|
|
|
|
|
|
void Start() {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Update() {
|
2019-08-04 17:35:05 +02:00
|
|
|
|
float FunPercent = (PlayerFun.CurrentFun / PlayerFun.MaxFun);
|
|
|
|
|
Vector3 Scale = FunMeter.transform.localScale;
|
|
|
|
|
|
|
|
|
|
Scale.x = FunPercent;
|
|
|
|
|
FunMeter.transform.localScale = Scale;
|
|
|
|
|
Rect UVRect = FunMeter.uvRect;
|
|
|
|
|
UVRect.width = FunPercent;
|
|
|
|
|
FunMeter.uvRect = UVRect;
|
|
|
|
|
|
|
|
|
|
float FunLevel = Mathf.Floor(FunPercent * 6) / 6;
|
|
|
|
|
|
|
|
|
|
Color Color = FunMeter.color;
|
|
|
|
|
Color.g = FunLevel;
|
|
|
|
|
Color.r = 1 - FunLevel;
|
|
|
|
|
FunMeter.color = Color;
|
|
|
|
|
|
|
|
|
|
int FunPercentNumber = (int)Mathf.Round(PlayerFun.CurrentDamageBoost * 100);
|
|
|
|
|
string Text = "+" + FunPercentNumber + "%";
|
|
|
|
|
DamageTextGore.text = Text;
|
|
|
|
|
DamageTextFun.text = Text;
|
|
|
|
|
|
|
|
|
|
Color GoreColor = DamageTextGore.color;
|
|
|
|
|
GoreColor.g = 1 - PlayerFun.CurrentDamageBoost;
|
|
|
|
|
GoreColor.b = 1 - PlayerFun.CurrentDamageBoost;
|
|
|
|
|
DamageTextGore.color = GoreColor;
|
|
|
|
|
|
|
|
|
|
Color FunColor = DamageTextFun.color;
|
|
|
|
|
FunColor.b = 1 - PlayerFun.CurrentDamageBoost;
|
|
|
|
|
DamageTextFun.color = FunColor;
|
2019-08-04 16:18:01 +02:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|