mirror of
https://github.com/Steffo99/gravity-fusion.git
synced 2024-11-23 00:34:20 +00:00
29 lines
649 B
C#
29 lines
649 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(particle.gameController.particleDurationConstant, particle.gameController.maxTierPresent - particle.Tier - 4) * Time.deltaTime;
|
|
|
|
if(health < 0) {
|
|
Destroy(this.gameObject);
|
|
}
|
|
}
|
|
}
|