private void OnCollisionEnter2D(Collision2D collision) { Debug.Log(collision.gameObject.name); if (collision.gameObject.name == "Player") { Entity_Logic playerE = collision.gameObject.GetComponent <Entity_Logic>(); playerE.TakeDamage(4); collidedWithPlayer = true; } }
//enemy/ally check private void OnTriggerEnter2D(Collider2D collision) { if (targetLayer.Contains((CustomGCOTypes.CollisionLayerKey)collision.gameObject.layer)) { Entity_Logic temp = collision.gameObject.GetComponent <Entity_Logic>(); if (temp != null) { temp.TakeDamage(damage); } } }
//enemy/ally check private void OnCollisionEnter2D(Collision2D collision) { if (targetLayer.Contains((CustomGCOTypes.CollisionLayerKey)collision.gameObject.layer)) { Entity_Logic temp = collision.gameObject.GetComponent <Entity_Logic>(); if (temp != null) { temp.TakeDamage(damage); } } if ((CustomGCOTypes.CollisionLayerKey)collision.gameObject.layer != CustomGCOTypes.CollisionLayerKey.platforms) { PoofObject(); } }