Created
January 5, 2019 02:17
-
-
Save chittai/7789a7e563a0c4efc77a7fb25592e7b1 to your computer and use it in GitHub Desktop.
Unityでゲージの減少を行うための処理
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class GuageDecreasing : MonoBehaviour { | |
public GameObject Guage; | |
private float guageMax; | |
private float guageNow; | |
private float width; | |
public float restGuage{ get { return guageNow; } set { guageNow = value; } } | |
void Start () { | |
guageMax = Mathf.Clamp(guageNow,0, guageMax); | |
guageMax = 5; | |
guageNow = guageMax; | |
width = 1150; | |
} | |
public void Decreasing() | |
{ | |
guageNow -= Time.deltaTime; | |
guage.GetComponent<RectTransform>().sizeDelta = new Vector2(width * (guageNow/ guageMax), guage.GetComponent<RectTransform>().sizeDelta.y); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment