public void effectOff(effectTypes whichType) { if (effectInsts.ContainsKey(whichType)) { Destroy(effectInsts[whichType], 0.01f); effectInsts.Remove(whichType); } }
public void effectOn(effectTypes whichType) { if (!effectInsts.ContainsKey(whichType)) { GameObject toBeAdded = Instantiate(effectPrefabs[(int)whichType], transform); effectInsts.Add(whichType, toBeAdded); } }
public void oneTimeEffect(effectTypes whichType, Vector3 pos, Quaternion facing) { GameObject tempEffect = Instantiate(effectPrefabs[(int)whichType], pos, facing); Destroy(tempEffect, tempEffect.GetComponent <ParticleSystem>().main.duration); }