public void ShowDialogues(bool restart = false) { gameObject.SetActive(true); if (restart) { _currentLineIndex = 0; } MainManager.ShowOnly(transform.GetChild(_currentLineIndex).gameObject); }
public void SetNewSnaps(List <DungeonSequenceObject> sequences, List <string> eqippedItems) { if (!_inited) { // Set click-events for button _snapTargetButton.onClick.AddListener(OnSnapClick); _inited = true; } _successfulAdventure = true; List <Sprite> snapList = new List <Sprite>(); for (var i = 0; i < sequences.Count; i++) { DungeonSequenceObject s = sequences[i]; snapList.Add(s.BeforeSequenceSnap); // Matching item if (s.CorrectItemName == eqippedItems[i]) { snapList.Add(s.AfterSequenceSnap); print($"{s.TrapName} was successful"); } else { print($"{s.TrapName} failed"); _successfulAdventure = false; snapList.Add(GoblinSnaps[Random.Range(0, GoblinSnaps.Length - 1)]); break; } } if (_successfulAdventure) { snapList.Add(WinSnap); } _newSnaps = new Stack <Sprite>(); for (int i = snapList.Count - 1; i >= 0; i--) { Sprite sprite = snapList[i]; _newSnaps.Push(sprite); } FindObjectOfType <AudioManager>().PlayAudio(Vibrate); _nextButton.interactable = false; MainManager.ShowOnly(_snapTrapScreen); SnapImage.color = Color.clear; }
public void NextLine() { ShowDialogues(); _currentLineIndex++; MainManager.ShowOnly(transform.GetChild(_currentLineIndex).gameObject); }