コード例 #1
0
        // Awake
        void Awake()
        {
            m_Transform     = transform;
            cameraTransform = m_Transform.parent.GetComponentInChildren <Camera>().transform; //Camera

            m_Controller        = this.GetComponent <CharacterController>();
            m_Controller.center = Vector3.up;
            nativeCapsuleHeight = m_Controller.height;

            m_Input      = this.GetComponent <FirstPersonInput>();
            m_camHeadBob = this.GetComponent <CameraHeadBob>();
            m_fssManager = this.GetComponent <FootStepSoundsManager>();

            m_Audio = this.GetComponent <AudioSource>();
            if (m_Audio != null)
            {
                m_Audio.playOnAwake  = false;
                m_Audio.loop         = false;
                m_Audio.spatialBlend = 1f;
            }

            nativeRotation             = cameraTransform.localRotation;
            nativeRotation.eulerAngles = new Vector3(0f, cameraTransform.eulerAngles.y, 0f);
        }
コード例 #2
0
        // Awake
        void Awake()
        {
            m_Transform = transform;
            cameraTransform = m_Transform.parent.GetComponentInChildren<Camera>().transform; //Camera

            m_Controller = this.GetComponent<CharacterController>();
            m_Controller.center = Vector3.up;
            nativeCapsuleHeight = m_Controller.height;

            m_Input = this.GetComponent<FirstPersonInput>();
            m_camHeadBob = this.GetComponent<CameraHeadBob>();
            m_fssManager = this.GetComponent<FootStepSoundsManager>();

            m_Audio = this.GetComponent<AudioSource>();
            if (m_Audio != null) {
                m_Audio.playOnAwake = false;
                m_Audio.loop = false;
                m_Audio.spatialBlend = 1f;
            }

            nativeRotation = cameraTransform.localRotation;
            nativeRotation.eulerAngles = new Vector3( 0f, cameraTransform.eulerAngles.y, 0f );
        }