Esempio n. 1
0
        public void Initialize()
        {
            _fpsController         = GetComponent <FPSController>();
            _playerInputController = GetComponent <PlayerInputController>();

            _cameraTransform       = _fpsController.camera.transform;
            _targetCameraTransform = _fpsController.targetCameraTransform;

            _cameraTransform.SetParent(_targetCameraTransform.transform);
            _cameraTransform.localPosition    = Vector3.zero;
            _cameraTransform.localEulerAngles = Vector3.zero;
        }
Esempio n. 2
0
        public void Initialize()
        {
            _fpsController = GetComponent <FPSController>();

            _playerInputController = GetComponent <PlayerInputController>();

            capsuleCollider = capsuleCollider != null
                ? capsuleCollider
                : transform.GetChild(0).GetComponent <CapsuleCollider>();
            rb = rb != null ? rb : GetComponent <Rigidbody>();

            rb.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ |
                             RigidbodyConstraints.FreezeRotationY;

            if (jumpGroundLayer == gameObject.layer)
            {
                Debug.LogError("Player SortingLayer must be different from Ground Sorting Layer!");
            }
        }