private void OnTriggerEnter(Collider other) { switch (other.tag) { case "obstacle": player.PlayerDamage().GotHit(other.gameObject); break; case "pickup": Pickups pickup = other.GetComponent <Pickups>(); if (pickup) { switch (pickup.GetPickupType()) { case EPickupType.FUEL: // Add fuel to player player.Fuel().AddFuel(player.PlayerMovement().IsFalling()); audio.PlaySound(pickupSounds[0], pickupVol); DestroyObject(other.gameObject); break; case EPickupType.BOOST: // Do some physics on the player based on boostForce player.Boost().BoostOn(); player.SetBoost(true); audio.PlaySound(pickupSounds[1], 0.8f); DestroyObject(other.gameObject); break; case EPickupType.SHIELD: // Send reference to the player to activate sheild player.PlayerDamage().AttatchShield(); audio.PlaySound(pickupSounds[2], pickupVol); DestroyObject(other.gameObject); break; case EPickupType.GEAR: // Add gears GearManager.instance.IncrementGears(); audio.PlaySound(pickupSounds[3], 0.35f); DestroyObject(other.gameObject); break; case EPickupType.PROJECTILE: // Allow player to shoot player.PlayerShoot().EnableShoot(); audio.PlaySound(pickupSounds[4], 0.65f); DestroyObject(other.gameObject); break; } } break; } }