Beispiel #1
0
        //Modifies With HeightAdjustMent
        public void ModifyMap(int X1, int X2, int Y1, int Y2, float[,] Q, int Shape, int Tool, bool IsPrimary, int Radius, float Flow, string MapName, string AdjustMapName, bool AdjustHeight)
        {
            object Map           = GetMap(MapName);
            object AdjustmentMap = GetMap(AdjustMapName);

            int[,] IntArray      = new int[, ] {
            };
            byte[,] ByteArray    = new byte[, ] {
            };
            float[,] FloatArrray = new float[, ] {
            };

            if (Map.GetType() == IntArray.GetType() && AdjustmentMap.GetType() == IntArray.GetType())
            {
                if (AdjustHeight)
                {
                    int[,] Array           = (int[, ])Map;
                    int[,] AdjustmentArray = (int[, ])AdjustmentMap;

                    TerrainUtil.ApplySquareBrush(X1, X2, Y1, Y2, Q, Array, AdjustmentArray, Shape, Tool, Radius, IsPrimary ? 1 : -1, Flow);
                }
                else
                {
                    int[,] Array           = (int[, ])Map;
                    int[,] AdjustmentArray = (int[, ])AdjustmentMap;

                    int[,] OldArray = (int[, ])Array.Clone();

                    //apply difference
                    TerrainUtil.ApplySquareBrush(X1, X2, Y1, Y2, Q, Array, AdjustmentArray, Shape, Tool, Radius, IsPrimary ? 1 : -1, Flow);
                    TerrainUtil.AdjustWaterHeight(OldArray, Array, AdjustmentArray);
                }
            }
            else if (Map.GetType() == FloatArrray.GetType() && AdjustmentMap.GetType() == FloatArrray.GetType())
            {
                if (AdjustHeight)
                {
                    float[,] Array           = (float[, ])Map;
                    float[,] AdjustmentArray = (float[, ])AdjustmentMap;
                    TerrainUtil.ApplySquareBrush(X1, X2, Y1, Y2, Q, Array, AdjustmentArray, Shape, Tool, Radius, IsPrimary ? 1 : -1, Flow);
                }
                else
                {
                    float[,] Array           = (float[, ])Map;
                    float[,] AdjustmentArray = (float[, ])AdjustmentMap;
                    float[,] OldArray        = (float[, ])Array.Clone();
                    //apply difference
                    TerrainUtil.ApplySquareBrush(X1, X2, Y1, Y2, Q, Array, AdjustmentArray, Shape, Tool, Radius, IsPrimary ? 1 : -1, Flow);
                    TerrainUtil.AdjustWaterHeight(OldArray, Array, AdjustmentArray);
                }
            }
            HasTerrainUpdate = true;
        }