private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player") { ElementChecks.ChangePlayerElem(allyElem); } }
// Use this for initialization void Start() { ElementChecks.Init(this); spriteRenderer = GetComponent <SpriteRenderer>(); rigid = GetComponent <Rigidbody2D>(); }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.transform.tag == "Player") { Elements playerElem = collision.transform.GetComponent <PlayerController>().GetElem(); ResultElemInter result = ElementChecks.ComparePlayerElem(objGoodElem, objEnemyElem); switch (result) { case ResultElemInter.ALLY: Destroy(gameObject); //goodAction.ToString(); break; case ResultElemInter.ENEMY: //badAction.ToString(); break; } } }