public bool CanICombine(CombineAbilityEventInfo cmbInfo)
        {
            if (CanIEnterCombineState(cmbInfo.combiner) == false)
            {
                return(false);
            }
            if (!IsLegalCombine(cmbInfo))
            {
                if (debugOn)
                {
                    Debug.Log("Ilegal Combine");
                }
                return(false);
            }
            if (cmbInfo.combiner.Abilities.ContainsKey(ABILITYTYPE.COMBINE) == false)
            {
                if (debugOn)
                {
                    Debug.Log("ERROR HABILIDAD COMBINE NO ENCONTRADA");
                }
                return(false);
            }
            CombineAbility cmb = (CombineAbility)cmbInfo.combiner.Abilities[ABILITYTYPE.COMBINE];

            if (cmb == null)
            {
                if (debugOn)
                {
                    Debug.Log("ERROR HABILIDAD COMBINE NULL");
                }
                return(false);
            }
            return(true);
        }
示例#2
0
        public static Dictionary <ABILITYTYPE, IAbility> CreateKimbokoAbilities(Kimboko kimboko)
        {
            Dictionary <ABILITYTYPE, IAbility> Abilities = new Dictionary <ABILITYTYPE, IAbility>();
            MoveAbility moveAbility = new MoveAbility(kimboko);

            Abilities.Add(moveAbility.AbilityType, moveAbility);
            CombineAbility combineAbility = new CombineAbility(kimboko);

            Abilities.Add(combineAbility.AbilityType, combineAbility);
            return(Abilities);
        }
        public void ExecuteNormalCombine(CombineAbility combineAbility, CombineAbilityEventInfo cmbInfo)
        {
            combineAbility.SetRequireGameData(cmbInfo);
            StartPerform(combineAbility);
            if (combineAbility.CanIExecute() == false)
            {
                if (debugOn)
                {
                    Debug.Log("COMBINE ABILITY NO SE PUEDE EJECUTAR");
                }
                return;
            }

            ICombineCommand combineCommand = new ICombineCommand(cmbInfo, game);

            Invoker.AddNewCommand(combineCommand);
            Invoker.ExecuteCommands();

            Vector3 spawnPosition = game.board2DManager.GetUnitPosition(cmbInfo.combiner).GetRealWorldLocation();

            List <GameObject> combinersGO = new List <GameObject>();

            if (cmbInfo.combiner.UnitType == UNITTYPE.COMBINE)
            {
                KimbokoCombine kimbComb = (KimbokoCombine)cmbInfo.combiner;
                for (int i = 0; i < kimbComb.kimbokos.Count; i++)
                {
                    combinersGO.Add(kimbComb.kimbokos[i].goAnimContainer.GetGameObject());
                }
            }
            else
            {
                combinersGO.Add(cmbInfo.combiner.goAnimContainer.GetGameObject());
            }

            //Motion combineMoveMotion = combineManagerUI.NormalCombineMotion(spawnPosition, cmbInfo.kimbokoToCombine.goAnimContainer.GetGameObject(), combinersGO, game);
            //InvokerMotion.AddNewMotion(combineMoveMotion);
            //InvokerMotion.StartExecution(combineManagerUI);

            Animotion combineMoveMotion = combineManagerUI.NormalCombineAnimotion(spawnPosition, cmbInfo.kimbokoToCombine.goAnimContainer.GetGameObject(), combinersGO, game);

            InvokerAnimotion.AddNewMotion(combineMoveMotion);
            InvokerAnimotion.StartExecution(combineManagerUI);

            Perform(combineAbility);
            EndPerform(combineAbility);
        }
        public void OnCombine(CombineAbilityEventInfo cmbInfo)
        {
            CombineAbility combineAbility = (CombineAbility)cmbInfo.combiner.Abilities[ABILITYTYPE.COMBINE];

            ExecuteNormalCombine(combineAbility, cmbInfo);
        }
示例#5
0
        private void ExecuteSpawnCombine(Kimboko actualCombiner, SpawnAbility spawnAbility, SpawnAbilityEventInfo spwInf)
        {
            CombineAbility combineAbility = (CombineAbility)actualCombiner.Abilities[ABILITYTYPE.COMBINE];

            if (combineAbility == null)
            {
                if (debugOn)
                {
                    Debug.Log("ERROR HABILIDAD COMBINE NULL");
                }
                return;
            }
            Kimboko spawnedKimboko = GetNewKimboko(spwInf);

            CombineAbilityEventInfo cmbInfo = new CombineAbilityEventInfo(actualCombiner, spawnedKimboko, spwInf.spawnerPlayer, spwInf.spawnIndexID);

            spawnAbility.SetRequireGameData(spwInf);
            combineAbility.SetRequireGameData(cmbInfo);

            StartPerform(spawnAbility);
            if (spawnAbility.CanIExecute() == false)
            {
                if (debugOn)
                {
                    Debug.Log("SPAWN ABILITY NO SE PUEDE EJECUTAR");
                }
                return;
            }

            game.combineManager.StartPerform(combineAbility);
            // NO VOY A GENERAR ESTE CHEQUEO, YA QUE EL SPAWN GENERA AUTOMATICAMENTE LA COMBINACION
            //if (combineAbility.CanIExecute() == false)
            //{
            //    if (debugOn) Debug.Log("COMBINE ABILITY NO SE PUEDE EJECUTAR");
            //    return;
            //}

            // C - CombineSpawn(Kimboko actualCombiner, SpawnAbilityEventInfo spwInf)
            GameObject goKimboko = spawnManagerUI.GetKimbokoPrefab();

            spawnedKimboko.SetGoAnimContainer(new GameObjectAnimatorContainer(goKimboko, goKimboko.GetComponent <Animator>()));
            ISpawnCombineCommand spawnCombineCmd = new ISpawnCombineCommand(spawnedKimboko, spwInf, actualCombiner, game);

            Invoker.AddNewCommand(spawnCombineCmd);
            Invoker.ExecuteCommands();
            Vector3           spawnPosition = spwInf.spawnTile.GetRealWorldLocation();
            List <GameObject> combinersGO   = new List <GameObject>();

            if (actualCombiner.UnitType == UNITTYPE.COMBINE)
            {
                KimbokoCombine kimbComb = (KimbokoCombine)actualCombiner;
                for (int i = 0; i < kimbComb.kimbokos.Count; i++)
                {
                    combinersGO.Add(kimbComb.kimbokos[i].goAnimContainer.GetGameObject());
                }
            }
            else
            {
                combinersGO.Add(actualCombiner.goAnimContainer.GetGameObject());
            }

            //Motion combineSpawnMotion = spawnManagerUI.CombineSpawn(spawnPosition, goKimboko, combinersGO, game);
            //InvokerMotion.AddNewMotion(combineSpawnMotion);
            //InvokerMotion.StartExecution(spawnManagerUI);


            Animotion combineSpawnMotion = spawnManagerUI.CombineSpawnAnimotion(spawnPosition, goKimboko, combinersGO, game);

            InvokerAnimotion.AddNewMotion(combineSpawnMotion);
            InvokerAnimotion.StartExecution(spawnManagerUI);

            // D - Perform(spawnAbility);
            //     Perform(combineAbility);
            Perform(spawnAbility);
            game.combineManager.Perform(combineAbility);
            // E - EndPerform(spawnAbility);
            //     EndPerform(combineAbility);
            EndPerform(spawnAbility);
            game.combineManager.EndPerform(combineAbility);
            // F - spawnIndexID++;
            spawnIndexID++;
        }