private void OnCollisionEnter(Collision collision) { if (collision.gameObject.layer != 9) { Collider[] blasted = Physics.OverlapSphere(transform.position, blastRadius); foreach (Collider item in blasted) { seasonChangable season = item.gameObject.GetComponent <seasonChangable>(); if (season != null) { season.springActive = false; season.autumnActive = false; Debug.Log("Enact By Summer"); } } Destroy(gameObject); } }
private void OnCollisionEnter(Collision collision) { if (collision.gameObject.layer != 9) { Collider[] blasted = Physics.OverlapSphere(transform.position, blastRadius); foreach (Collider item in blasted) { seasonChangable season = item.gameObject.GetComponent <seasonChangable>(); if (season != null) { season.autumnActive = true; season.springActive = false; Debug.Log("Enact By Autumn"); } } ParticleSystem hitE = Instantiate(decayEffect, transform.position, transform.rotation).GetComponent <ParticleSystem>(); hitE.Play(); Destroy(gameObject); } Destroy(gameObject); }