示例#1
0
    public void OnClick()
    {
        buttonPresses++;

        if (buttonPresses % 2 == 1)
        {
            // Toggles Hand off
            sceneChangeScript.CompletelyOnOff(false, false, true, false);

            // Deactivate decay button
            maincanvas.transform.Find("DecayButton").GetComponent <Button>().enabled = false;

            // Change button text
            transform.Find("Text").GetComponent <Text>().text = "Start Turn";
        }

        else
        {
            // Start change turn procedure
            gameController.ChangeTurn();

            // Toggle interactability and viewability of all objects back on (except decay)
            sceneChangeScript.ToggleInteract(true, true, true, false);
            sceneChangeScript.CompletelyOnOff(true, false, true, false);

            // Deactivate button
            gameObject.SetActive(false);
        }
    }
示例#2
0
    public void EndTurn()
    {
        /* Initiates sequence of events following end of turn.
         * Called whenever a turn-ending action is performed. */

        // Update texts
        SetHandText(); SetCookButtonText(); SetStickButtonText(); SetScoreText();

        // If decay has more than four cards in it, discard.
        if (Decay.Count == 4)
        {
            List <GameObject> DecayCopy = new List <GameObject>(Decay);
            foreach (GameObject card in DecayCopy)
            {
                Decay.Remove(card);
                Destroy(card);
            }
        }

        // Move a card to the decay and make sure it's inactive
        GameObject decayCard = Forest[Forest.Count - 1];

        Decay.Add(decayCard);
        decayCard.SetActive(false);

        // Remove card from forest
        Forest.Remove(decayCard);

        // Deal a new card
        dealScript.MakeCard("Forest");

        // Reposition cards in forest and decay
        Reposition(Forest, forestSpacing, posForest);
        Reposition(Decay, decaySpacing, posDecay);

        // Get access to SceneChangeScript
        // Make objects un-interactable
        sceneChangeScript = canvasclone.transform.Find("DecayButton").GetComponent <SceneChangeScript>();
        sceneChangeScript.GetObjects();
        sceneChangeScript.ToggleInteract(false, true, true, false);
        //canvasclone.transform.Find("DecayButton").GetComponent<Button>().enabled = true;    // Turn back on button

        // Activate the turn button
        canvasclone.transform.Find("TurnButton").gameObject.SetActive(true);
        // Set text
        canvasclone.transform.Find("TurnButton").transform.Find("Text").GetComponent <Text>().text = "End Turn";
    }