Near finish
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace InguzPings
|
||||
{
|
||||
|
||||
public class AnimationHelper : MonoBehaviour {
|
||||
public bool INFINITE_LOOP = true; //If true, then duration is ignored and goes on and on.
|
||||
public float duration = 5.5f; //Fixed duration of the vfx.
|
||||
public bool DESTROY_ON_END = true;
|
||||
public GameObject[] all_particles;
|
||||
private float start_time = -100.0f;
|
||||
private bool GO = true;
|
||||
|
||||
|
||||
void Start ()
|
||||
{
|
||||
start_time = Time.time;
|
||||
}
|
||||
|
||||
|
||||
void Update ()
|
||||
{
|
||||
if (!INFINITE_LOOP && duration + start_time <= Time.time && GO)
|
||||
STOP_VFX();
|
||||
}
|
||||
|
||||
|
||||
public void STOP_VFX()
|
||||
{
|
||||
GO = false;
|
||||
for(int i = 0; i < all_particles.Length; i++)
|
||||
all_particles[i].GetComponent<ParticleSystem>().Stop();
|
||||
|
||||
if (DESTROY_ON_END)
|
||||
Destroy (gameObject, 1.0f); //A little time before destroying, to let remaining particles to die first. It looks better.
|
||||
}
|
||||
|
||||
|
||||
public void PLAY_VFX()
|
||||
{
|
||||
for(int i = 0; i < all_particles.Length; i++)
|
||||
all_particles[i].GetComponent<ParticleSystem>().Play();
|
||||
|
||||
start_time = Time.time;
|
||||
GO = true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1080b9bcefba66b40b45ee7eb02e32df
|
||||
timeCreated: 1533761278
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,20 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
|
||||
namespace InguzPings
|
||||
{
|
||||
|
||||
|
||||
public class SelfDestruct : MonoBehaviour {
|
||||
public float selfdestruct_in = 4; // Setting this to 0 means no selfdestruct.
|
||||
|
||||
void Start () {
|
||||
if ( selfdestruct_in != 0){
|
||||
Destroy (gameObject, selfdestruct_in);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 04c89067105e5b04c969d04cf0499be0
|
||||
timeCreated: 1565547737
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user