public ContourSegment GenerateSection(Contour terrain, Vector2 startPoint, float dist, float length, float slope, bool bumpify) {
			ContourSegmentConfig config = new ContourSegmentConfig();
			config.startPoint = startPoint;
			config.length = length;
			config.slope = slope;
			config.distStart = dist;
			config.bumpify = bumpify;
			return GenerateSection(terrain, config);
		}
Example #2
0
		public void Initialize(Contour terrain, ContourSegmentConfig config, ContourSegmentAttributes attributes) {
			this.terrain = terrain;
			this.config = config;
			this.attributes = attributes;

			transform.parent = terrain.transform;
			transform.localPosition = Vector2.zero;

			CalculateSlopeVector();
			CalculatePerpendicularSlopeVector();
			GenerateEndPoint();
			GenerateMidPoints();
	//		BumpifyMidPointsIfNeeded();
			CollectAllPointsInList();
			CalculateSurfaceMeasures();
			CalculateDistAtEnd();
		}
		private ContourSegment GenerateSection(Contour terrain, ContourSegmentConfig config) {
			ContourSegment section = new GameObject("Section", typeof(ContourSegment)).GetComponent<ContourSegment>();
			section.Initialize(terrain, config, attributes);
			return section;
		}