1
Fork 0
mirror of https://github.com/Steffo99/gravity-fusion.git synced 2024-11-28 19:14:30 +00:00
gravity-fusion/Assets/Components/Disappear.cs
2019-10-06 19:04:47 +02:00

29 lines
602 B
C#

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