Example #1
0
 private void WordsCharacterButtonOnClick(WordsCharacterButton button)
 {
     if (isStarted)
     {
         selectedCharacterIndex = characters.IndexOf(button.character);
         RemoveAll();
         BeginGame();
     }
 }
Example #2
0
    private void AddCharacterButtons()
    {
        for (int i = 0; i < characters.Length; i++)
        {
            GameObject go = new GameObject();
            go.AddComponent <SpriteRenderer>();
            WordsCharacterButton cb = go.AddComponent <WordsCharacterButton>();
            cb.SetStates(characterButtonsNormal[i], characterButtonsActive[i]);
            cb.character = characters[i];
            cb.onClick  += WordsCharacterButtonOnClick;
            Vector3 pos = characterButtonsStartPos.position;
            pos.x = characterButtonsStartPos.position.x - (characters.Length - i - 1) * 1.1f;
            go.transform.position = pos;
            go.AddComponent <BoxCollider2D>();

            characterButtons.Add(go);
        }
    }