void Awake() { Cursor.lockState = CursorLockMode.Locked; //Locks the cursor to the centre of the screen Cursor.visible = false; //Makes the cursor invisible invertX = false; //Sets the Invert value to False (Default State of camera's X-Rotation) invertY = false; //Sets the Invert value to False (Default State of camera's Y-Rotation) distance = maxDistance; GameObject player = GameObject.FindGameObjectWithTag("Player"); //Finds a GameObject with the tag 'Player' GameObject canvas = GameObject.Find("Canvas"); //Finds a GameObject with the name 'Canvas' playerControl = player.GetComponent <PlayerControllerRigid>(); //Sets playerControl Equal to the Script attached to the 'player' GameObject menuManage = canvas.GetComponent <MenuManager>(); //Sets menuManage Equal to the Script attached to the 'canvas' GameObject }
// Start is called before the first frame update void Awake() { canSeePlayer = false; animator = GetComponent <Animator>(); guardSFX = GetComponent <AudioSource>(); player = GameObject.FindWithTag("Player").transform; //Find the location of the player nav = GetComponent <NavMeshAgent>(); //Activate Navmesh component playerController = playerObject.GetComponent <PlayerControllerRigid>(); //initialise the path points myPathPoints = new List <GameObject>(); //find path points as children myPathPoints = myPath.GetChildren(); alertSound = true; }