コード例 #1
0
 public CombineAbilityEventInfo(Kimboko combiner, Kimboko kimbokoToCombine, Player player, int IndexID)
 {
     this.combiner         = combiner;
     this.kimbokoToCombine = kimbokoToCombine;
     this.player           = player;
     this.IndexID          = IndexID;
 }
コード例 #2
0
        public static bool CanICombineAndEvolve(Kimboko combinerCharacter, Kimboko toCombineCharacter)
        {
            if (combinerCharacter.UnitType == UNITTYPE.FUSION || toCombineCharacter.UnitType == UNITTYPE.FUSION)
            {
                return(false);
            }
            if (combinerCharacter.UnitType != UNITTYPE.X && toCombineCharacter.UnitType != UNITTYPE.X)
            {
                return(false);
            }

            int totalPoints;
            int combinerPoints  = PuntuateKimboko(combinerCharacter);
            int toCombinePoints = PuntuateKimboko(toCombineCharacter);

            totalPoints = combinerPoints + toCombinePoints;

            switch (totalPoints)
            {
            case 22:
            case 41:
            case 121:
                return(true);

            default:
                return(false);
            }
        }
コード例 #3
0
        public bool CanIEnterCombineState(Kimboko kimboko)
        {
            // 6- SI ESTOY ONLINE TENGO QUE PREGUNTARLE AL SERVER SI ES UN MOVIMIENTO VALIDO
            //    SINO CHEQUEO TODO NORMALMENTE
            // QUIEN QUIERE SPAWNEAR, Y EN DONDE QUIERE SPAWNEAR
            // SI EL PLAYER ES VALIDO Y ES SU TURNO
            // Y SI EL LUGAR PARA SPAWNEAR ES UN LUGAR VALIDO
            // ENTONCES EL SERVER TE DICE SI, PODES SPAWNEAR MANDA EL CMD SPAWN A LOS DOS JUGADORES

            // SI EL PLAYER ESTA EN SU TURNO
            //if (player != game.turnController.CurrentPlayerTurn)
            //{
            //    if (debugOn) Debug.Log("NO ES EL TURNO DEL PLAYER");
            //    return false;
            //}

            //if (player.Abilities.ContainsKey(ABILITYTYPE.SPAWN) == false)
            //{
            //    if (debugOn) Debug.Log("ERROR HABILIDAD SPAWN NO ENCONTRADA EN PLAYER");
            //    return false;
            //}
            //SpawnAbility spw = (SpawnAbility)player.Abilities[ABILITYTYPE.SPAWN];
            //if (spw == null)
            //{
            //    if (debugOn) Debug.Log("ERROR HABILIDAD SPAWN NO ENCONTRADA EN PLAYER");
            //    return false;
            //}

            return(false);
        }
コード例 #4
0
        public static bool CanIEvolve(Kimboko combinerCharacter, Kimboko toCombineCharacter)
        {
            if (combinerCharacter.UnitType == UNITTYPE.FUSION || toCombineCharacter.UnitType == UNITTYPE.FUSION)
            {
                return(false);
            }

            int totalPoints;

            int combinerPoints  = PuntuateKimboko(combinerCharacter);
            int toCombinePoints = PuntuateKimboko(toCombineCharacter);

            totalPoints = combinerPoints + toCombinePoints;

            switch (totalPoints)
            {
            case 4:
            case 6:
            case 8:
            case 38:
            case 40:
            case 57:
                return(true);

            default:
                return(false);
            }
        }
コード例 #5
0
        public bool IsThereAPosibleSpawneableTile(int playerID)
        {
            int columnIndex = 2;

            if (playerID == 1)
            {
                columnIndex = 8;
            }
            for (int i = 0; i < rowsHeight; i++)
            {
                if (GridArray[columnIndex, i].IsOccupied() == false)
                {
                    return(true);
                }
                if (GridArray[columnIndex, i].GetOcuppy() == null)
                {
                    return(false);
                }
                if (GridArray[columnIndex, i].GetOcuppy().OccupierType != OCUPPIERTYPE.UNIT)
                {
                    return(false);
                }
                Kimboko auxKimb = (Kimboko)GridArray[columnIndex, i].GetOcuppy();
                if (auxKimb.OwnerPlayerID == playerID)
                {
                    if (CombineKimbokoRules.CanICombineAndEvolveWithUnitType(auxKimb, UNITTYPE.X))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
コード例 #6
0
        private Kimboko GetNewKimboko(SpawnAbilityEventInfo spawnInfo)
        {
            Debug.Log("PLAYER ID FROM SPAWN INFO " + spawnInfo.spawnerPlayer);
            Kimboko kimboko = null;

            switch (spawnInfo.spawnUnitType)
            {
            case UNITTYPE.X:
                KimbokoXFactory kimbokoXFac = new KimbokoXFactory();
                kimboko = kimbokoXFac.CreateKimboko(spawnInfo.spawnIndexID, spawnInfo.spawnerPlayer);
                break;

            case UNITTYPE.Y:
                KimbokoYFactory kimbokoYFac = new KimbokoYFactory();
                kimboko = kimbokoYFac.CreateKimboko(spawnInfo.spawnIndexID, spawnInfo.spawnerPlayer);
                break;

            case UNITTYPE.Z:
                KimbokoZFactory kimbokoZFac = new KimbokoZFactory();
                kimboko = kimbokoZFac.CreateKimboko(spawnInfo.spawnIndexID, spawnInfo.spawnerPlayer);
                break;

            default:
                break;
            }
            return(kimboko);
        }
コード例 #7
0
        public static bool CanICombineWithUnitType(Kimboko combiner, UNITTYPE toCombine)
        {
            if (combiner.UnitType == UNITTYPE.FUSION || toCombine == UNITTYPE.FUSION || toCombine == UNITTYPE.COMBINE)
            {
                return(false);
            }

            int totalPoints;

            int combinerPoints  = PuntuateKimboko(combiner);
            int toCombinePoints = PuntuateUnitType(toCombine);

            totalPoints = combinerPoints + toCombinePoints;

            switch (totalPoints)
            {
            case 2:
            case 5:
            case 7:
            case 8:
            case 18:
            case 34:
            case 39:
            case 55:
            case 116:
            case 132:
            case 136:
            case 138:
                return(true);

            default:
                return(false);
            }
        }
コード例 #8
0
        private void ExecuteSpecialSpawn(SpawnAbility spawnAbility, SpawnAbilityEventInfo spwInf)
        {
            Kimboko unit = (Kimboko)spwInf.spawnTile.GetOcuppy();

            if (unit == null)
            {
                return;
            }
            if (unit.OwnerPlayerID != spwInf.spawnerPlayer.OwnerPlayerID)
            {
                return;
            }
            bool canCombine          = CombineKimbokoRules.CanICombineWithUnitType(unit, spwInf.spawnUnitType);
            bool canCombineAndEvolve = CombineKimbokoRules.CanICombineAndEvolveWithUnitType(unit, spwInf.spawnUnitType);

            if (canCombineAndEvolve)
            {
                ExecuteSpawnCombineAndEvolve(unit, spwInf);
            }
            else if (canCombine)
            {
                ExecuteSpawnCombine(unit, spawnAbility, spwInf);
            }
            else
            {
                // Y ACA NO SE PUDO COMBINAR NI EVOLUCIONAR
                // ESTO PUEDE PASAR POR INVOCAR UNA UNIDAD Y QUE SE LE CAMBIE DE CLASE
                // AL HACER ESTO NO PODEMOS INVOCARLA POR QUE SON INCOMPATIBLES
                // SE EJECUTA IGUAL EL END PERFORM?????
                // PODRIAMOS TENER UN ESTADO EN EL EVENT INFO PARA PONER CANCEL EXECUTION
                // ENTONCES DE ESTA MANERA SABEMOS QUE SE CANCELO Y NO HACEMOS EL END PERFORM...
            }
        }
コード例 #9
0
        public static int PuntuateKimboko(Kimboko characterToPuntuate)
        {
            int totalPoints = 0;

            switch (characterToPuntuate.UnitType)
            {
            case UNITTYPE.X:
                totalPoints += Xpoints;
                break;

            case UNITTYPE.Y:
                totalPoints += Ypoints;
                break;

            case UNITTYPE.Z:
                totalPoints += Zpoints;
                break;

            case UNITTYPE.COMBINE:
                for (int i = 0; i < (characterToPuntuate as KimbokoCombine).kimbokos.Count; i++)
                {
                    switch ((characterToPuntuate as KimbokoCombine).kimbokos[i].UnitType)
                    {
                    case UNITTYPE.X:
                        totalPoints += Xpoints + XCombPoints;
                        break;

                    case UNITTYPE.Y:
                        totalPoints += Ypoints + YCombPoints;
                        break;

                    case UNITTYPE.Z:
                        totalPoints += Zpoints + ZCombPoints;
                        break;

                    case UNITTYPE.COMBINE:
                        return(0);

                    case UNITTYPE.FUSION:
                        return(0);

                    default:
                        return(0);
                    }
                }
                break;

            case UNITTYPE.FUSION:
                return(0);

            default:
                return(0);
            }

            return(totalPoints);
        }
コード例 #10
0
        private void ExecuteSpawnCombineAndEvolve(Kimboko unit, SpawnAbilityEventInfo spwInf)
        {
            // ACA DEBERIA TENER UNA REFERENCIA AL COMBINE MANAGER
            // ACA DEBERIA TENER UNA REFERENCIA AL EVOLVE MANAGER

            // CREAMOS UNA COMBINE MOTION
            // A - Motion normalSpawnMotion = spawnManagerUI.NormalSpawn(spawnPosition, goKimboko);
            // B - GENERAMOS UN DESTELLO O ALGO SIMILAR EN LA POSICION DE SPAWNEO
            // C - DESTRUIMOS LOS OBJETOS ACTUALES DE LOS KIMBOKOS
            // D - CREAMOS EL NUEVO KIMBOKO EVOLUCIONADO
        }
コード例 #11
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);
        }
コード例 #12
0
        private void Move(MoveAbilityEventInfo movInfo)
        {
            Kimboko kimb = (Kimboko)movInfo.moveOccupy;

            if (kimb != null && kimb.UnitType == UNITTYPE.COMBINE)
            {
                KimbokoCombine combien = (KimbokoCombine)kimb;
                if (combien != null)
                {
                    CombineMove(combien, movInfo);
                    return;
                }
            }
            NormalMove(movInfo);
        }
コード例 #13
0
        public List <SpawnTile> GetPlayerSpawnTiles(int playerID)
        {
            List <SpawnTile> spawnTile = new List <SpawnTile>();
            int columnIndex            = 2;

            if (playerID == 1)
            {
                columnIndex = 8;
            }
            for (int i = 0; i < rowsHeight; i++)
            {
                if (GridArray[columnIndex, i].IsOccupied() == false)
                {
                    SpawnTile aux = (SpawnTile)GridArray[columnIndex, i];
                    spawnTile.Add(aux);
                    continue;
                }
                if (GridArray[columnIndex, i].GetOcuppy() == null)
                {
                    continue;
                }

                if (GridArray[columnIndex, i].GetOcuppy().OccupierType != OCUPPIERTYPE.UNIT)
                {
                    continue;
                }

                Kimboko auxKimb = (Kimboko)GridArray[columnIndex, i].GetOcuppy();
                if (auxKimb.OwnerPlayerID == playerID)
                {
                    if (CombineKimbokoRules.CanICombineWithUnitType(auxKimb, UNITTYPE.X))
                    {
                        SpawnTile aux = (SpawnTile)GridArray[columnIndex, i];
                        spawnTile.Add(aux);
                        continue;
                    }

                    if (CombineKimbokoRules.CanICombineAndEvolveWithUnitType(auxKimb, UNITTYPE.X))
                    {
                        SpawnTile aux = (SpawnTile)GridArray[columnIndex, i];
                        spawnTile.Add(aux);
                        continue;
                    }
                }
            }
            return(spawnTile);
        }
コード例 #14
0
        public static Kimboko WhoIsTheStrong(Kimboko kimbokoOne, Kimboko kimbokoTwo)
        {
            Kimboko theStongest;

            int CharacterOnePoints = PuntuateKimboko(kimbokoOne);
            int CharacterTwoPoints = PuntuateKimboko(kimbokoTwo);

            if (CharacterOnePoints == CharacterTwoPoints || CharacterOnePoints > CharacterTwoPoints)
            {
                theStongest = kimbokoOne;
            }
            else
            {
                theStongest = kimbokoTwo;
            }

            return(theStongest);
        }
コード例 #15
0
        public static bool CanIFusion(Kimboko toFusionCharacter)
        {
            if (toFusionCharacter.UnitType == UNITTYPE.FUSION)
            {
                return(false);
            }

            int fusionPoints = PuntuateKimboko(toFusionCharacter);

            switch (fusionPoints)
            {
            case 4:
            case 6:
            case 8:
            case 38:
            case 57:
                return(true);

            default:
                return(false);
            }
        }
コード例 #16
0
        public static bool CanIEvolve(Kimboko toEvolveCharacter)
        {
            if (toEvolveCharacter.UnitType == UNITTYPE.FUSION)
            {
                return(false);
            }

            int evolverPoints = PuntuateKimboko(toEvolveCharacter);

            switch (evolverPoints)
            {
            case 4:
            case 6:
            case 8:
            case 38:
            case 40:
            case 57:
                return(true);

            default:
                return(false);
            }
        }
コード例 #17
0
        public static bool CanIDecombine(Kimboko characterToDecombine, Tile from)
        {
            //// ESTO TIENE QUE SER GLOBAL YA QUE VA A SER UN CONTADOR
            //int CharactersLeftToDecombine = 0;

            //if (characterToDecombine.UnitType != UNITTYPE.COMBINE) return false;

            //// Primero tengo que ver cuantos characters hay combinados
            //// Despues tengo que buscar en forma de cruz si tengo esta cantidad de lugares libres
            //int amountOfCharacters = 0;
            //for (int i = 0; i < (characterToDecombine as KimbokoCombine).kimbokos.Count; i++)
            //{
            //    amountOfCharacters++;
            //}
            //// Lista de posibles lugares para moverse

            ////CrossCombineDirectionCommand crossCombineDirectionCommand = new CrossCombineDirectionCommand(from, characterToDecombine, BoardManager.Instance.GetAllBoardTileList());
            ////List<Tile2D> posibleDecombinableTiles = crossCombineDirectionCommand.crossTiles;

            //int amountOfFreePosibleTiles = 0;
            ////for (int i = 0; i < posibleDecombinableTiles.Count; i++)
            ////{
            ////    if (!posibleDecombinableTiles[i].IsOcuppied)
            ////    {
            ////        amountOfFreePosibleTiles++;
            ////    }
            ////}

            ////// le pongo menos uno ya que siempre el que descombina se queda en el lugar
            ////if (amountOfFreePosibleTiles >= amountOfCharacters - 1)
            ////{
            ////    CharactersLeftToDecombine = amountOfCharacters - 1;
            ////    return true;
            ////}

            return(false);
        }
コード例 #18
0
 public void RemoveUnit(Kimboko kimbokoUnit)
 {
     kimbokoUnits.Remove(kimbokoUnit);
 }
コード例 #19
0
 public void AddUnit(Kimboko kimbokoUnit)
 {
     kimbokoUnits.Add(kimbokoUnit);
 }
コード例 #20
0
 Dictionary <Kimboko, Vector2> kimbokoToDecombineAndPositions; // QUIENES Y EN DONDE VAN A DESCOMBINAR
 public DecombineAbilityEventInfo(Kimboko decombiner, Dictionary <Kimboko, Vector2> kimbokoToDecombineAndPositions)
 {
     this.decombiner = decombiner;
     this.kimbokoToDecombineAndPositions = kimbokoToDecombineAndPositions;
 }
コード例 #21
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++;
        }