public void ShakeByDiscreteImpact(GameCameraShakerSettingsComponent settings, CameraShakerConfigComponent cameraShakerConfig, Vector3 impactFrontDirectionWorldSpace, float weakeningCoeff) { if (this.ValidateShake(settings, cameraShakerConfig) && (impactFrontDirectionWorldSpace.magnitude >= 0.005f)) { ImpactAlignedInfluence influence = this.CalculateInfluence(impactFrontDirectionWorldSpace, cameraShakerConfig); this.cameraShaker.ShakeOnce(cameraShakerConfig.Magnitude, cameraShakerConfig.Roughness, cameraShakerConfig.FadeInTime, cameraShakerConfig.FadeOutTime, influence.posInfluence, influence.rotInfluence).ScaleMagnitude = weakeningCoeff; } }
public CameraShakeInstance UpdateImpactShakeInstance(GameCameraShakerSettingsComponent settings, CameraShakeInstance instance, CameraShakerConfigComponent cameraShakerConfig, Vector3 frontDir, float weakening) { if (this.ValidateShake(settings, cameraShakerConfig)) { if (frontDir.magnitude < 0.005f) { return(instance); } ImpactAlignedInfluence influence = this.CalculateInfluence(frontDir, cameraShakerConfig); if (instance == null) { instance = this.cameraShaker.StartShake(cameraShakerConfig.Magnitude, cameraShakerConfig.Roughness, cameraShakerConfig.FadeInTime, influence.posInfluence, influence.rotInfluence); instance.deleteOnInactive = false; } instance.ScaleMagnitude = weakening; instance.positionInfluence = influence.posInfluence; instance.rotationInfluence = influence.rotInfluence; } return(instance); }