示例#1
0
    public void StartShake(CameraShakeSO Intensity)
    {
        StopAllCoroutines();
        EndShake();

        cam.GetCinemachineComponent <CinemachineBasicMultiChannelPerlin>().m_AmplitudeGain = Intensity.AmplitudeGain;
        cam.GetCinemachineComponent <CinemachineBasicMultiChannelPerlin>().m_FrequencyGain = Intensity.FrequencyGain;
#if (UNITY_EDITOR || UNITY_STANDALONE)
        GamePad.SetVibration(playerIndex, Intensity.ControllerIntensity.x, Intensity.ControllerIntensity.y);
#endif
        if (Intensity.Duration > 0.0f)
        {
            StartCoroutine(WaitEndShake(Intensity.Duration));
        }
    }
示例#2
0
    public static bool CreateShakeSetup(CameraShakeSO Setting, GameObject Object)
    {
        if (_shakerCamera != null)
        {
            return(false);
        }
        //setup for shake by zering out vectors
        _shakerCamera = Object;
        _shakeAmount  = Vector3.zero;

        _data     = Setting.CameraShakeSettings;
        _settings = _data;

        CheckFadeInOrOut();

        _influencePosition = _defaultPosInfluence;
        _influenceRotation = _deaultRotInfluence;

        _tickAmount = Random.Range(-100, 100);

        return(true);
    }