private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.tag == "Border") { WallCollision(collision); } if (collision.gameObject.tag == "Deflect") { lastDeflectTouched = collision.gameObject.GetComponent <DeflecterProperties>(); if (lastDeflectTouched != null) { if (lastDeflectTouched.GetUser().IsAlly() != IsAlly()) { isAlly = !isAlly; SetNewTrajectory(WeaponData.ProjectileTrajectory.deflected); } } } if (collision.gameObject.tag != "Entity") { return; } IEntity lastDamagedEntity = collision.gameObject.GetComponent <IEntity>(); if (lastDamagedEntity == null) { return; } if (isAlly == lastDamagedEntity.IsAlly()) { return; } HitEnemyEntity(lastDamagedEntity); }
private void ResetBullet() { tmp_bounceCooldown = 0; lastDeflectTouched = null; gameObject.SetActive(true); waitingToRecycle = false; hitboxParent.gameObject.SetActive(true); tmp_backToPoolDelay = BACK_TO_POOL_DELAY; }