コード例 #1
0
ファイル: Surface.cs プロジェクト: mgatland/OpenRA
		public void SetWaypoint(WaypointTemplate waypoint) { Brush = null; Actor = null; Resource = null; Waypoint = waypoint; }
コード例 #2
0
ファイル: Surface.cs プロジェクト: mgatland/OpenRA
		public void SetResource(ResourceTemplate resource) { Brush = null; Actor = null; Resource = resource; Waypoint = null; }
コード例 #3
0
ファイル: Surface.cs プロジェクト: mgatland/OpenRA
		public void SetActor(ActorTemplate actor) { Brush = null; Actor = actor; Resource = null; Waypoint = null; }
コード例 #4
0
ファイル: Surface.cs プロジェクト: mgatland/OpenRA
		public void SetBrush(BrushTemplate brush) { Actor = null; Brush = brush; Resource = null; Waypoint = null; }
コード例 #5
0
ファイル: Surface.cs プロジェクト: mgatland/OpenRA
		void Erase()
		{
			Actor = null;
			Brush = null;
			Resource = null;
			Waypoint = null;

			var key = Map.Actors.FirstOrDefault(a => a.Value.Location() == GetBrushLocation());
			if (key.Key != null) Map.Actors.Remove(key.Key);

			if (Map.MapResources[GetBrushLocation().X, GetBrushLocation().Y].type != 0)
			{
				Map.MapResources[GetBrushLocation().X, GetBrushLocation().Y] = new TileReference<byte, byte>();
				var ch = new int2((GetBrushLocation().X) / ChunkSize, (GetBrushLocation().Y) / ChunkSize);
				if (Chunks.ContainsKey(ch))
				{
					Chunks[ch].Dispose();
					Chunks.Remove(ch);
				}
			}

			var k = Map.Waypoints.FirstOrDefault(a => a.Value == GetBrushLocation());
			if (k.Key != null) Map.Waypoints.Remove(k.Key);

			AfterChange();
		}
コード例 #6
0
ファイル: Surface.cs プロジェクト: pdovy/OpenRA
		void Erase()
		{
			// Crash preventing
			var BrushLocation = GetBrushLocation();

			if (Map == null || BrushLocation.X >= Map.MapSize.X ||
				BrushLocation.Y >= Map.MapSize.Y ||
				BrushLocation.X < 0 ||
				BrushLocation.Y < 0)
				return;

			Actor = null;
			Brush = null;
			Resource = null;
			Waypoint = null;

			var key = Map.Actors.FirstOrDefault(a => a.Value.Location() == BrushLocation);
			if (key.Key != null) Map.Actors.Remove(key.Key);

			if (Map.MapResources[BrushLocation.X, BrushLocation.Y].type != 0)
			{
				Map.MapResources[BrushLocation.X, BrushLocation.Y] = new TileReference<byte, byte>();
				var ch = new int2((BrushLocation.X) / ChunkSize, (BrushLocation.Y) / ChunkSize);
				if (Chunks.ContainsKey(ch))
				{
					Chunks[ch].Dispose();
					Chunks.Remove(ch);
				}
			}

			var k = Map.Waypoints.FirstOrDefault(a => a.Value == BrushLocation);
			if (k.Key != null) Map.Waypoints.Remove(k.Key);

			AfterChange();
		}