Exemplo n.º 1
0
    public IEnumerator displayMultipleChoiceQuestionCR(string message, string[] options, string[] buttons)
    {
        text = gameObject.GetComponentInChildren <Text>();
        string fullMessage = message;

        for (int i = 0; i < options.Length; i++)
        {
            fullMessage += "\n" + buttons[i] + "  " + options[i];
        }
        text.text = fullMessage;


        CanvasGroup cg = GetComponent <CanvasGroup>();

        cg.alpha = 1f;
        GSCoroutine <string> buttonPress = new GSCoroutine <string>(this, GetButtonPressCR(buttons));

        yield return(buttonPress.result);

        while (buttonPress.result == null)
        {
            yield return(null);
        }
        while (cg.alpha > 0.05f)
        {
            cg.alpha = Mathf.Lerp(cg.alpha, 0, fadeSpeed * Time.deltaTime);
            yield return(buttonPress.result);
        }
        cg.alpha = 0f;
        yield return(buttonPress.result);
    }
Exemplo n.º 2
0
    IEnumerator MovePhase()
    {
        GS.displayInfoMessage(displayName() + " has entered the move phase.");
        gameBoard.getPossibleMoves(this);
        while (true)
        {
            io.startHoverInfo();
            GSCoroutine <GameObject> clickedGSC = io.getClickedGameObject("_VillageTile");
            yield return(clickedGSC.coroutine);

            while (clickedGSC.result == null)
            {
                yield return(null);
            }
            GridSpace   targetgs = clickedGSC.result.GetComponent <GridSpace>();
            VillageTile vt       = targetgs.VillageTile;
            string      target   = vt.tilename;


            if (gameBoard.movePlayer(this, target))
            {
                GS.displayInfoMessage(displayName() + " is moving to " + target);
                break;
            }
            else
            {
                GS.displayWarnMessage(displayName() + " cannot go there");
            }

            yield return(null);
        }
        GS.displayInfoMessage(displayName() + " has finished the move phase.");
    }
Exemplo n.º 3
0
    IEnumerator VillagerPhase()
    {
        VillageTile currentTile = gameBoard.getCurrentTile(this);

        string[]             options = new string[] { "Request help from " + currentTile.tilename, "Attempt Exorcism", "Pass" };
        string[]             buttons = new string[] { "A", "X", "B" };
        GSCoroutine <string> mcq     = io.getButtonPressDialog("What would you like to do?", options, buttons);

        yield return(mcq.coroutine);

        GS.displayInfoMessage(mcq.result);
        switch (mcq.result)
        {
        case "A":
            GS.displayInfoMessage(currentTile.tilename + " is busy, try again later.");
            break;

        case "X":
            yield return(StartCoroutine(gameBoard.attemptExorcism(this)));

            break;

        case "B":
            GS.displayInfoMessage("Passing turn");
            break;
        }
        yield return(new WaitForSeconds(1f));
    }
Exemplo n.º 4
0
    IEnumerator drawGhost()
    {
        Ghost ghost = playerManager.drawGhost();

        io.displayCurrentActionInfo(ghost.GhostName + "\nColor: " + ghost.color + "\nResistance: " + ghost.Resistance);
        while (true)
        {
            GSCoroutine <GameObject> clickedGSC = io.getClickedGameObject("_PlayerBoardSpace");
            yield return(clickedGSC.coroutine);

            while (clickedGSC.result == null)
            {
                yield return(null);
            }
            PlayerBoardSpace pbs = clickedGSC.result.GetComponent <PlayerBoardSpace>();
            if (!pbs.hasGhost())
            {
                pbs.addGhost(ghost);
                break;
            }
            else
            {
                yield return(StartCoroutine(io.displayNotificationMessage("You must choose an empty space!")));
            }
            yield return(null);
        }
        io.clearCurrentActionInfo();
    }