private void OnTriggerEnter2D(Collider2D collision) { if (!toggled) { if (collision.gameObject.tag.Equals("Player")) { dialog.TriggerDialog(); shDialog.ShowHideToggle(dialogBox); toggled = true; } } }
// Update is called once per frame void Update() { if (waitingOnDialog) { return; } if (dialogDataLoaded) { // Dialog has been loaded if (storyQueue.Count != 0) { // We have more story elements in the queue StoryElement se = storyQueue.Dequeue(); if (se.zoomIn) { // Set position here //se.zoomToPosition; } // Let the Player Move script know we need to // disable controls if the Story Element wants to disableControls = se.DisableControls(); if (disableControls) { PlayerMove playerMove = gameObject.GetComponent <PlayerMove>(); playerMove.DisableMove(); } // Tell the Story Element notify the Dialog Manager // to begin loading dialog attached to this element se.TriggerDialog(); waitingOnDialog = true; } else { // consume (DESTROY) the dialog after processing Destroy(dialogToDestroy); storyQueue = new Queue <StoryElement>(); dialogDataLoaded = false; waitingOnDialog = false; } } }