public void BorrowEffectAt(Vector3 position, VehicleEffectIndex index, VehicleEffectData groundEffect) { ETerrainEffectType effectType; switch (index) { case VehicleEffectIndex.WheelRunning: effectType = ETerrainEffectType.Normal; break; case VehicleEffectIndex.WheelBrake: effectType = ETerrainEffectType.Brake; break; default: throw new Exception(String.Format("Undefined Ground Effect for index {0}!", index)); } var effect = GetEffect(position, effectType); if (effect != null) { groundEffect.Id = GetEffectId(position, effectType); groundEffect.Effect = effect.EffectGo; groundEffect.Effect.SetActive(false); groundEffect.RawObject = effect; } else { groundEffect.Id = 0; groundEffect.Effect = null; groundEffect.RawObject = null; } }
public void ReturnEffect(VehicleEffectData groundEffect) { if (groundEffect.RawObject != null) { ReleaseEffect((ITerrainEffectItem)groundEffect.RawObject); groundEffect.Effect = null; groundEffect.RawObject = null; } }