public virtual void OnHit(Collider2D collision) { GameObject tempGO = Instantiate(onDieParticles, transform.position, Quaternion.identity); ParticleSystemTemper tempPS = tempGO.GetComponent <ParticleSystemTemper>(); if (tempPS != null) { tempPS.Play(); } }
public virtual void Die() { GameObject tempGO = Instantiate(onDieParticles, transform.position, Quaternion.identity); ParticleSystemTemper tempPS = tempGO.GetComponent <ParticleSystemTemper>(); if (tempPS != null) { tempPS.Play(); } if (onDieAction != null) { onDieAction.Invoke(); } if (GravityController.gravEmitters.ContainsKey(gameObject)) { GravityController.gravEmitters.Remove(gameObject); } Destroy(gameObject); }