Example #1
0
        private void Awake()
        {
            camera = camera != null ? camera : Camera.main;

            _cameraController      = GetComponent <CameraController>();
            _movementController    = GetComponent <MovementController>();
            _playerInputController = GetComponent <PlayerInputController>();

            _cameraController.Initialize();
            _movementController.Initialize();
        }
Example #2
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;
        }
Example #3
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!");
            }
        }