Esempio n. 1
0
    public void SortContainer(BaseContainer container)
    {
        if (container as DialogueContainer != null)
        {
            StartCoroutine(ShowText((DialogueContainer)container));
        }

        else if (container as ChoiceContainer != null)
        {
            StartCoroutine(ShowChoice((ChoiceContainer)container));
        }

        else if (container as SplitDialogueContainer != null)
        {
            SplitDialogueContainer c = (SplitDialogueContainer)container;

            switch (choiceManager.CheckChoice(c.choiceNumber))
            {
            default:
            case 1:
                StartCoroutine(ShowText(c.result1));
                break;

            case 2:
                StartCoroutine(ShowText(c.result2));
                break;
            }
        }
    }
    IEnumerator WatchDoor()
    {
        if (choiceManager.CheckChoice(7) == 1)
        {
            gameManager.GameState = Enums.GameState.cutscene;

            base.Interact();

            yield return(new WaitUntil(() => Input.GetKeyDown(gameManager.playerConfig.interactKey)));

            yield return(new WaitUntil(() => Input.GetKeyDown(gameManager.playerConfig.interactKey)));

            yield return(new WaitUntil(() => Input.GetKeyDown(gameManager.playerConfig.interactKey)));

            SpriteRenderer doorSr = door.GetComponentInChildren <SpriteRenderer>();

            doorSr.color = new Color(doorSr.color.r, doorSr.color.g, doorSr.color.b, 1f);

            vcam.Follow = door.transform;

            yield return(new WaitForSeconds(2f));


            vcam.Follow = player.transform;

            yield return(new WaitForSeconds(0.5f));

            gameManager.GameState = Enums.GameState.playing;
        }

        else
        {
            gameManager.GameState = Enums.GameState.cutscene;
            vcam.Follow           = door.transform;

            yield return(new WaitForSeconds(1f));

            float temp = 0f;

            SpriteRenderer doorSr = door.GetComponentInChildren <SpriteRenderer>();
            while (temp < 1)
            {
                temp += 0.005f;

                doorSr.color = new Color(doorSr.color.r, doorSr.color.g, doorSr.color.b, temp);
                yield return(null);
            }
            yield return(new WaitForSeconds(0.5f));

            vcam.Follow = player.transform;

            yield return(new WaitForSeconds(0.5f));

            gameManager.GameState = Enums.GameState.playing;


            base.Interact();
        }
    }
    protected override void Awake()
    {
        base.Awake();

        gameManager   = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>();
        choiceManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <ChoiceManager>();

        if (choiceManager.CheckChoice(7) != 1)
        {
            player.GetComponent <PlayerController>().hasPartner = false;
            partner.gameObject.SetActive(false);
        }
    }