Пример #1
0
    private void SetLocalOnlyComponentsEnabled(bool enable)
    {
        CCMotor component = base.GetComponent <CCMotor>();

        if (component)
        {
            component.enabled = enable;
            CharacterController characterController = base.collider as CharacterController;
            if (characterController)
            {
                characterController.enabled = enable;
            }
        }
        CameraMount componentInChildren = base.GetComponentInChildren <CameraMount>();

        if (componentInChildren)
        {
            componentInChildren.open = enable;
            HeadBob headBob = componentInChildren.GetComponent <HeadBob>();
            if (headBob)
            {
                headBob.enabled = enable;
            }
            LazyCam lazyCam = componentInChildren.GetComponent <LazyCam>();
            if (lazyCam)
            {
                lazyCam.enabled = enable;
            }
        }
        LocalDamageDisplay localDamageDisplay = base.GetComponent <LocalDamageDisplay>();

        if (localDamageDisplay)
        {
            localDamageDisplay.enabled = enable;
        }
    }
Пример #2
0
    private void SetLocalOnlyComponentsEnabled(bool enable)
    {
        CCMotor component = base.GetComponent <CCMotor>();

        if (component != null)
        {
            component.enabled = enable;
            CharacterController collider = base.collider as CharacterController;
            if (collider != null)
            {
                collider.enabled = enable;
            }
        }
        CameraMount componentInChildren = base.GetComponentInChildren <CameraMount>();

        if (componentInChildren != null)
        {
            componentInChildren.open = enable;
            HeadBob bob = componentInChildren.GetComponent <HeadBob>();
            if (bob != null)
            {
                bob.enabled = enable;
            }
            LazyCam cam = componentInChildren.GetComponent <LazyCam>();
            if (cam != null)
            {
                cam.enabled = enable;
            }
        }
        LocalDamageDisplay display = base.GetComponent <LocalDamageDisplay>();

        if (display != null)
        {
            display.enabled = enable;
        }
    }
Пример #3
0
    void ICameraFX.PreCull()
    {
        this.aim = this.transform.rotation;
        Quaternion quaternion  = Quaternion.identity;
        Quaternion quaternion1 = quaternion;

        this.sub  = quaternion;
        this.@add = quaternion1;
        if (!this._allow)
        {
            LazyCam lazyCam = this;
            lazyCam.enableFraction = lazyCam.enableFraction - Time.deltaTime / this.disableSeconds;
            if (this.enableFraction <= 0f)
            {
                this.enableFraction = 0f;
            }
        }
        else
        {
            LazyCam lazyCam1 = this;
            lazyCam1.enableFraction = lazyCam1.enableFraction + Time.deltaTime / this.enableSeconds;
            if (this.enableFraction >= 1f)
            {
                this.enableFraction = 1f;
            }
        }
        this.maxAngle = Mathf.SmoothDampAngle(this.maxAngle, this.targetAngle * this.enableFraction, ref this.vel, this.damp);
        if (!Mathf.Approximately(this.maxAngle, 0f))
        {
            this.isActivelyLazy = true;
            float single = Quaternion.Angle(this.aim, this.view);
            if (single >= this.maxAngle)
            {
                float single1 = 1f - this.maxAngle / single;
                this.view = Quaternion.Slerp(this.view, this.aim, single1);
            }
            Quaternion quaternion2 = Quaternion.Inverse(this.aim) * this.view;
            quaternion1             = quaternion2;
            this.@add               = quaternion2;
            this.sub                = Quaternion.Inverse(quaternion1);
            this.transform.rotation = this.view;
            this._world2cam         = this.camera.worldToCameraMatrix;
            this._cam2world         = this.camera.cameraToWorldMatrix;
            if (this.hasViewModel)
            {
                this.viewModel.lazyRotation = this.sub;
            }
        }
        else
        {
            this.view = this.aim;
            if (!this._allow)
            {
                base.enabled = false;
            }
            if (this.hasViewModel)
            {
                this.viewModel.lazyRotation = Quaternion.identity;
            }
        }
    }