Exemple #1
0
        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)
        {
            object Map = GetMap(MapName);

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

            if (Map.GetType() == IntArray.GetType())
            {
                int[,] Array = (int[, ])Map;
                TerrainUtil.ApplySquareBrush(X1, X2, Y1, Y2, Q, Array, Shape, Tool, Radius, IsPrimary ? 1 : -1, Flow);
            }
            else if (Map.GetType() == ByteArray.GetType())
            {
                byte[,] Array = (byte[, ])Map;
                TerrainUtil.ApplySquareBrush(X1, X2, Y1, Y2, Q, Array, Shape, Tool, Radius, IsPrimary ? 1 : -1, Flow);
            }
            else if (Map.GetType() == FloatArray.GetType())
            {
                float[,] Array = (float[, ])Map;
                TerrainUtil.ApplySquareBrush(X1, X2, Y1, Y2, Q, Array, Shape, Tool, Radius, IsPrimary ? 1 : -1, Flow);
            }
            HasTerrainUpdate = true;
        }
Exemple #2
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;
        }