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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|