19 lines
470 B
C#
19 lines
470 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class SpriteHealthBar : MonoBehaviour
|
|
{
|
|
private Vector3 startScale;
|
|
|
|
public Transform healthBarFill;
|
|
void Start()
|
|
{
|
|
startScale = healthBarFill.localScale;
|
|
}
|
|
|
|
public void SetHealth(float amount){
|
|
float amountMult = amount / 100f;
|
|
healthBarFill.localScale = new Vector3(startScale.x * amountMult, startScale.y,startScale.z );
|
|
}
|
|
} |