Exemple #1
0
 void Start()
 {
     component_CameraLook = transform.GetChild(0).gameObject.GetComponent <FPS_CameraLook>();
     component_Jump       = GetComponent <FPS_Jump>();
     component_Locomotion = GetComponent <FPS_Locomotion>();
     component_Crouch     = GetComponent <FPS_Crouch>();
 }
Exemple #2
0
    void Start()
    {
        LocomotionModule = GetComponent <FPS_Locomotion>();                      //assign GetComponent() calls to our previously declared variables
        JumpModule       = GetComponent <FPS_Jump>();
        CapsuleModule    = GetComponent <CapsuleCollider>();

        fps_camera = LocomotionModule.fps_camera;                                                            //FPS_Locomotion has already defined fps_camera variable, so we're going to store it here

        camera_initPos   = fps_camera.transform.localPosition;                                               //store player's camera LOCAL position (because our player camera is the child of player object, we must store and modify only LOCAL position)
        camera_crouchPos = new Vector3(camera_initPos.x, camera_initPos.y - crouchAmount, camera_initPos.z); //based on camera's initial LOCAL position, we calculate and store the position of the camera when player crouches
    }
Exemple #3
0
    private FPS_Locomotion LocomotionModule;                                //an internal variable used to store Player's Locomotion Script at runtime

    private void Start()
    {
        LocomotionModule = GetComponent <FPS_Locomotion>();                  //assign player's locomotion script to LocomotionModule
    }