private void OnTriggerExit(Collider other) { if (onBombTrigger != null) { double sid = 0; CharacterEntity charEntity = other.GetComponentInParent <CharacterEntity>(); if (charEntity != null) { sid = charEntity.sid; } else { TankEntity tankEntity = other.GetComponentInParent <TankEntity>(); if (tankEntity != null) { sid = tankEntity.sid; } } if (sid > 0) { onBombTrigger(sid, false); } } }
public void OnCollisionEnter(Collision other) { if (other.gameObject.layer == LayerConfig.Player) { CharacterEntity entity = other.gameObject.GetComponent <CharacterEntity>(); if (OnCollisionPlayer != null) { OnCollisionPlayer(boxSid, entity.sid); } } if (other.gameObject.layer == LayerConfig.Tank) { TankEntity tankEntity = other.gameObject.GetComponent <TankEntity>(); if (OnCollisionTank != null) { OnCollisionTank(boxSid, tankEntity.sid); } } }