Ejemplo n.º 1
0
    private void setFloorData()
    {
        byte[] list = new byte[sizeX * sizeZ];
        byte   value;


        for (int x = 0; x < sizeX; x++)
        {
            for (int z = 0; z < sizeZ; z++)
            {
                // value = (byte)(tiles[x, z].myState + 48);
                value = (byte)TileColors.ColorToChar(TileColors.TileStateToColor(tiles[x, z].myState));
                if (tiles[x, z].myState == Tile.States.NONE && tiles[x, z].isPlayerHere())
                {
                    //value = 70;
                    value = (byte)TileColors.ColorToChar(TileColors.Color.Blue);
                }
                list[(x * sizeZ) + z] = value;
            }
        }


        string output = Encoding.UTF8.GetString(list, 0, sizeX * sizeZ);

        AC.setMessageOUT(output);
        // AC2.setMessageOUT(output);
    }
Ejemplo n.º 2
0
 public Face(TileColors color)
 {
     Tiles = new TileColors[2, 2] {
         { color, color },
         { color, color }
     };
 }
Ejemplo n.º 3
0
 private void UpdateTile()
 {
     tileText.text      = realValue.ToString();
     tileMaterial.color = TileColors.GetTileColor(realValue);
     name           = string.Format("{0} = {1}", coordinateInGrid, realValue);
     mergedThisTurn = true;
 }
Ejemplo n.º 4
0
    /// <summary>
    /// Updates the textures of any tiles changed between last render and this one
    /// </summary>
    public void UpdateVisuals()
    {
        TerrainData terrainData = map.terrainData;

        //get current paint mask
        float[,,] alphas = terrainData.GetAlphamaps(0, 0, terrainData.alphamapWidth, terrainData.alphamapHeight);
        // make sure every grid on the terrain is modified
        for (int x = 0; x < mapSizeX; x++)
        {
            for (int y = 0; y < mapSizeY; y++)
            {
                TileColors color = TileColors.None;
                if (battle.battleMap[x, y].skillTargetting)
                {
                    if (battle.skillLegitTarget)
                    {
                        color = TileColors.TargettingValidSpellTarget;
                    }
                    else
                    {
                        color = TileColors.TargettingInvalidSpellTarget;
                    }
                }
                else if (battle.battleMap[x, y].skillTargettable)
                {
                    color = TileColors.ValidSpellTarget;
                }
                else if (battle.battleMap[x, y].skillRange)
                {
                    color = TileColors.SpellRange;
                }
                else if (battle.battleMap[x, y].enemyDanger && showDanger && battle.battleMap[x, y].playerMoveRange)
                {
                    color = TileColors.PlayerMoveIntoDanger;
                }
                else if (battle.battleMap[x, y].playerMoveRange)
                {
                    color = TileColors.PlayerTraversable;
                }
                else if (battle.battleMap[x, y].playerAttackRange)
                {
                    color = TileColors.PlayerAttackable;
                }
                else if (battle.battleMap[x, y].enemyDanger && showDanger)
                {
                    color = TileColors.Danger;
                }

                if (color != currentVisuals[x, y])
                {
                    UpdateSingleTile(x, y, alphas, color, currentVisuals[x, y]);
                    currentVisuals[x, y] = color;
                }
            }
        }
        // apply the new alpha
        terrainData.SetAlphamaps(0, 0, alphas);
    }
Ejemplo n.º 5
0
    /// <summary>
    /// Updates the image for a single tile's worth of area on the battle map
    /// </summary>
    /// <param name="xPos">X position in battle coordinates</param>
    /// <param name="yPos">Y position in battle coordinates</param>
    /// <param name="alphas">Alpha map to update each point with</param>
    /// <param name="color">What new tile type to show</param>
    /// <param name="previousColor">What old tile type to wipe it of</param>
    private void UpdateSingleTile(int xPos, int yPos, float[,,] alphas, TileColors color, TileColors previousColor)
    {
        for (int x = xPos * tileSize + 2; x < (xPos + 1) * tileSize + 2; x++)
        {
            for (int y = yPos * tileSize + 2; y < (yPos + 1) * tileSize + 2; y++)
            {
                alphas[y, x, (int)previousColor] = 0f;

                alphas[y, x, (int)color] = 0.8f;
            }
        }
    }
Ejemplo n.º 6
0
    public static Color fromEnum(TileColors name)
    {
        switch (name)
        {
        case TileColors.WHITE:
            return(TileColorsMap.white);

        case TileColors.RED:
            return(TileColorsMap.red);

        case TileColors.GREEN:
            return(TileColorsMap.green);

        case TileColors.BLUE:
            return(TileColorsMap.blue);

        default:
            return(Color.white);
        }
    }
Ejemplo n.º 7
0
    public void ColorAction(int tileType)
    {
        List <GridTile> tiles = levelEditor.gridController.GetSelectedGridTiles();

        if (tiles.Count == 0)
        {
            return;
        }

        int   currentWaveIndex = PLESpawnManager.Instance.CurrentWaveIndex;
        Color newColor         = TileColors.GetColor(tileType);

        for (int i = 0; i < tiles.Count; i++)
        {
            GridTile     tile      = tiles[i];
            PLEBlockUnit blockUnit = tile.blockUnit;
            blockUnit.riseColor = newColor;
            blockUnit.SyncTileStatesAndColors();
        }
    }