Ejemplo n.º 1
0
        private void Start()
        {
            playerMotor          = GetComponent <PlayerMotor>();
            controller           = GetComponent <CharacterController>();
            headBobber           = GetComponent <HeadBobber>();
            mainCamera           = GameManager.Instance.MainCamera;
            crouchChangeDistance = (standHeight - crouchHeight) / 2f;
            //rideChangeDistance = (rideHeight - standHeight) / 2f - eyeHeight;
            camCrouchLevel = crouchHeight / 2f;
            camStandLevel  = standHeight / 2f;
            camRideLevel   = rideHeight / 2f - eyeHeight;

            // Use event to set whether player is crouched on load
            SaveLoadManager.OnStartLoad += SaveLoadManager_OnStartLoad;
        }
Ejemplo n.º 2
0
        private void Start()
        {
            playerMotor          = GetComponent <PlayerMotor>();
            controller           = GetComponent <CharacterController>();
            headBobber           = GetComponent <HeadBobber>();
            mainCamera           = GameManager.Instance.MainCamera;
            levitateMotor        = GetComponent <LevitateMotor>();
            camSwimLevel         = controllerSwimHeight / 2f;
            camCrouchLevel       = controllerCrouchHeight / 2f;
            camStandLevel        = controllerStandHeight / 2f;
            camRideLevel         = controllerRideHeight / 2f - eyeHeight;
            camSwimToCrouchDist  = (controllerCrouchHeight - controllerSwimHeight) / 2f;
            camCrouchToStandDist = (controllerStandHeight - controllerCrouchHeight) / 2f;
            camStandToRideDist   = (controllerRideHeight - controllerStandHeight) / 2f;

            // Use event to set whether player is crouched on load
            SaveLoadManager.OnStartLoad += SaveLoadManager_OnStartLoad;
        }
Ejemplo n.º 3
0
        private void Start()
        {
            playerMotor  = GetComponent <PlayerMotor>();
            controller   = GetComponent <CharacterController>();
            headBobber   = GetComponent <HeadBobber>();
            mainCamera   = GameManager.Instance.MainCamera;
            rideHeight   = playerMotor.ridingHeight;
            standHeight  = playerMotor.standingHeight;
            crouchHeight = playerMotor.crouchingHeight;
            eyeHeight    = playerMotor.eyeHeight;

            crouchChangeDistance = (standHeight - crouchHeight) / 2f;
            rideChangeDistance   = (rideHeight - standHeight) / 2f - eyeHeight;
            // local positions for camera at each height level
            // TODO: Make sure assumption isn't wrong that camera begins at correct standing position height
            camStandLevel  = mainCamera.transform.localPosition.y; //With the assumption that the camera begins at correct standing position height
            camCrouchLevel = camStandLevel - crouchChangeDistance; //we want the camera to lower the same amount as the character
            camRideLevel   = camStandLevel + rideChangeDistance;
        }