void OnEnable()
	{
		thisTarget = serializedObject.targetObject as SampleHeightAndReachableV3;

		thisTarget.brushSize = 1;
		DeleteExisted();

		thisTarget.paintMode = SampleHeightAndReachableV3.PaintMode.None;
	}
Exemplo n.º 2
0
	public void ChangePaintMode(SampleHeightAndReachableV3.PaintMode paintMode)
	{
		switch (paintMode)
		{
			case SampleHeightAndReachableV3.PaintMode.None:
				currentBrush = null;
				break;
			case SampleHeightAndReachableV3.PaintMode.Reachable:
				currentBrush = brush;
				currentBrush.ChangeColor(reachableBrushColor);
				break;
			case SampleHeightAndReachableV3.PaintMode.NotReachable:
				currentBrush = brush;
				currentBrush.ChangeColor(notReachableBrushColor);
				break;
			case SampleHeightAndReachableV3.PaintMode.WayPoint:
				currentBrush = wayPointBrush;
				currentBrush.ChangeColor(wayPointBrushColor);
				break;
			default: break;
		}
	}
Exemplo n.º 3
0
	public void PaintAt(int x, int z, SampleHeightAndReachableV3.PaintMode mode, bool isDown)
	{
		//Debug.Log(string.Format("paint at: {0}  {1}", x, z));
		List<int[]> influencedIDs = currentBrush.GetInfluencedIDs(x, z, data);
		List<int[]> changedCoords = new List<int[]>();
		bool changed = false;

		bool isWayPoint = mode == SampleHeightAndReachableV3.PaintMode.WayPoint;
		if (isWayPoint && !isDown)
			return;
		Color color = currentBrush.GetColor();



		foreach (int[] coord in influencedIDs)
		{
			//Debug.Log(string.Format("influnced total: {2}   : {0}  {1}", coord[0], coord[1], influencedIDs.Count));
			MapData.MapNode node = data.GetNode(coord[0], coord[1]);
			if (isWayPoint)
			{
				node.IsReachable = true;
				node.IsWayPoint = !node.IsWayPoint;
				if (!node.IsWayPoint)
				{
					color = reachableColor;
				}
				else { color = wayPointColor; }
				changedCoords.Add(coord);
			}
			else
			{
				node.IsReachable = mode == SampleHeightAndReachableV3.PaintMode.Reachable;
				if (node.IsWayPoint)
				{
					if (node.IsReachable == false)
					{
						node.IsWayPoint = false;
						changedCoords.Add(coord);
					}
				}
				else
				{
					changedCoords.Add(coord);
				}
			}
			changed |= true;
		}

		if (changed)
		{
			ChangeColors(changedCoords, color);
		}
	}