Example #1
0
    public void OnClickToSelectCharacter(int index, Character character)
    {
        if (!character.opened)
        {
            //  If the character is not purchased, buy it
            characterSelection.OpenCharacter(index);

            Debug.Log("(CSCallback) " + "OnPurchase: index = " + index + " Character name = " + character.name);
        }
        else
        {
            //  If the character is purchased, select it
            characterSelection.SelectCharacter(index);

            // set current character object
            Destroy(currentCharacterParent.transform.GetChild(0).gameObject);
            GameObject current = Instantiate(character.obj);
            current.transform.parent        = currentCharacterParent.transform;
            current.transform.localPosition = Vector3.zero;

            Debug.Log("(CSCallback) " + "OnSelect: index = " + index + " Character name = " + character.name);
        }
    }