// Use this for initialization
 private void Start()
 {
     _characterController = GetComponent<CharacterController>();
     _camera = Camera.main;
     _originalCameraPosition = _camera.transform.localPosition;
     _cameraRefocus = new CameraRefocus(_camera, transform, _camera.transform.localPosition);
     _fovKick.Setup(_camera);
     _headBob.Setup(_camera, _stepInterval);
     _stepCycle = 0f;
     _nextStep = _stepCycle/2f;
     _jumping = false;
 }
        // Use this for initialization
        private void Start()
        {
            currentWeapon = 0;
            previousWeapon = 0;
            _characterController = GetComponent<CharacterController>();
            _camera = Camera.main;
            _originalCameraPosition = _camera.transform.localPosition;
            _cameraRefocus = new CameraRefocus(_camera, transform, _camera.transform.localPosition);
            _fovKick.Setup(_camera);
            _headBob.Setup(_camera, _stepInterval);
            _stepCycle = 0f;
            _nextStep = _stepCycle/2f;
            _jumping = false;
            gameObject.GetComponents<AudioSource>()[3].clip = breathingFastSound;
            NM = GameObject.Find("NetworkManager").GetComponent<NetworkManager>(); 
			_mouseLook.XSensitivity = PlayerPrefs.GetFloat ("xAxis");
			_mouseLook.YSensitivity = PlayerPrefs.GetFloat ("yAxis");
			_mouseLook.smooth = (PlayerPrefs.GetInt("smooth") != 0);
			mouseTempX = _mouseLook.XSensitivity;
			mouseTempY = _mouseLook.YSensitivity;

			//players = GameObject.FindGameObjectsWithTag("Player");
			// get the transform of the main camera
			if (Camera.main != null)
			{
				cam = Camera.main.transform;
			}
			else
			{
				Debug.LogWarning(
					"Warning: no main camera found. Third person character needs a Camera tagged \"MainCamera\", for camera-relative controls.");
				// we use self-relative controls in this case, which probably isn't what the user wants, but hey, we warned them!
			}
            //initlize a weapon when spawned default 0 (AK)
            SelectWeapon(0);
		}
Example #3
0
 private void Start()
 {
     motionBob.Setup(_camera, StrideInterval);
     originalCameraPosition = _camera.transform.localPosition;
     cameraRefocus = new CameraRefocus(_camera, transform.root.transform, _camera.transform.localPosition);
 }
 // Use this for initialization
 private void Start()
 {
     m_CharacterController = GetComponent<CharacterController>();
     m_Camera = Camera.main;
     m_OriginalCameraPosition = m_Camera.transform.localPosition;
     m_CameraRefocus = new CameraRefocus(m_Camera, transform, m_Camera.transform.localPosition);
     m_FovKick.Setup(m_Camera);
     m_HeadBob.Setup(m_Camera, m_StepInterval);
     m_StepCycle = 0f;
     m_NextStep = m_StepCycle/2f;
     m_Jumping = false;
     m_AudioSource = GetComponent<AudioSource>();
     m_MouseLook.Init(transform , m_Camera.transform);
 }