1
Fork 0
mirror of https://github.com/Steffo99/gravity-fusion.git synced 2024-11-25 17:54:19 +00:00
gravity-fusion/Assets/Components/Disappear.cs

30 lines
602 B
C#
Raw Normal View History

2019-10-06 15:44:41 +00:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Disappear : MonoBehaviour
{
2019-10-06 17:04:47 +00:00
public float health;
2019-10-06 15:44:41 +00:00
protected Particle particle;
protected void Awake() {
particle = GetComponent<Particle>();
}
2019-10-06 17:04:47 +00:00
protected void Start() {
2019-10-06 15:44:41 +00:00
ResetTimer();
}
public void ResetTimer() {
2019-10-06 17:04:47 +00:00
health = 1f;
2019-10-06 15:44:41 +00:00
}
2019-10-06 17:04:47 +00:00
protected void Update() {
health -= Mathf.Pow(5, particle.gameController.maxTierPresent - particle.Tier - 4) * Time.deltaTime;
2019-10-06 15:44:41 +00:00
2019-10-06 17:04:47 +00:00
if(health < 0) {
2019-10-06 15:44:41 +00:00
Destroy(this.gameObject);
}
}
}