void Start()
        {
            controller = GetComponent <CharacterController>();
            //get the transform of a child with a camera component
            if (!customCameraTransform)
            {
                cam = transform.GetComponentInChildren <Camera>().transform;
            }

            standingHeight = controller.height;
            cameraOffset   = standingHeight - cam.localPosition.y;

            //Handle custom input names
            if (customInputNames)
            {
                jumpBtn        = jumpBtnCustom;
                crouchBtn      = crouchBtnCustom;
                runBtn         = runBtnCustom;
                unlockMouseBtn = unlockMouseBtnCustom;
                xInName        = xInNameCustom;
                yInName        = yInNameCustom;
                xMouseName     = xMouseNameCustom;
                yMouseName     = yMouseNameCustom;
            }

            mouseLocked = startMouseLock;

            controllerInfo = GetInfo();
            ExecuteExtension(ExtFunc.Start);
        }
Ejemplo n.º 2
0
        void Start()
        {
            // get animation controller attached to Player
            anim = gameObject.GetComponentInChildren <Animator>();

            controller = GetComponent <CharacterController>();
            //get the transform of a child with a camera component
            if (!customCameraTransform && !thirdPersonMode)
            {
                cam = transform.GetComponentInChildren <Camera>().transform;
            }

            standingHeight = controller.height;
            cameraOffset   = standingHeight - cam.localPosition.y;

            //Handle custom input names
            if (customInputNames)
            {
                jumpBtn        = jumpBtnCustom;
                crouchBtn      = crouchBtnCustom;
                runBtn         = runBtnCustom;
                unlockMouseBtn = unlockMouseBtnCustom;
                xInName        = xInNameCustom;
                yInName        = yInNameCustom;
                xMouseName     = xMouseNameCustom;
                yMouseName     = yMouseNameCustom;
            }
            if (customInputSystem != null && customInputSystem.useFPSControllerAxisNames)
            {
                customInputSystem.SetAxisNames(jumpBtn, crouchBtn, runBtn, unlockMouseBtn, xInName, yInName, xMouseName, yMouseName);
            }

            if (sprintByDefault)
            {
                running = true;
            }

            if (definedByHeight)
            {
                RecalculateJumpValues();
                originalJT    = maxJumpTime;
                originalMaxJH = maxJumpHeight;
                originalMinJH = minJumpHeight;
            }

            cameraAngle = cam.eulerAngles.y;
            mouseLocked = startMouseLock;

            controllerInfo = GetInfo();
            ExecuteExtension(ExtFunc.Start);
        }
Ejemplo n.º 3
0
 //Executes at the end of the move function at this point all movement for the frame has been handled
 public virtual void ExPostMove(ref TFPData data, TFPInfo info)
 {
 }
Ejemplo n.º 4
0
 //executes at the end of the FixedUpdate function in FPSController.cs. Use for physics interactions
 public virtual void ExPostFixedUpdate(ref TFPData data, TFPInfo info)
 {
 }
Ejemplo n.º 5
0
 //executes at the start of the Update function in FPSController.cs
 public virtual void ExPreUpdate(ref TFPData data, TFPInfo info)
 {
 }
Ejemplo n.º 6
0
 //executes at the end of the Start function in FPSController.cs
 public virtual void ExStart(ref TFPData data, TFPInfo info)
 {
 }
Ejemplo n.º 7
0
 //executes after input is retrieved, allows you to override input behaviour, useful for things like disabling jumping or running
 public virtual void ExPostInput(ref TFPData data, TFPInfo info)
 {
 }
Ejemplo n.º 8
0
 //Executes before movement is calculated but after input is processed. This is useful if you want to modify variables that will be used in movement calculation
 public virtual void ExPreMoveCalc(ref TFPData data, TFPInfo info)
 {
 }