Example #1
0
        // Start is called before the first frame update
        private void Init()
        {
            _characterFactory = CharacterFactory.GetInstance();
            if (_characterFactory == null)
            {
                return;
            }

            _buttons       = new List <CombinationButton>();
            _isInitialized = true;
        }
Example #2
0
        private void OnClickListener()
        {
            var  characterFactory = CharacterFactory.GetInstance();
            bool isAllPrepared    = true;

            bool[] isPrepared = new bool[Combination.Characters.Count];
            isPrepared[0] = true;

            // Check characters except owner character
            for (int i = 1; i < Combination.Characters.Count; i++)
            {
                isPrepared[i] = false;
                for (int j = 0; j < characterFactory.CurrentCharacters.Count; j++)
                {
                    if (characterFactory.CurrentCharacters[j].tag == Combination.Characters[i].tag)
                    {
                        isPrepared[1] = true;
                        break;
                    }
                }
            }

            for (int i = 0; i < isPrepared.Length; i++)
            {
                if (!isPrepared[i])
                {
                    isAllPrepared = false;
                    break;
                }
            }

            // Every characters are here
            if (isAllPrepared)
            {
                FindObjectOfType <CombinationButtonManager>().RemoveAllCombinationButtons();

                characterFactory.SpawnCharacterByTag(Combination.ResultCharacter.tag, OwnerCharacter.transform.localPosition);
                characterFactory.RemoveCharacter(OwnerCharacter);

                for (int i = 0; i < Combination.Characters.Count; i++)
                {
                    characterFactory.RemoveCharacterByTag(Combination.Characters[i].tag);
                }
            }
            else
            {
                print("COMBINATION NOT READY");
            }
        }