Example #1
0
    public override void AfterSwitch(FageStateMachine stateMachine, string beforeId)
    {
        base.AfterSwitch(stateMachine, beforeId);
        _effector = stateMachine as CameraEffector;
        _screen   = _effector.screen;
        _blur     = _effector.blur;

        EffectRequest request = _effector.GetRequest();

        if (request == null)
        {
            _effector.ReserveState("CameraEffectorIdle");
            return;
        }

        _presetFrom = _effector.DumpEffect();
        _presetTo   = _effector.GetPreset(request.preset);
        if (_presetTo == null)
        {
            _effector.ReserveState("CameraEffectorIdle");
            return;
        }

        if (request.second > 0)
        {
            if ((_presetFrom.blurSize != _presetTo.blurSize) &&
                (_presetFrom.blurEnable != _presetTo.blurEnable))
            {
                _blur.enabled = true;
            }
            if ((_presetFrom.screenSaturation != _presetTo.screenSaturation) ||
                (_presetFrom.chromaticAberrationMagnetude != _presetTo.chromaticAberrationMagnetude) ||
                (_presetFrom.staticMagnetude != _presetTo.staticMagnetude) &&
                (_presetFrom.screenEnable != _presetTo.screenEnable))
            {
                _screen.enabled = true;
            }
            LeanTween.value(_effector.gameObject, 0f, 1f, request.second).setOnUpdate(OnTweenUpdate).setOnComplete(OnTweenComplete);
        }
        else
        {
            OnTweenComplete();
        }
    }
Example #2
0
 private void OnTweenComplete()
 {
     _screen.enabled                      = _presetTo.screenEnable;
     _screen.screenSaturation             = _presetTo.screenSaturation;
     _screen.chromaticAberrationMagnetude = _presetTo.chromaticAberrationMagnetude;
     _screen.staticMagnetude              = _presetTo.staticMagnetude;
     _blur.enabled  = _presetTo.blurEnable;
     _blur.blurSize = _presetTo.blurSize;
     _effector.ReserveState("CameraEffectorIdle");
 }
Example #3
0
    public override void Excute(FageStateMachine stateMachine)
    {
        base.Excute(stateMachine);
        CameraEffector effector = stateMachine as CameraEffector;

        if (effector.GetRequestCount() > 0)
        {
            effector.ReserveState("CameraEffectorTween");
        }
    }