2026-06-13 04:30:24 +01:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2020-12-22 03:13:43 +00:00
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
|
|
using System;
|
2020-03-22 19:05:26 +00:00
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
2020-11-29 22:50:12 +00:00
|
|
|
using UniRx;
|
2020-03-24 00:02:23 +00:00
|
|
|
using Unity.Mathematics;
|
2020-03-29 04:19:24 +01:00
|
|
|
using static Unity.Mathematics.math;
|
2021-03-08 22:58:37 +00:00
|
|
|
using float2 = Unity.Mathematics.float2;
|
2020-11-29 22:50:12 +00:00
|
|
|
using float3 = Unity.Mathematics.float3;
|
2020-03-22 19:05:26 +00:00
|
|
|
|
2026-06-13 18:06:59 +01:00
|
|
|
public class RuntimeZoneBlueprint
|
2020-11-27 22:47:33 +00:00
|
|
|
{
|
2020-11-29 22:50:12 +00:00
|
|
|
public List<BodyData> Planets = new List<BodyData>();
|
2020-11-27 22:47:33 +00:00
|
|
|
public List<OrbitData> Orbits = new List<OrbitData>();
|
2026-06-13 18:06:59 +01:00
|
|
|
public List<RuntimeEntityBlueprint> Entities = new List<RuntimeEntityBlueprint>();
|
2021-03-15 11:40:46 +00:00
|
|
|
public float Radius = 2000;
|
|
|
|
|
public float Mass = 10000;
|
2021-03-27 10:03:24 +00:00
|
|
|
public double Time;
|
2020-11-27 22:47:33 +00:00
|
|
|
}
|
|
|
|
|
|
2026-06-13 20:19:00 +01:00
|
|
|
public abstract class BodyData : RuntimeProjectionEntry, INamedEntry
|
2020-03-22 19:05:26 +00:00
|
|
|
{
|
2025-07-18 00:21:33 +01:00
|
|
|
public string Name = "";
|
2020-04-09 07:48:45 +01:00
|
|
|
|
2020-03-22 19:05:26 +00:00
|
|
|
public Guid Orbit;
|
2020-04-09 07:48:45 +01:00
|
|
|
|
2025-07-18 00:21:33 +01:00
|
|
|
public float Mass = 0;
|
2020-04-09 07:48:45 +01:00
|
|
|
|
|
|
|
|
public Dictionary<Guid, float> Resources = new Dictionary<Guid, float>();
|
2020-05-02 01:30:33 +01:00
|
|
|
|
2025-07-18 00:21:33 +01:00
|
|
|
public float BodyRadiusMultiplier = 1;
|
2020-12-01 00:16:11 +00:00
|
|
|
|
2025-07-18 00:21:33 +01:00
|
|
|
public float GravityRadiusMultiplier = 1;
|
2020-11-27 22:47:33 +00:00
|
|
|
|
2025-07-18 00:21:33 +01:00
|
|
|
public float GravityDepthMultiplier = 1;
|
2020-11-29 22:50:12 +00:00
|
|
|
|
2025-07-18 00:21:33 +01:00
|
|
|
public float GravityDepthExponent = 16;
|
2026-06-13 04:56:50 +01:00
|
|
|
|
2026-06-13 11:03:30 +01:00
|
|
|
public string EntryName
|
2020-03-22 19:05:26 +00:00
|
|
|
{
|
2025-07-18 00:21:33 +01:00
|
|
|
get => Name;
|
|
|
|
|
set => Name = value;
|
2020-03-22 19:05:26 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-29 22:50:12 +00:00
|
|
|
public class PlanetData : BodyData
|
2020-11-27 22:47:33 +00:00
|
|
|
{
|
2026-06-13 04:56:50 +01:00
|
|
|
|
2020-11-29 22:50:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class AsteroidBeltData : BodyData
|
|
|
|
|
{
|
2020-11-27 22:47:33 +00:00
|
|
|
public Asteroid[] Asteroids;
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-29 22:50:12 +00:00
|
|
|
public class GasGiantData : BodyData
|
2020-11-27 22:47:33 +00:00
|
|
|
{
|
2025-07-18 00:21:33 +01:00
|
|
|
public float FirstOffsetDomainRotationSpeed = 1;
|
2026-06-13 04:56:50 +01:00
|
|
|
|
2025-07-18 00:21:33 +01:00
|
|
|
public float FirstOffsetRotationSpeed = 1;
|
2026-06-13 04:56:50 +01:00
|
|
|
|
2025-07-18 00:21:33 +01:00
|
|
|
public float SecondOffsetDomainRotationSpeed = 1;
|
2026-06-13 04:56:50 +01:00
|
|
|
|
2025-07-18 00:21:33 +01:00
|
|
|
public float SecondOffsetRotationSpeed = 1;
|
2026-06-13 04:56:50 +01:00
|
|
|
|
2025-07-18 00:21:33 +01:00
|
|
|
public float AlbedoRotationSpeed = 1;
|
2020-12-01 00:16:11 +00:00
|
|
|
|
2025-07-18 00:21:33 +01:00
|
|
|
public float WaveRadiusMultiplier = 1;
|
2020-12-01 00:16:11 +00:00
|
|
|
|
2025-07-18 00:21:33 +01:00
|
|
|
public float WaveDepthMultiplier = 1;
|
2020-12-01 00:16:11 +00:00
|
|
|
|
2025-07-18 00:21:33 +01:00
|
|
|
public float WaveDepthExponent = 8;
|
2020-12-01 00:16:11 +00:00
|
|
|
|
2025-07-18 00:21:33 +01:00
|
|
|
public float WaveSpeedMultiplier = 8;
|
2026-06-13 04:56:50 +01:00
|
|
|
|
2020-11-27 22:47:33 +00:00
|
|
|
public List<string> MaterialOverrides = new List<string>();
|
2026-06-13 04:56:50 +01:00
|
|
|
|
2025-07-18 00:21:33 +01:00
|
|
|
public float4[] Colors = new float4[0];
|
2020-11-27 22:47:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class SunData : GasGiantData
|
|
|
|
|
{
|
2025-07-18 00:21:33 +01:00
|
|
|
public float3 LightColor = float3.zero;
|
2026-06-13 04:56:50 +01:00
|
|
|
|
2025-07-18 00:21:33 +01:00
|
|
|
public float3 FogTintColor = float3.zero;
|
2021-04-12 04:20:52 +01:00
|
|
|
|
2025-07-18 00:21:33 +01:00
|
|
|
public float LightRadiusMultiplier = 1;
|
2020-11-27 22:47:33 +00:00
|
|
|
}
|
|
|
|
|
|
2020-05-28 04:50:40 +01:00
|
|
|
public class Asteroid
|
|
|
|
|
{
|
|
|
|
|
public float Distance;
|
2026-06-13 04:56:50 +01:00
|
|
|
|
2020-05-28 04:50:40 +01:00
|
|
|
public float Phase;
|
2026-06-13 04:56:50 +01:00
|
|
|
|
2020-05-28 04:50:40 +01:00
|
|
|
public float Size;
|
2026-06-13 04:56:50 +01:00
|
|
|
|
2020-05-28 04:50:40 +01:00
|
|
|
public float RotationSpeed;
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-13 20:19:00 +01:00
|
|
|
public class OrbitData : RuntimeProjectionEntry
|
2020-03-22 19:05:26 +00:00
|
|
|
{
|
2020-03-29 04:19:24 +01:00
|
|
|
public Guid Parent;
|
2020-04-09 07:48:45 +01:00
|
|
|
|
2025-07-18 00:21:33 +01:00
|
|
|
public float Distance;
|
2020-04-09 07:48:45 +01:00
|
|
|
|
2020-03-22 19:05:26 +00:00
|
|
|
public float Phase;
|
2026-06-13 04:56:50 +01:00
|
|
|
|
2021-03-08 22:58:37 +00:00
|
|
|
public float2 FixedPosition = float2.zero;
|
2026-06-13 04:56:50 +01:00
|
|
|
|
2020-03-29 04:19:24 +01:00
|
|
|
public static float2 Evaluate(float phase)
|
|
|
|
|
{
|
2020-05-10 00:16:33 +01:00
|
|
|
phase *= PI * 2;
|
2020-05-27 03:43:30 +01:00
|
|
|
return new float2(cos(phase), sin(phase));
|
2020-03-29 04:19:24 +01:00
|
|
|
}
|
2026-06-13 08:15:17 +01:00
|
|
|
}
|