예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }