コード例 #1
0
    public IEnumerator EndGame(bool submitted)
    {
        ScreenFader fader = GameObject.FindObjectOfType <ScreenFader>();

        PlayerPrefs.SetInt(Constants.Prefs.THESIS_SUBMITTED, submitted ? 1 : 0);
        PlayerPrefs.SetFloat(Constants.Prefs.PLAYER_STATUS, status.value);

        yield return(fader.FadeToColor(Constants.Colors.FADE, .5f));

        SceneManager.LoadScene(Constants.Levels.CREDITS);

        yield return(null);
    }
コード例 #2
0
    IEnumerator FadeAndShowDays()
    {
        clock.Pause();
        //Set black?
        fadeImage.enabled = true;
        fadeImage.color   = Color.black;
        //animate days
        yield return(StartCoroutine(FadeInDays(1)));

        yield return(new WaitForSeconds(1));

        StartCoroutine(FadeOutDays(0.5f));
        StartCoroutine(screenFader.FadeToColor(Color.clear, 0.5f));
        clock.Resume();
    }
コード例 #3
0
    IEnumerator Interact()
    {
        Action action = dialogController.currentAction;

        if (action != null && action.active && action.interactable)
        {
            interacting = true;
            mplayer.PlayInteraction();

            walking = false;
            animator.SetBool("walking", walking);

            if (action.tag == Constants.Actions.SUBMIT_THESIS)
            {
                yield return(GameObject.FindObjectOfType <GameManager>().EndGame(true));
            }
            else if (action.tag == Constants.Actions.READ_LETTER)
            {
                interacting   = false;
                action.active = false;

                Action letterAction = gameManager.GetActionWithTag(Constants.Actions.OPENED_LETTER);
                letterAction.text   = Constants.Strings.LETTER_MESSAGE;
                letterAction.active = true;
                interactiveObject   = null;

                dialogController.background.rectTransform.sizeDelta += new Vector2(200, 200);
                dialogController.dialogText.rectTransform.sizeDelta += new Vector2(200, 200);
            }
            else
            {
                if (gameManager.CanExecuteAction(action))
                {
                    if (action.tag == Constants.Actions.SLEEP_NIGHT)
                    {
                        yield return(screenFader.FadeToColor(Constants.Colors.FADE, 0.25f));

                        interactiveObject = null;
                        dialogController.Hide();

                        transform.position = startingPosition;
                        playerOrientation  = PlayerOrientation.Down;

                        UpdatePlayerAnimation(playerOrientation, false);
                        UpdateSpriteZOrder();
                        UpdateStats(action);

                        daysRemaining.ShowRemainingDays();
                        StartCoroutine(DisplayDailyMessage());
                    }
                    else
                    {
                        yield return(screenFader.FadeToColor(Constants.Colors.FADE, 0.25f));

                        UpdateStats(action);
                        yield return(screenFader.FadeToColor(Color.clear, 0.25f));
                    }
                }
                else
                {
                    interacting = false;
                    dialogController.currentAction = null;

                    lastActionInteractable = action.interactable;
                    lastActionText         = action.text;
                    action.interactable    = false;
                    action.text            = Constants.Strings.WAIT_MESSAGE;
                }
            }
        }

        interacting = false;

        yield return(null);
    }