Esempio n. 1
0
        public void FocusInTheCamTarget(float vel)
        {
            CamFeatures c = features;

            c.contadorDeTempo += Time.deltaTime;

            if (c.distQ == 0)
            {
                alvoQ   = Quaternion.LookRotation(c.Target.forward + c.targetHeightForCam * Vector3.down);
                c.distQ = Quaternion.Angle(alvoQ, c.StarterQ) * Mathf.PI * c.sphericalDistance / 180;
            }

            Quaternion lerp = Quaternion.Lerp(c.StarterQ, alvoQ, c.contadorDeTempo / c.distQ * vel);


            x = lerp.eulerAngles.y;
            y = lerp.eulerAngles.x;
            y = ClampAngle(y, features.yMinLimit, features.yMaxLimit);


            if (c.contadorDeTempo > c.distQ / vel)
            {
                FayvitCamEventAgregator.Publish(new FayvitCamEvent(FayvitCamEventKey.controlableReached, features));
                State = StateCam.controlable;
            }
        }
Esempio n. 2
0
        public void ApplyCam(float moveX, float moveY, bool focar, bool autoAjust)
        {
            CamFeatures c = features;

            if (c.Target && c.MyCamera)
            {
                if (focar)
                {
                    IniciarFocarCamera(c);
                    State = StateCam.inFocusing;
                }
                else if (autoAjust && State == StateCam.controlable && c.velAutoAjust > 0)
                {
                    State = StateCam.inAutoAjust;
                }
                else if (State == StateCam.inAutoAjust && !autoAjust)
                {
                    State = StateCam.controlable;
                }

                if (State == StateCam.controlable)
                {
                    ControlableCam(moveX, moveY);
                }
                else if (State == StateCam.inFocusing)
                {
                    FocusInTheCamTarget(c.velToQ);
                }
                else if (State == StateCam.inAutoAjust)
                {
                    IniciarFocarCamera(c);
                    FocusInTheCamTarget(c.velAutoAjust);
                }

                SetPositionAndRotation();

                if (immediateFocusPosition)
                {
                    ImmediateFocusPosition();
                    FayvitCameraSupport.ClearSmooth();
                }
                else
                {
                    FayvitCameraSupport.DodgeWall(c.MyCamera, c.Target.position, c.varVerticalHeightPoint + c.HeightCharacter, true);
                }
            }
        }