Пример #1
0
 public MessageBox(ScreenState screenState, TimedDialogue message, int timeout)
     : base(0, 0, 0, 0)
 {
     ScreenState = screenState;
     Message = message;
     Timer = new Timer(timeout);
 }
Пример #2
0
 public MessageBox(ScreenState screenState, TimedDialogue message, int timeout)
     : base(0, 0, 0, 0)
 {
     ScreenState = screenState;
     Message     = message;
     Timer       = new Timer(timeout);
 }
Пример #3
0
        public void ShowMessage(TimedDialogue message, int timeout = MessageBox.DEFAULT_TIMEOUT)
        {
            ScreenState screenState = new ScreenState
            {
                Width  = _oldWidth,
                Height = _oldHeight
            };

            MessageBox = new MessageBox(screenState, message, timeout);
        }
Пример #4
0
    private void PlayingStage(Stage stage)
    {
        if (sortedStageDialogue.Any() && sortedStageDialogue.Peek().time <= timer)
        {
            TimedDialogue dialogue = sortedStageDialogue.Pop();

            Text textObject = dialoguePanel.GetComponentInChildren <Text>();
            textObject.text  = dialogue.text;
            textObject.color = dialogue.color;

            dialoguePanel.SetActive(true);

            // Hide text after duration
            if (deactivateDialogueCoroutine != null)
            {
                StopCoroutine(deactivateDialogueCoroutine);
            }
            deactivateDialogueCoroutine = StartCoroutine(DeactivateAfterSeconds(dialoguePanel, dialogue.duration));
        }

        if (sortedStageNotes.Any() && sortedStageNotes.Peek().time <= timer)
        {
            TimedNote note = sortedStageNotes.Pop();
            if (!string.IsNullOrEmpty(note.note) && noteSpawnPositions.Any())
            {
                var noteTarget = Instantiate(noteTargetPrefab, new Vector3(noteTargetXStartOffset, noteSpawnPositions[note.note]), Quaternion.identity);
                noteTarget.GetComponent <SpriteRenderer>().size = new Vector2(noteTargetXScale * note.duration, 1);
                noteTarget.GetComponent <Rigidbody2D>().AddForce(new Vector2(noteTargetSpeed, 0));
                spawnedNotes.Add(noteTarget);
            }
        }

        // If all tracks are done playing, stage is over
        if (!sortedStageNotes.Any() && !sortedStageDialogue.Any() && audioSourceTracks.All(a => !a.isPlaying))
        {
            // Check if we won, otherwise restart
            if (spawnedNotes.All(s => s.GetComponent <NoteTargetController>().hit))
            {
                state = GameState.PassStage;
            }
            else
            {
                state = GameState.InitStage;
            }
        }
    }
Пример #5
0
 public MessageBox(ScreenState screenState, TimedDialogue message)
     : this(screenState, message, DEFAULT_TIMEOUT)
 {
 }
Пример #6
0
        public void ShowMessage(TimedDialogue message, int timeout = MessageBox.DEFAULT_TIMEOUT)
        {
            ScreenState screenState = new ScreenState
            {
                Width = _oldWidth,
                Height = _oldHeight
            };

            MessageBox = new MessageBox(screenState, message, timeout);
        }
Пример #7
0
 public MessageBox(ScreenState screenState, TimedDialogue message)
     : this(screenState, message, DEFAULT_TIMEOUT)
 {
 }