public void ShakeOnce(GameCameraShakerSettingsComponent settings, CameraShakerConfigComponent cameraShakerConfig)
 {
     if (this.ValidateShake(settings, cameraShakerConfig))
     {
         this.cameraShaker.ShakeOnce(cameraShakerConfig.Magnitude, cameraShakerConfig.Roughness, cameraShakerConfig.FadeInTime, cameraShakerConfig.FadeOutTime, new Vector3(cameraShakerConfig.PosInfluenceX, cameraShakerConfig.PosInfluenceY, cameraShakerConfig.PosInfluenceZ), new Vector3(cameraShakerConfig.RotInfluenceX, cameraShakerConfig.RotInfluenceY, cameraShakerConfig.RotInfluenceZ));
     }
 }
Beispiel #2
0
 public void ShakeHUDOnShot(GameCameraShakerSettingsComponent settings, KickbackCameraShakerConfigComponent config)
 {
     if (this.ValidateShake(settings, config))
     {
         CameraShakeInstance instance = this.shaker.ShakeOnce(config.Magnitude, config.Roughness, config.FadeInTime, config.FadeOutTime, new Vector3(config.PosInfluenceX, config.PosInfluenceY, config.PosInfluenceZ), new Vector3(config.RotInfluenceX, config.RotInfluenceY, config.RotInfluenceZ));
     }
 }
 public void ShakeByFalling(GameCameraShakerSettingsComponent settings, CameraShakerConfigComponent cameraShakerConfig, float weakeningCoeff)
 {
     if (this.ValidateShake(settings, cameraShakerConfig))
     {
         this.cameraShaker.ShakeOnce(cameraShakerConfig.Magnitude, cameraShakerConfig.Roughness, cameraShakerConfig.FadeInTime, cameraShakerConfig.FadeOutTime, new Vector3(cameraShakerConfig.PosInfluenceX, cameraShakerConfig.PosInfluenceY, cameraShakerConfig.PosInfluenceZ), new Vector3(cameraShakerConfig.RotInfluenceX, cameraShakerConfig.RotInfluenceY, cameraShakerConfig.RotInfluenceZ)).ScaleMagnitude = weakeningCoeff;
     }
 }
 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 StartShake(GameCameraShakerSettingsComponent settings, CameraShakerConfigComponent cameraShakerConfig)
        {
            if (!this.ValidateShake(settings, cameraShakerConfig))
            {
                return(null);
            }
            CameraShakeInstance instance = this.cameraShaker.StartShake(cameraShakerConfig.Magnitude, cameraShakerConfig.Roughness, cameraShakerConfig.FadeInTime, new Vector3(cameraShakerConfig.PosInfluenceX, cameraShakerConfig.PosInfluenceY, cameraShakerConfig.PosInfluenceZ), new Vector3(cameraShakerConfig.RotInfluenceX, cameraShakerConfig.RotInfluenceY, cameraShakerConfig.RotInfluenceZ));

            instance.deleteOnInactive = false;
            return(instance);
        }
 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);
 }
 public void ShakeOnce(GameCameraShakerSettingsComponent settings, CameraShakerConfigComponent cameraShakerConfig, float cooldownTime)
 {
     if (this.ValidateShake(settings, cameraShakerConfig))
     {
         float fadeInTime  = cameraShakerConfig.FadeInTime;
         float fadeOutTime = cameraShakerConfig.FadeOutTime;
         if ((fadeInTime + fadeOutTime) > cooldownTime)
         {
             if (fadeInTime <= cooldownTime)
             {
                 fadeOutTime = cooldownTime - fadeInTime;
             }
             else
             {
                 fadeInTime  = 0f;
                 fadeOutTime = cooldownTime;
             }
         }
         this.cameraShaker.ShakeOnce(cameraShakerConfig.Magnitude, cameraShakerConfig.Roughness, fadeInTime, fadeOutTime, new Vector3(cameraShakerConfig.PosInfluenceX, cameraShakerConfig.PosInfluenceY, cameraShakerConfig.PosInfluenceZ), new Vector3(cameraShakerConfig.RotInfluenceX, cameraShakerConfig.RotInfluenceY, cameraShakerConfig.RotInfluenceZ));
     }
 }
Beispiel #8
0
 private bool ValidateShake(GameCameraShakerSettingsComponent settings, CameraShakerConfigComponent cameraShakerConfig) =>
 settings.Enabled && cameraShakerConfig.Enabled;