Beispiel #1
0
		public void SetWaypoint(WaypointTemplate waypoint) { Brush = null; Actor = null; Resource = null; Waypoint = waypoint; }
Beispiel #2
0
		public void SetResource(ResourceTemplate resource) { Brush = null; Actor = null; Resource = resource; Waypoint = null; }
Beispiel #3
0
		public void SetActor(ActorTemplate actor) { Brush = null; Actor = actor; Resource = null; Waypoint = null; }
Beispiel #4
0
		public void SetBrush(BrushTemplate brush) { Actor = null; Brush = brush; Resource = null; Waypoint = null; }
Beispiel #5
0
		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();
		}
Beispiel #6
0
		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();
		}