Initial ARPG Port

ARPG scene assets from old project are now correctly visualizing sectors generated by ZoneGenerator and updated by GameContext
This commit is contained in:
Reinier Vens 2020-11-27 22:47:33 +00:00
commit d12d7c5c45
379 changed files with 42700 additions and 7253 deletions

View file

@ -4,6 +4,7 @@ using System.Collections.Generic;
using MessagePack;
using Newtonsoft.Json;
using Unity.Mathematics;
using UnityEngine;
using static Unity.Mathematics.math;
[RethinkTable("Galaxy"), MessagePackObject, JsonObject(MemberSerialization.OptIn)]
@ -21,17 +22,17 @@ public class ZoneData : DatabaseEntry, INamedEntry
[JsonProperty("mass"), Key(4)]
public float Mass = 10000;
[JsonProperty("visited"), Key(5)]
public bool Visited;
// [JsonProperty("visited"), Key(5)]
// public bool Visited;
[JsonProperty("wormholes"), Key(6)]
[JsonProperty("wormholes"), Key(5)]
public List<Guid> Wormholes = new List<Guid>();
[JsonProperty("planets"), Key(7)]
public Guid[] Planets;// = new List<Guid>();
[JsonProperty("orbits"), Key(8)]
public List<Guid> Orbits = new List<Guid>();
// [JsonProperty("planets"), Key(7)]
// public Guid[] Planets;// = new List<Guid>();
//
// [JsonProperty("orbits"), Key(8)]
// public List<Guid> Orbits = new List<Guid>();
[IgnoreMember] public string EntryName
{
@ -40,6 +41,28 @@ public class ZoneData : DatabaseEntry, INamedEntry
}
}
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class ZonePack : INamedEntry
{
[JsonProperty("data"), Key(0)]
public ZoneData Data;
[JsonProperty("planets"), Key(1)]
public List<PlanetData> Planets = new List<PlanetData>();
[JsonProperty("orbits"), Key(2)]
public List<OrbitData> Orbits = new List<OrbitData>();
[JsonProperty("entities"), Key(3)]
public List<Entity> Entities = new List<Entity>();
[IgnoreMember] public string EntryName
{
get => Data.Name;
set => Data.Name = value;
}
}
// [RethinkTable("Galaxy"), MessagePackObject, JsonObject(MemberSerialization.OptIn)]
// public class StationData : DatabaseEntry, INamedEntry
// {
@ -72,7 +95,11 @@ public class ZoneData : DatabaseEntry, INamedEntry
// }
// }
[RethinkTable("Galaxy"), MessagePackObject, JsonObject(MemberSerialization.OptIn)]
[MessagePackObject,
JsonObject(MemberSerialization.OptIn),
Union(1, typeof(AsteroidBeltData)),
Union(2, typeof(GasGiantData)),
Union(3, typeof(SunData))]
public class PlanetData : DatabaseEntry, INamedEntry
{
[JsonProperty("name"), Key(1)]
@ -84,20 +111,14 @@ public class PlanetData : DatabaseEntry, INamedEntry
[JsonProperty("mass"), Key(3)]
public float Mass;
[JsonProperty("zone"), Key(4)]
public Guid Zone;
[JsonProperty("belt"), Key(5)]
public bool Belt;
[JsonProperty("resources"), Key(6)]
[JsonProperty("resources"), Key(4)]
public Dictionary<Guid, float> Resources = new Dictionary<Guid, float>();
[JsonProperty("asteroids"), Key(7)]
public Asteroid[] Asteroids; // Distance, Phase, Size, RotationSpeed
// [JsonProperty("radius")] [Key(5)]
// public float GravityRadius;
[JsonProperty("radiusMul")] [Key(5)]
public float GravityRadiusMultiplier = 1;
[JsonProperty("depthMul")] [Key(6)]
public float GravityDepthMultiplier = 1;
[IgnoreMember] public string EntryName
{
@ -106,6 +127,45 @@ public class PlanetData : DatabaseEntry, INamedEntry
}
}
public class AsteroidBeltData : PlanetData
{
[JsonProperty("asteroids"), Key(7)]
public Asteroid[] Asteroids;
}
public class GasGiantData : PlanetData
{
[JsonProperty("firstOffsetDomainRotationSpeed"), Key(7)]
public float FirstOffsetDomainRotationSpeed;
[JsonProperty("firstOffsetRotationSpeed"), Key(8)]
public float FirstOffsetRotationSpeed;
[JsonProperty("secondOffsetDomainRotationSpeed"), Key(9)]
public float SecondOffsetDomainRotationSpeed;
[JsonProperty("secondOffsetRotationSpeed"), Key(10)]
public float SecondOffsetRotationSpeed;
[JsonProperty("albedoRotationSpeed"), Key(11)]
public float AlbedoRotationSpeed;
[JsonProperty("materialOverrides"), Key(12)]
public List<string> MaterialOverrides = new List<string>();
[JsonProperty("colors"), Key(13)]
public Gradient Colors;
}
public class SunData : GasGiantData
{
[JsonProperty("lightColor"), Key(17)]
public Color LightColor;
[JsonProperty("fogTintColor"), Key(18)]
public Color FogTintColor;
}
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class Asteroid
{
@ -115,7 +175,7 @@ public class Asteroid
public float RotationSpeed;
}
[RethinkTable("Galaxy"), MessagePackObject, JsonObject(MemberSerialization.OptIn)]
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class OrbitData : DatabaseEntry
{
[JsonProperty("parent"), Key(1)]
@ -130,9 +190,6 @@ public class OrbitData : DatabaseEntry
[JsonProperty("period"), Key(4)]
public float Period;
[JsonProperty("zone"), Key(5)]
public Guid Zone;
public static float2 Evaluate(float phase)
{
phase *= PI * 2;