Ejemplo n.º 1
0
    private void Awake()
    {
        characterList = GameManager.instance.GetCharacterList();

        // characterList = new List<Character>();
        // characterList.Add(new Character(0, "Steven", stevenSprite, new Color(1f, 0f, 0f)));
        // characterList.Add(new Character(1, "Peridot", peridotSprite, new Color(0f, 1f, 0f)));

        playerList = new List <PlayerToken>();
        for (int i = 0; i < characterList.Count; i++)
        {
            PlayerToken pt = Instantiate(playerTokenPrefab, new Vector2(600 + i * 220, -540), Quaternion.identity).GetComponent <PlayerToken>();
            pt.transform.SetParent(boardUI.transform, false);
            pt.SetCharacter(characterList[i]);
            playerList.Add(pt);
        }
        playerList.Shuffle();

        playerPositions = new Vector2[5]
        {
            new Vector2(125f, -125.28f), new Vector2(125f, -332.64f), new Vector2(125f, -540f), new Vector2(125f, -747.36f), new Vector2(125f, -954.72f)
        };

        boardUI.startButton.GetComponent <Button>().onClick.AddListener(delegate { StartTurnAction(); });
        boardUI.continueButton.GetComponent <Button>().onClick.AddListener(delegate { ContinueAction(); });
        boardUI.stopButton.GetComponent <Button>().onClick.AddListener(delegate { StopAction(); });

        boardUI.resultButton.GetComponent <Button>().onClick.AddListener(Results);
        boardUI.pauseButton.onClick.AddListener(Pause);

        colorPool     = new List <string>();
        colorTrashBin = new List <string>();

        music        = GetComponent <AudioSource>();
        maxVolume    = music.volume;
        music.volume = 0;
    }