public void SetStreetLight(NetInfo prefab, PropInfo prop) { var newSegmentData = new SegmentData(SegmentDataManager.Instance.GetActiveOptions(prefab)); if (prop != GetDefaultStreetLight(prefab)) { newSegmentData.SetPrefabFeature(SegmentData.FeatureFlags.StreetLight, prop); } else { newSegmentData.UnsetFeature(SegmentData.FeatureFlags.StreetLight); } SegmentDataManager.Instance.SetActiveOptions(prefab, newSegmentData); }
public void SetTree(NetInfo prefab, LanePosition position, TreeInfo tree) { var newSegmentData = new SegmentData(SegmentDataManager.Instance.GetActiveOptions(prefab)); if (tree != GetDefaultTree(prefab, position)) { newSegmentData.SetPrefabFeature(position.ToTreeFeatureFlag(), tree); } else { newSegmentData.UnsetFeature(position.ToTreeFeatureFlag()); } SegmentDataManager.Instance.SetActiveOptions(prefab, newSegmentData); }
public void SetStreetLightDistance(NetInfo prefab, float val) { var newSegmentData = new SegmentData(SegmentDataManager.Instance.GetActiveOptions(prefab)); var distanceVector = newSegmentData.RepeatDistances; distanceVector.w = Math.Abs(val - GetDefaultStreetLightDistance(prefab)) > .01f ? val : 0f; if (distanceVector != Vector4.zero) { newSegmentData.SetStructFeature(SegmentData.FeatureFlags.RepeatDistances, distanceVector); } else { newSegmentData.UnsetFeature(SegmentData.FeatureFlags.RepeatDistances); } SegmentDataManager.Instance.SetActiveOptions(prefab, newSegmentData); }
public void SetTreeDistance(NetInfo prefab, LanePosition position, float val) { var newSegmentData = new SegmentData(SegmentDataManager.Instance.GetActiveOptions(prefab)); var distanceVector = newSegmentData.RepeatDistances; var value = Mathf.Abs(val - GetDefaultTreeDistance(prefab, position)) > .01f ? val : 0f; switch (position) { case LanePosition.Left: distanceVector.x = value; break; case LanePosition.Middle: distanceVector.y = value; break; case LanePosition.Right: distanceVector.z = value; break; default: throw new ArgumentOutOfRangeException(nameof(position)); } if (distanceVector != Vector4.zero) { newSegmentData.SetStructFeature(SegmentData.FeatureFlags.RepeatDistances, distanceVector); } else { newSegmentData.UnsetFeature(SegmentData.FeatureFlags.RepeatDistances); } SegmentDataManager.Instance.SetActiveOptions(prefab, newSegmentData); }