private void Start()
    {
        recorder = new CCRecorder();

        scoringValues = new Dictionary <int, int>();
        scoringValues.Add(0, 0);
        scoringValues.Add(1, 0);
        scoringValues.Add(2, 2);
        scoringValues.Add(3, 3);
        scoringValues.Add(4, 8);
        scoringValues.Add(5, 10);

        for (int i = 0; i < gameGrid.Length; i++)
        {
            DieValueViewer square = gameGrid[i];
            square.SetToUnused();
            ExhibitUtilities.AddEventTrigger(square.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerUp, () => { SquareClicked(square); });
        }

        for (int i = 0; i < dice.Length; i++)
        {
            Die die = dice[i];
            ExhibitUtilities.AddEventTrigger(die.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerUp, () => { DieClicked(die); });
        }



        // game over panel
        gameOverPanel.Setup(RetryButtonPressed, RetrySameButtonPressed);


        // start game
        SetupForGame();
    }
    public void Setup(System.Action retryAction, System.Action retrySameAction)
    {
        gameOverGroup = gameOverPanel.GetComponent <CanvasGroup>();

        newButton.GetComponent <ChunkyButton>().onClick.AddListener(() => { retryAction(); });
        sameButton.GetComponent <ChunkyButton>().onClick.AddListener(() => { retrySameAction(); });
        quitButton.GetComponent <ChunkyButton>().onClick.AddListener(() => { Application.Quit(); });
        ExhibitUtilities.AddEventTrigger(gameOverPanel, UnityEngine.EventSystems.EventTriggerType.PointerDown, () => { gameOverGroup.alpha = 0; });
        ExhibitUtilities.AddEventTrigger(gameOverPanel, UnityEngine.EventSystems.EventTriggerType.PointerUp, () => { gameOverGroup.alpha = 1; });
        gameOverPanel.SetActive(false);
    }
Exemple #3
0
 private void Start()
 {
     ExhibitUtilities.AddEventTrigger(rollButton, UnityEngine.EventSystems.EventTriggerType.PointerDown, () => {
         Roll();
     });
 }