void OnCollisionEnter2D(Collision2D coll) { IDamagable[] damageables = coll.gameObject.GetComponents <IDamagable>(); foreach (IDamagable damagable in damageables) { damagable.damage(m_damage); } ObjectLogger.unlog(gameObject, "BULLET"); Destroy(gameObject); }
public void Initalize(Vector2 p_direction, float p_damage, GameObject p_shooter) { m_rb = gameObject.GetComponent <Rigidbody2D>(); m_standard_velocity = p_direction * m_speed; m_damage = p_damage; m_shooter = p_shooter; ObjectLogger.log(gameObject, "BULLET"); m_timeout = new TimeoutEventManager(); m_timeout.addTimeout(2f, () => { ObjectLogger.unlog(gameObject, "BULLET"); Destroy(gameObject); }); }
private void die() { ObjectLogger.unlog(gameObject, "RESOURCE"); Destroy(gameObject); }
//Log fitness and Destroy the game object private void die() { logFitness(); ObjectLogger.unlog(gameObject, "CREATURE"); Destroy(gameObject); }