mirror of
https://github.com/Steffo99/gravity-fusion.git
synced 2024-11-22 08:24:17 +00:00
36 lines
658 B
C#
36 lines
658 B
C#
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
public class Disappear : MonoBehaviour
|
|||
|
{
|
|||
|
public float timeLeft;
|
|||
|
protected Particle particle;
|
|||
|
|
|||
|
public float FractionLeft {
|
|||
|
get {
|
|||
|
return timeLeft / particle.Duration;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
protected void Awake() {
|
|||
|
particle = GetComponent<Particle>();
|
|||
|
}
|
|||
|
|
|||
|
private void Start() {
|
|||
|
ResetTimer();
|
|||
|
}
|
|||
|
|
|||
|
public void ResetTimer() {
|
|||
|
timeLeft = particle.Duration;
|
|||
|
}
|
|||
|
|
|||
|
private void Update() {
|
|||
|
timeLeft -= Time.deltaTime;
|
|||
|
|
|||
|
if(timeLeft < 0) {
|
|||
|
Destroy(this.gameObject);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|