// Use this for initialization void Start() { playerController = GetComponent <FP_Controller>(); footSteps = GetComponent <FP_FootSteps>(); playerInput = GetComponent <FP_Input>(); originalLocalPos = headBob.MainCamera.localPosition; if (GetComponent <AudioSource>() == null) { // we automatically add an audiosource, if one has not been manually added. // (if you want to control the rolloff or other audio settings, add an audiosource manually) gameObject.AddComponent <AudioSource>(); } prevPosition = transform.position; audioSource = GetComponent <AudioSource>(); }
void Awake() { controller = GetComponent <CharacterController>(); playerInput = GetComponent <FP_Input>(); footSteps = GetComponent <FP_FootSteps>(); }