public override void Interact() { if (destroyed) { return; } SceneSaver.Instance.AddUsed(this.name); Logger.Log($"interacting with {EntityName}"); if (runScriptOnInteraction) { LuaScript.Execute(script); } if (runYarnProgramOnInteraction) { FindObjectOfType <DialogueRunner>().StartDialogue(yarnNodeToStart); } if (destroyOnInteraction) { SceneSaver.Instance.AddDestroyed(this.name); destroyed = true; Destroy(this.gameObject); } }
// it means that journal has little notes in it private void DrawNoteText(string text) { Logger.Log($"drawing text in note"); noteText.text = text; counterText.text = $"{currentNoteIndex + 1}/{_currentCollection.notes.Length}"; }
public override void Interact() { Debug.Log("saving player position..."); SceneSaver.Instance.SavePlayerPositionAtScene(SceneManager.GetActiveScene().name, GameManager.Instance.GetPlayerPosition()); Logger.Log("LoadScene DevLocation"); SceneManager.LoadScene(leadsTo); }
private void OnTriggerExit2D(Collider2D other) { Logger.Log("Trigger", "Player->OnTriggerExit2D"); #if UNITY_EDITOR interactableEntity?.StopHighlighting(); #endif interactableEntity = null; }
public override void StartTalking() { state = NPCState.Talking; Logger.Log("[NPC] StartTalking()"); if (shouldExecScript) { LuaScript.Execute(dialogueScript); } }
public override void Interact() { Logger.Log($"picking up {itemId}"); // disable everything so we could dodge exceptions i guess GetComponent <SpriteRenderer>().enabled = false; GetComponent <BoxCollider2D>().enabled = false; Destroy(this); GameManager.Instance.AddItemToInventory(itemId); }
public override void Interact() { Logger.Log($"Using computer {id}"); ComputerUI.Instance.Context = this; if (locked) { // TODO: send computers id or object cause it looks like doesn't even know about // computer that player might wanna hack StartCoroutine(ComputerUI.Instance.DrawOnLockedMenu()); } }
private void DrawNoteOfCharacter(string character) { foreach (NoteCollection coll in _currentJournal.collections) { if (coll.character != character) { continue; } Logger.Log($"found {character}'s notes"); _currentCollection = coll; } DrawNoteText(_currentCollection.notes[currentNoteIndex].text); }
void Update() { // TODO: there is not only pc version but also smartphone one // use either click/tocuh either some big button with "USE" text if (Input.GetKeyDown(KeyCode.E)) //interact with something { player.Interact(); } // TODO: show inventory in UI else if (Input.GetKeyDown(KeyCode.I)) { Logger.Log("===INVENTORY==="); foreach (var item in _playerInventory) { Logger.Log("ITEM " + item); } Logger.Log("===INVENTORY END==="); } // TODO: maybe create menu for that else if (Input.GetKeyDown(KeyCode.C)) { StartCoroutine(DialogueScript.Instance.StartDialogue("1a")); } else if (Input.GetKeyDown(KeyCode.Escape)) { StartCoroutine(WaitAndQuit()); } else if (Input.GetKeyUp(KeyCode.Escape)) { _quitByEsc = false; } else if (Input.GetKeyUp(KeyCode.Space)) { var runner = FindObjectOfType <DialogueRunner>(); if (runner.IsDialogueRunning) { FindObjectOfType <DialogueUI>().MarkLineComplete(); } } }
private void OnTriggerEnter2D(Collider2D other) { Logger.Log("Trigger", "Player->OnTriggerEnter2D"); interactableEntity = other.GetComponent <Entity>(); if (interactableEntity is null) { Logger.Warning("didnt find interactableEntity, some entity either not interactable either something went wrong"); return; } _interactableTag = other.tag; #if UNITY_EDITOR interactableEntity?.Highlight(); #endif }
public IEnumerator ExecuteCommand(string commandLine) { var splittedCommand = commandLine.Split(':'); var command = splittedCommand[0]; var arg = splittedCommand[1]; // for now there is only 1 argument Logger.Log($"Executing {command} in dialogue"); // TODO: use strategy switch (command) { case "pause": yield return(StartCoroutine(PauseDialogue(float.Parse(arg)))); break; default: break; } }
public void SayPhrase(string characterName, string phrase) { if (!IsInTalkingMode) { DialogueCanvas.Instance.OnTalkingStarted(); } var characters = FindObjectsOfType <MonoBehaviour>().OfType <ICharacter>(); //use some caching or whatever var foundCharacter = FindCharacter(characterName); var found = foundCharacter != null; if (!found) { Logger.Error($"Something went wrong, cant find {characterName} in the scene; will skip line `{phrase}`"); return; } DialogueCanvas.Instance.DrawPhrase(foundCharacter, phrase, singlePhrase: !IsInTalkingMode); }
public void ShowJournal() { if (isShown) { return; } isShown = true; buttonLayout.gameObject.SetActive(true); if (_currentJournal == null) { return; } GameEvent.current.NewFrontInterfaceShown(); foreach (var character in _currentJournal.characters) { var newButton = buttonLayout.AddButton(character); newButton.onClick.AddListener(() => { Logger.Log($"pressing button - character = {character}"); currentNoteIndex = 0; DrawNoteOfCharacter(character); }); } // TODO: fix repeating the same lines noteBackground.gameObject.SetActive(true); noteText.gameObject.SetActive(true); buttonClose.gameObject.SetActive(true); DrawNoteText(_currentJournal.collections[0].notes[0].text); }
public void EndedDialogue() { onDialogueEnded?.Invoke(); Logger.Log("onDialogueEnded()"); }
public void AddNewInteractionVariable(string variable) { Logger.Log("State", $"Added {variable} to game state"); _gameplayVars.Add(variable); }
public void DeleteFromInventory(string itemName) { _playerInventory.Remove(itemName); Logger.Log("Inventory", $"Deleted {itemName} from inventory"); }
public void AddItemToInventory(string itemName) { _playerInventory.Add(itemName); Logger.Log("Inventory", $"Added {itemName} to inventory"); }
void Quit() { Logger.Log("Bye!"); Application.Quit(); }
public override void Interact() { //actually call something that shows inventory Logger.Log("Interactable", "Looking 4 something in shelf..."); }
public override void StopTalking() { state = NPCState.DoingNothing; Logger.Log("[NPC] StopTalking()"); }
public void StartedDialogueWithEva() { onDialogueWithEvaStarted?.Invoke(); Logger.Log("onDialogueWithEvaStarted()"); }
public void OnTalkingStarted() { Logger.Warning("[DialogueCanvas] OnTalkingStarted()"); dialogueImage.gameObject.SetActive(true); }
public void NewFrontInterfaceShown() { onNewFrontInterfaceShown?.Invoke(); Logger.Log("NewFrontInterfaceShown()"); }
public void NewFrontInterfaceClosed() { onNewFrontInterfaceClosed?.Invoke(); Logger.Log("NewFrontInterfaceClosed()"); }
public void OnTalkingEnded() { Logger.Warning("[DialogueCanvas] OnTalkingEnded()"); dialogueImage.gameObject.SetActive(false); }
public void EnteredTrigger() { onTriggerEnter?.Invoke(); Logger.Log("onTriggerEnter()"); }