/// <summary> /// Update method /// </summary> void Update() { // Sets the _currentNpc to the player's GetNPC, that will check which NPC we are looking at _currentNpc = player.GetNPC(); // An if to check if the npc we are looking at is the guard and if the state is GivesClue if (_currentNpc != null && _currentStateGuard == NPCState.State_GivesClue && _currentNpc.gameObject.layer == LayerMask.NameToLayer("Guard")) { // Moves the guard so the player can pass through _currentNpc.transform.position = new Vector3(-161.78f, 1.91f, -25.3f); } // An if to check the input of the player if (Input.GetMouseButtonDown(0)) { // Calls the DefineState() method DefineState(); } // If the repice is active if (_npc2.transform.GetChild(1).gameObject.activeSelf == true) { // Will show the the recipe on the canvas _canvasManager.ShowRecipePage(); } // Calls CheatMode() CheatMethod(); }
/// <summary> /// Method that will hide the Npc's name /// </summary> private void ClearNpc() { // Sets currentNpc to null _currentNpc = null; // Hides the npc's name _canvasManager.HideNpcName(); }
/// <summary> /// Method that will set the NPCs /// </summary> /// <param name="newNpc"></param> private void SetNpc(NPCActions newNpc) { // Sets the currentNPC to newNpc _currentNpc = newNpc; // Shows the npc's name _canvasManager.ShowNpcName(_currentNpc.npcName); }
// Start is called before the first frame update public void ReadJSON() { actionList = new List <NPCAction>(); actionsInJson = JsonUtility.FromJson <NPCActions>(jsonFile.text); for (int i = 0; i < actionsInJson.actions.Length; i++) { actionList.Add(actionsInJson.actions[i]); // does this work } }
/// <summary> /// Bool method that wull check if the player has the NPC, needed for the sister's mission /// </summary> /// <param name="sister"></param> /// <returns></returns> public bool HasNPC(NPCActions sister) { for (int i = 0; i < sister.actionRequirements.Length; ++i) { if (sister.actionRequirements[i].isFollower == true) { return(false); } } return(true); }
/// <summary> /// Start method /// </summary> private void Start() { // Sets the _canvasManager to CanvasManager's instance _canvasManager = CanvasManager.instance; // Sets _camera to the player's camera _camera = GetComponentInChildren <Camera>(); // Sets it at null _currentInteractible = null; // Sets it at null _currentNpc = null; // Instanciates the list _inventory = new List <Interactible>(inventorySize); }
/// <summary> /// Method that will check for NPCs /// </summary> private void CheckForNPC() { if (Physics.Raycast(_camera.transform.position, _camera.transform.forward, out _raycastHit, maxInteractionDistance)) { NPCActions newNpc = _raycastHit.collider.GetComponent <NPCActions>(); if (newNpc != null) { SetNpc(newNpc); } else { ClearNpc(); } } else { ClearNpc(); } }
/// <summary> /// NPC_Action's method tht returns the current NPC /// </summary> /// <param name="npc"></param> /// <returns></returns> public NPCActions GetNPC(NPCActions npc) { return(_currentNpc); }