Beispiel #1
0
    private void EditCell(HexCell hexCell)
    {
        if (hexCell)
        {
            if (activeTerrainTypeIndex >= 0)
            {
                hexCell.TerrainTypeIndex = activeTerrainTypeIndex;
            }

            if (applyElevation)
            {
                hexCell.Elevation = activeElevation;
            }

            if (riverMode == OptionalToggle.No)
            {
                hexCell.RemoveRiver();
            }

            if (roadMode == OptionalToggle.No)
            {
                hexCell.RemoveRoads();
            }

            if (applyWaterLevel)
            {
                hexCell.WaterLevel = activeWaterLevel;
            }

            if (applySpecIndex)
            {
                hexCell.SpecIndex = activeSpecIndex;
            }

            if (applyTreeLevel)
            {
                hexCell.TreeLevel = activeTreeLevel;
            }

            if (applyStoneLevel)
            {
                hexCell.StoneLevel = activeStoneLevel;
            }

            if (wallMode == OptionalToggle.Yes)
            {
                for (HexDirection dir = HexDirection.TopRight; dir <= HexDirection.TopLeft; dir++)
                {
                    hexCell.AddWall(dir);
                }
            }

            /*
             * else if(wallMode == OptionalToggle.No)
             * {
             *  for (HexDirection dir = HexDirection.TopRight; dir <= HexDirection.TopLeft; dir++)
             *  {
             *      hexCell.RemoveWalls(dir);
             *  }
             * }
             */

            if (isDrag)
            {
                HexCell otherCell = hexCell.GetNeighbor(dragDirection.Opposite());

                if (otherCell)
                {
                    if (riverMode == OptionalToggle.Yes)
                    {
                        otherCell.SetOutgoingRiver(dragDirection);
                    }

                    if (roadMode == OptionalToggle.Yes)
                    {
                        otherCell.AddRoad(dragDirection);
                    }

                    if (wallMode == OptionalToggle.No)
                    {
                        otherCell.RemoveWalls(dragDirection);
                    }

                    /*
                     * if (wallMode == OptionalToggle.Yes)
                     * {
                     *  otherCell.AddWall(dragDirection);
                     * }
                     * else if (wallMode == OptionalToggle.No)
                     * {
                     *  otherCell.RemoveWalls(dragDirection);
                     * }
                     */
                }
            }
        }
    }