private void PerformAction(clsAction Action, sPosNum PosNum, XYInt LastValidNum) { int XNum = 0; int X = 0; int Y = 0; XYInt Centre = new XYInt(0, 0); if ( Action.Map == null ) { Debugger.Break(); return; } Centre = GetPosNum(PosNum); Action.Effect = 1.0D; for ( Y = MathUtil.Clamp_int(Tiles.YMin + Centre.Y, 0, LastValidNum.Y) - Centre.Y; Y <= MathUtil.Clamp_int(Tiles.YMax + Centre.Y, 0, LastValidNum.Y) - Centre.Y; Y++ ) { Action.PosNum.Y = Centre.Y + Y; XNum = Y - Tiles.YMin; for ( X = MathUtil.Clamp_int(Tiles.XMin[XNum] + Centre.X, 0, LastValidNum.X) - Centre.X; X <= MathUtil.Clamp_int(Convert.ToInt32(Tiles.XMax[XNum] + Centre.X), 0, LastValidNum.X) - Centre.X; X++ ) { Action.PosNum.X = Centre.X + X; if ( Action.UseEffect ) { if ( Tiles.ResultRadius > 0.0D ) { switch ( _Shape ) { case enumShape.Circle: if ( _Alignment ) { Action.Effect = Convert.ToDouble(1.0D - (new XYDouble(Action.PosNum.X, Action.PosNum.Y) - new XYDouble(Centre.X - 0.5D, Centre.Y - 0.5D)).GetMagnitude() / (Tiles.ResultRadius + 0.5D)); } else { Action.Effect = Convert.ToDouble(1.0D - (Centre - Action.PosNum).ToDoubles().GetMagnitude() / (Tiles.ResultRadius + 0.5D)); } break; case enumShape.Square: if ( _Alignment ) { Action.Effect = 1.0D - Math.Max(Math.Abs(Action.PosNum.X - (Centre.X - 0.5D)), Math.Abs(Action.PosNum.Y - (Centre.Y - 0.5D))) / (Tiles.ResultRadius + 0.5D); } else { Action.Effect = 1.0D - Math.Max(Math.Abs(Action.PosNum.X - Centre.X), Math.Abs(Action.PosNum.Y - Centre.Y)) / (Tiles.ResultRadius + 0.5D); } break; } } } Action.ActionPerform(); } } }
public void PerformActionMapTiles(clsAction Tool, sPosNum Centre) { PerformAction(Tool, Centre, new XYInt(Tool.Map.Terrain.TileSize.X - 1, Tool.Map.Terrain.TileSize.Y - 1)); }
public void PerformActionMapVertices(clsAction Tool, sPosNum Centre) { PerformAction(Tool, Centre, Tool.Map.Terrain.TileSize); }
public void PerformActionMapSectors(clsAction Tool, sPosNum Centre) { PerformAction(Tool, Centre, new XYInt(Tool.Map.SectorCount.X - 1, Tool.Map.SectorCount.Y - 1)); }