public void CreateSpawnTileHorizontal(int posX, int posY, SpawnTile spawnTile)
        {
            Vector2    position  = new Vector2(boardHolderPosX + posX * tileHeight, boardHolderPosY + posY * tileWidth);
            GameObject goAuxTile = Instantiate(baseTilePrefab, position, Quaternion.identity);

            spawnTile.SetGoAnimContainer(new GameObjectAnimatorContainer(goAuxTile, goAuxTile.GetComponent <Animator>()));
        }
예제 #2
0
        private void CreateSpawnTile(int posX, int posY, Player player)
        {
            Vector3   realWorldPosition = board2DManager.GetGridObjectRealWorldPositionByArrayPosition(posX, posY);
            SpawnTile spawnTile         = new SpawnTile(realWorldPosition, posX, posY, player.OwnerPlayerID);

            GridArray[posX, posY] = spawnTile;
            board2DManagerUI.CreateSpawnTileHorizontal(posX, posY, spawnTile);
        }
        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);
        }
예제 #4
0
        public override bool CanIExecute()
        {
            // QUE LA ACCION NO ESTE CANCELADA
            if (actionStatus == ABILITYEXECUTIONSTATUS.CANCELED)
            {
                return(false);
            }
            // 1- TENER LOS AP NECESARIOS
            if (performerIOcuppy.GetCurrentActionPoints() < GetActionPointsRequiredToUseAbility())
            {
                Debug.Log("Spawn Ability: Not Enough Action Points");
                return(false);
            }
            // 2- QUE EXISTA UNA TILE SELECCIONADA
            if (selectedTile == null)
            {
                Debug.Log("Spawn Ability: Not Selected Tile");
                return(false);
            }
            // 2- QUE SEA UNA TILE DE LA BASE
            if (selectedTile.tileType != TILETYPE.SPAWN)
            {
                Debug.Log("Spawn Ability: Not Selected Spawn Tile");
                return(false);
            }
            // 3- QUE SEA UN SPAWN AUTENTICO
            SpawnTile spawnTile = (SpawnTile)selectedTile;

            if (spawnTile == null)
            {
                Debug.Log("Spawn Ability: Spawn Tile Null");
                return(false);
            }
            // 3- QUE SEA LA BASE DEL PLAYER QUE LA CLICKEO
            if (spawnTile.PlayerID != player.OwnerPlayerID)
            {
                Debug.Log("Spawn Ability: Enemy Spawn Tile Selected");
                return(false);
            }
            // 5- QUE LA TILE NO ESTE OCUPADA POR UN ENEMIGO, SINO YA SERIA LA HABILIDAD DE ATTACK EN BASE
            if (spawnTile.IsOccupied())
            {
                if (spawnTile.GetOcuppy().OccupierType == OCUPPIERTYPE.UNIT)
                {
                    if (spawnTile.GetOcuppy().OwnerPlayerID != player.OwnerPlayerID)
                    {
                        return(false);
                    }

                    //Kimboko unit = (Kimboko)spawnTile.GetOcuppy();
                    //Debug.Log("Spawn Ability: Tile Selected Is Occupied By a Kimboko");
                    //if (unit.OwnerPlayerID != player.PlayerID)
                    //{
                    //    return false;
                    //}

                    return(true);
                }
            }
            return(true);
        }