Demote Unity config MessagePack metadata

This commit is contained in:
Meta Vens 2026-06-13 11:14:38 +01:00
commit 64e596d92d
10 changed files with 84 additions and 106 deletions

View file

@ -1,9 +1,7 @@
using System;
using MessagePack;
[MessagePackObject]
public class EnumDictionary<E, T> where E : Enum
{
[Key(0)] public T[] Values;
public T[] Values;
public EnumDictionary()
{
@ -11,4 +9,4 @@ public class EnumDictionary<E, T> where E : Enum
}
public T this[E key] => Values[Convert.ToInt32(key)];
}
}

View file

@ -1,84 +1,80 @@
using System;
using MessagePack;
using Unity.Mathematics;
using static Unity.Mathematics.math;
using static Unity.Mathematics.noise;
using float2 = Unity.Mathematics.float2;
[Serializable, MessagePackObject]
[Serializable]
public class ZoneEnvironment
{
[Key(0)] public NebulaSettings Nebula;
[Key(1)] public FlowSettings Flow;
[Key(2)] public NoiseSettings Noise;
[Key(3)] public AmbientLightingSettings Lighting;
[Key(4)] public GridSettings Grid;
public NebulaSettings Nebula;
public FlowSettings Flow;
public NoiseSettings Noise;
public AmbientLightingSettings Lighting;
public GridSettings Grid;
}
[Serializable, MessagePackObject]
[Serializable]
public class NebulaSettings
{
[Key(0)] public float FillDensity;
[Key(1)] public float FillDistance;
[Key(2)] public float FillExponent;
[Key(12)] public float FillOffset;
[Key(3)] public float PatchDensity;
[Key(4)] public float FloorOffset;
[Key(5)] public float FloorBlend;
[Key(6)] public float PatchBlend;
[Key(7)] public float Luminance;
[Key(13)] public float Extinction;
//[Key(8)] public float TintExponent;
[Key(9)] public float TintLodExponent;
[Key(10)] public float SafetyDistance;
public float FillDensity;
public float FillDistance;
public float FillExponent;
public float FillOffset;
public float PatchDensity;
public float FloorOffset;
public float FloorBlend;
public float PatchBlend;
public float Luminance;
public float Extinction;
public float TintLodExponent;
public float SafetyDistance;
}
[Serializable, MessagePackObject]
[Serializable]
public class GridSettings
{
[Key(0)] public bool Enabled;
[Key(1)] public float Offset;
public bool Enabled;
public float Offset;
}
[Serializable, MessagePackObject]
[Serializable]
public class AmbientLightingSettings
{
[Key(0)] public float DynamicSkyBoost;
[Key(1)] public float DynamicLodHigh;
[Key(2)] public float DynamicLodLow;
[Key(3)] public float DynamicIntensity;
public float DynamicSkyBoost;
public float DynamicLodHigh;
public float DynamicLodLow;
public float DynamicIntensity;
}
[Serializable, MessagePackObject]
[Serializable]
public class FlowSettings
{
[Key(0)] public float GlobalScale;
[Key(1)] public float GlobalAmplitude;
[Key(2)] public float GlobalScrollSpeed;
[Key(3)] public float Period;
[Key(4)] public float SlopeAmplitude;
[Key(5)] public float SwirlAmplitude;
public float GlobalScale;
public float GlobalAmplitude;
public float GlobalScrollSpeed;
public float Period;
public float SlopeAmplitude;
public float SwirlAmplitude;
}
[Serializable, MessagePackObject]
[Serializable]
public class NoiseSettings
{
[Key(0)] public float Scale;
[Key(1)] public float Amplitude;
[Key(2)] public float Exponent;
[Key(3)] public float Speed;
[Key(4)] public float SlopeExponent;
public float Scale;
public float Amplitude;
public float Exponent;
public float Speed;
public float SlopeExponent;
}
[Union(0, typeof(PowerBrush)),
Union(1, typeof(SimplexBrush)),
Serializable, MessagePackObject]
[Serializable]
public abstract class Brush
{
[Key(0)] public BrushLayer LayerMask;
[Key(1)] public float Cutoff;
[Key(2)] public float Depth;
[Key(3)] public float EnvelopeExponent;
public BrushLayer LayerMask;
public float Cutoff;
public float Depth;
public float EnvelopeExponent;
float powerPulse( float x, float power )
{
@ -97,7 +93,7 @@ public abstract class Brush
}
}
[Serializable, MessagePackObject]
[Serializable]
public class PowerBrush : Brush
{
protected override float Evaluate(float2 world, float2 uv)
@ -106,26 +102,25 @@ public class PowerBrush : Brush
}
}
[Serializable, MessagePackObject]
[Serializable]
public abstract class TextureBrush : Brush
{
[Key(4)] public float2 Frequency;
[Key(5)] public float2 Phase;
public float2 Frequency;
public float2 Phase;
}
[Serializable, MessagePackObject]
[Serializable]
public abstract class AnimatedBrush : TextureBrush
{
[Key(6)] public float AnimationSpeed;
public float AnimationSpeed;
[IgnoreMember]
public float Time { get; set; }
}
[Serializable, MessagePackObject]
[Serializable]
public class SimplexBrush : TextureBrush
{
[Key(6)] public bool AbsoluteValue;
public bool AbsoluteValue;
protected override float Evaluate(float2 world, float2 uv)
{
@ -134,10 +129,10 @@ public class SimplexBrush : TextureBrush
}
}
[Serializable, MessagePackObject]
[Serializable]
public class AnimatedSimplexBrush : AnimatedBrush
{
[Key(7)] public bool AbsoluteValue;
public bool AbsoluteValue;
protected override float Evaluate(float2 world, float2 uv)
{
@ -146,10 +141,10 @@ public class AnimatedSimplexBrush : AnimatedBrush
}
}
[Serializable, MessagePackObject]
[Serializable]
public class RadialWaveBrush : TextureBrush
{
[Key(7)] public float WaveExponent;
public float WaveExponent;
protected override float Evaluate(float2 world, float2 uv)
{

View file

@ -5,35 +5,34 @@
using System;
using System.Collections;
using System.Collections.Generic;
using MessagePack;
using Unity.Mathematics;
using static Unity.Mathematics.math;
[Serializable, MessagePackObject]
[Serializable]
public class ExponentialCurve
{
[Key(0), Inspectable]
[Inspectable]
public float Exponent;
[Key(1), Inspectable]
[Inspectable]
public float Multiplier;
[Key(2), Inspectable]
[Inspectable]
public float Constant;
public float Evaluate(float value) => Multiplier * pow(value, Exponent) + Constant;
}
[Serializable, MessagePackObject]
[Serializable]
public class ExponentialLerp
{
[Key(0), Inspectable]
[Inspectable]
public float Exponent;
[Key(1), Inspectable]
[Inspectable]
public float Minimum;
[Key(2), Inspectable]
[Inspectable]
public float Maximum;
public float Evaluate(float value) => Minimum + pow(saturate(value), Exponent) * (Maximum - Minimum);

View file

@ -5,12 +5,11 @@
using System;
using System.Collections;
using System.Collections.Generic;
using MessagePack;
using Unity.Mathematics;
using static Unity.Mathematics.math;
using static Unity.Mathematics.noise;
[Serializable, MessagePackObject(keyAsPropertyName:true)]
[Serializable]
public class PlanetSettings
{
public float ZoneDepthExponent;
@ -35,7 +34,7 @@ public class PlanetSettings
public ExponentialCurve OrbitPeriod;
}
[Serializable, MessagePackObject(keyAsPropertyName:true)]
[Serializable]
public class GalaxyShapeSettings
{
public int Arms = 4;
@ -43,7 +42,7 @@ public class GalaxyShapeSettings
public float TwistExponent = 2;
}
[Serializable, MessagePackObject(keyAsPropertyName:true)]
[Serializable]
public class NameGeneratorSettings
{
public int NameGeneratorMinLength = 5;
@ -51,7 +50,7 @@ public class NameGeneratorSettings
public int NameGeneratorOrder = 4;
}
[Serializable, MessagePackObject(keyAsPropertyName:true)]
[Serializable]
public class SectorBackgroundSettings
{
public float NoiseAmplitude;
@ -85,7 +84,7 @@ public class SectorBackgroundSettings
}
}
[Serializable, MessagePackObject(keyAsPropertyName:true)]
[Serializable]
public class SectorGenerationSettings
{
public float LinkDensity = .5f;
@ -94,7 +93,7 @@ public class SectorGenerationSettings
public int BossCount;
}
[Serializable, MessagePackObject(keyAsPropertyName:true)]
[Serializable]
public class TutorialGenerationSettings
{
public string ProtagonistFaction;
@ -106,7 +105,7 @@ public class TutorialGenerationSettings
public int ZoneCount = 32;
}
[Serializable, MessagePackObject(keyAsPropertyName:true)]
[Serializable]
public class ZoneGenerationSettings
{
public ExponentialCurve PlanetSafetyRadius;
@ -151,7 +150,7 @@ public class ZoneGenerationSettings
public string[] NameData;
}
[Serializable, MessagePackObject(keyAsPropertyName: true)]
[Serializable]
public class GameplaySettings
{
public EntitySettings DefaultEntitySettings;
@ -213,11 +212,11 @@ public class GameplaySettings
public float AgentFiringMinDot = .99f;
}
[Serializable, MessagePackObject(keyAsPropertyName: true)]
[Serializable]
public class RarityTier
{
public string Name;
public float Quality;
public float3 Color;
public float Rarity;
}
}

View file

@ -1,20 +1,9 @@
using MessagePack;
[MessagePackObject]
public class WwiseSoundBinding
{
[Key(0)]
public uint PlayEvent;
}
[MessagePackObject]
public class WwiseLoopingSoundBinding : WwiseSoundBinding
{
[Key(1)]
public uint StopEvent;
}
// public class WwiseParameterBinding
// {
// [Key(0)]
// public uint Parameter;
// }