// Use this for initialization void Start() { playerController = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerControllerFinal>(); lookRotation = playerController.GetComponent <LookRotation>(); //It remembers that player controller is that object so it gets a diferent component from the same object. mouse = new MouseCursor(); mouse.Hide(); gameManager = GetComponent <GameManager>(); }
// Use this for initialization protected virtual void Start() { agent = GetComponent <NavMeshAgent>(); SetIdle(); nodes = nodesParent.GetComponentsInChildren <Transform>(); sound = GetComponent <SoundPlayer>(); barkInterval = Random.Range(2.5f, 10.75f); playerController = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerControllerFinal>(); playerTransform = playerController.GetComponent <Transform>(); }