Beispiel #1
0
		private void RemovePiecesFromSection(ContourSegment section) {
			var snowPuffs = pieceDict[section];
			for (int i = snowPuffs.Count - 1; i >= 0; i--) {
				ContourLinePiece snowPuff = snowPuffs[i];
				snowPuffs.RemoveAt(i);
				snowPuff.Recycle();
			}
			pieceDict.Remove(section);
		}
Beispiel #2
0
		private void AddPiecesToSection(ContourSegment section) {
			var points = section.allPoints;
			pieceDict.Add(section, new List<ContourLinePiece>());
			for (int i = 0; i < points.Count - 1; i++) {
				ContourLinePiece snowPuff = contourLinePiecePrefab.Spawn();
				snowPuff.transform.SetParent(transform);
				Vector2 pointA = points[i];
				Vector2 pointB = points[i+1];
				snowPuff.SetPoints(pointA, pointB);
				pieceDict[section].Add(snowPuff);
			}
		}
Beispiel #3
0
	private void GenerateTrees(ContourSegment section) {
		GenerateItemsOnSection(section, deltaDistRange);
	}
Beispiel #4
0
	protected override void OnSegmentRemoved(ContourSegment section) {
		RecycleItemsOnSection<FirTree>(section);
	}
Beispiel #5
0
		private void RemoveSection(ContourSegment section) {
			sections.Remove(section);
			if (SignalSegmentRemoved != null) SignalSegmentRemoved(section);
			GameObject.Destroy(section.gameObject, 0.5f);
			OnChange();
		}
Beispiel #6
0
		private void AddSection(ContourSegment sectionToAdd) {
			sections.Add(sectionToAdd);
			if (SignalSegmentAdded != null) SignalSegmentAdded(sectionToAdd);
			OnChange();
			RemoveOffScreenSections();
		}
		public ContourSegment GenerateSection(Contour terrain, ContourSegment previousSection, float length, float slope, bool bumpify) {
			return GenerateSection(terrain, previousSection.endPoint, previousSection.distEnd, length, slope, bumpify);
		}
		public List<ContourSegment> GenerateCurve(Contour terrain, ContourSegment previousSection, float sectionLength, float startSlope, float endSlope, bool bumpify) {
			return GenerateCurve(terrain, previousSection.endPoint, previousSection.distEnd, sectionLength, startSlope, endSlope, bumpify);
		}
Beispiel #9
0
	protected override void OnSegmentAdded(ContourSegment section) {
		GenerateIcicles(section);
	}
Beispiel #10
0
	protected override void OnSegmentRemoved(ContourSegment section) {
		RecycleItemsOnSection<SmallIcicle>(section);
	}
Beispiel #11
0
	protected override void OnSegmentAdded(ContourSegment section) {
		if (Random.value < cragProbibility) GenerateCrag(section);
	}
Beispiel #12
0
	private void GenerateCrag(ContourSegment section) {
		GenerateItemOnSegment(section, deltaDistRange.GetRandom());
	}
Beispiel #13
0
		private void OnSectionRemoved(ContourSegment section) {
			RemovePiecesFromSection(section);
		}
Beispiel #14
0
		private void OnSectionAdded(ContourSegment section) {
			AddPiecesToSection(section);
		}
Beispiel #15
0
	protected override void OnSegmentAdded(ContourSegment section) {
		if (Random.value < sectionProbability) GenerateTrees(section);
	}
Beispiel #16
0
	public void SetSection(ContourSegment section) {
		SetWidth(section.length);
		SetEndColliderPosition(section.length);
		Vector2 startPoint = section.GetWorldStartPoint();
		transform.position = new Vector3(startPoint.x, startPoint.y, -0.1f);
	}
Beispiel #17
0
		private void DrawGizmosForSection(ContourSegment section, bool withEndPoint) {
			DrawGizmoForPoint(section.startPoint);
			foreach (Vector2 point in section.midPoints) DrawGizmoForPoint(point);
			if (withEndPoint) DrawGizmoForPoint(section.endPoint);
		}