private void Projectile_OnCollisionEnter(object otherCollider) { GameObject hitGameObject = ((BoxCollider)otherCollider).ConnectedGameObject; if ((hitGameObject is Player && !IsGood) || (hitGameObject is Enemy && IsGood)) { LivingEntity entity = hitGameObject as LivingEntity; if (!entity.invincible) { entity.HP -= Damage; if (entity.HP <= 0) { Player targetHolder = (Player)((Enemy)entity).Target; targetHolder.ComboManager(); targetHolder.Gold = targetHolder.Gold + (entity.Gold * targetHolder.combo); if (!GameManager.EnemiesP1.Remove((Enemy)entity)) { GameManager.EnemiesP2.Remove((Enemy)entity); } entity.Destroy(); } else { //switch (kbDirection) //{ // case FacingDirection.Up: // Position = new Vector2(Position.X, Position.Y - 30); // break; // case FacingDirection.Left: // Position = new Vector2(Position.X - 30, Position.Y); // break; // case FacingDirection.Right: // Position = new Vector2(Position.X + 30, Position.Y); // break; // case FacingDirection.Down: // Position = new Vector2(Position.X, Position.Y + 30); // break; //} } } Destroy(); } else if (!(hitGameObject is LivingEntity)) { Destroy(); } }