First Flight

Added MPL license headers
SectorRenderer renders entities in sector, manages particle systems for ship thrusters
Thrusters apply torque based on orientation and position relative to ship center of mass
GameManager controls the player ship's thrusters
Player can dock with station if they are near
This commit is contained in:
Reinier Vens 2020-12-22 03:13:43 +00:00
commit c4be204cd0
172 changed files with 6753 additions and 779 deletions

View file

@ -5,12 +5,14 @@ using System.Linq;
using System.Numerics;
using System.Reflection;
using System.Text.RegularExpressions;
using Grpc.Core;
using LiteNetLib;
using MessagePack;
using Unity.Mathematics;
using static Unity.Mathematics.math;
using Random = Unity.Mathematics.Random;
using Unity.Tiny;
using float2 = Unity.Mathematics.float2;
public static class Extensions
{
@ -60,6 +62,40 @@ public static class Extensions
throw new ArgumentOutOfRangeException(nameof(rot), rot, null);
}
}
public static float2 Direction(this ItemRotation rotation)
{
switch (rotation)
{
case ItemRotation.None:
return float2(0, 1);
case ItemRotation.CounterClockwise:
return float2(-1, 0);
case ItemRotation.Reversed:
return float2(0, -1);
case ItemRotation.Clockwise:
return float2(1, 0);
default:
throw new ArgumentOutOfRangeException(nameof(rotation), rotation, null);
}
}
public static float2 Rotate(this float2 v, ItemRotation rotation)
{
switch (rotation)
{
case ItemRotation.None:
return v;
case ItemRotation.CounterClockwise:
return float2(-v.y, v.x);
case ItemRotation.Reversed:
return float2(-v.x, -v.y);
case ItemRotation.Clockwise:
return float2(v.y, -v.x);
default:
throw new ArgumentOutOfRangeException(nameof(rotation), rotation, null);
}
}
public static string SplitCamelCase( this string str )
{