void Start() { m_player = GameObject.FindGameObjectWithTag("Player"); if (m_player == null) { print("Couldnt Find Player"); Destroy(this); return; } pRigidbody = m_player.GetComponent <Rigidbody>(); pAttach = m_player.GetComponent <scr_attachRopeTo>(); DGTT = m_player.GetComponent <DontGoThroughThings>(); pInput = m_player.GetComponent <scr_ThirdPersonUserControl>(); pMove = m_player.GetComponent <scr_ThirdPersonCharacter>(); }
private void Start() { // get the transform of the main camera if (Camera.main != null) { m_Cam = Camera.main.transform; 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! } // get the third person character ( this should never be null due to require component ) m_Character = GetComponent <scr_ThirdPersonCharacter>(); m_arrowSpawnpoint = GameObject.FindGameObjectWithTag("arrowSpawnPoint").transform; m_player = GameObject.FindGameObjectWithTag("Player"); m_rgd = gameObject.GetComponent <Rigidbody>(); m_audioManager = Camera.main.GetComponent <scr_AudioManager>(); m_psm = m_player.GetComponent <scr_PSM>(); }