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); }
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); } }
private void GenerateTrees(ContourSegment section) { GenerateItemsOnSection(section, deltaDistRange); }
protected override void OnSegmentRemoved(ContourSegment section) { RecycleItemsOnSection<FirTree>(section); }
private void RemoveSection(ContourSegment section) { sections.Remove(section); if (SignalSegmentRemoved != null) SignalSegmentRemoved(section); GameObject.Destroy(section.gameObject, 0.5f); OnChange(); }
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); }
protected override void OnSegmentAdded(ContourSegment section) { GenerateIcicles(section); }
protected override void OnSegmentRemoved(ContourSegment section) { RecycleItemsOnSection<SmallIcicle>(section); }
protected override void OnSegmentAdded(ContourSegment section) { if (Random.value < cragProbibility) GenerateCrag(section); }
private void GenerateCrag(ContourSegment section) { GenerateItemOnSegment(section, deltaDistRange.GetRandom()); }
private void OnSectionRemoved(ContourSegment section) { RemovePiecesFromSection(section); }
private void OnSectionAdded(ContourSegment section) { AddPiecesToSection(section); }
protected override void OnSegmentAdded(ContourSegment section) { if (Random.value < sectionProbability) GenerateTrees(section); }
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); }
private void DrawGizmosForSection(ContourSegment section, bool withEndPoint) { DrawGizmoForPoint(section.startPoint); foreach (Vector2 point in section.midPoints) DrawGizmoForPoint(point); if (withEndPoint) DrawGizmoForPoint(section.endPoint); }