public void OnTriggerEnter2D(Collider2D collision) { DeepCreature collidingCreature = collision.gameObject.GetComponent <DeepCreature>(); if (collidingCreature != null && !collidingCreature.IsDead()) { dude.TakeDamage(collidingCreature.GetAttack()); } }
public void OnTriggerEnter2D(Collider2D collision) { DeepCreature creature = collision.gameObject.GetComponent <DeepCreature>(); if (creature != null && !creature.IsDead()) { creature.TakeDamage(attack); if (creature.IsDead()) { dude.EarnBones(creature.GetBones()); } KillProjectile(); } DeepTile tile = collision.gameObject.GetComponent <DeepTile>(); if (tile != null && !tile.isAir && !tile.isWater) { KillProjectile(); } }