Basic entity scripting

This commit is contained in:
Simon Lübeß
2023-03-29 13:33:34 +02:00
parent 5e5134a607
commit e60d74fccd
23 changed files with 1193 additions and 89 deletions
+53
View File
@@ -0,0 +1,53 @@
using System;
namespace GlitchyEngine.Math;
public struct Vector2
{
public static readonly Vector2 Zero = new(0.0f, 0.0f);
public static readonly Vector2 UnitX = new(1.0f, 0.0f);
public static readonly Vector2 UnitY = new(0.0f, 1.0f);
public static readonly Vector2 One = new(0.0f, 0.0f);
public const int ComponentCount = 2;
public float X, Y;
public Vector2()
{
X = Y = 0.0f;
}
public Vector2(float x, float y)
{
X = x;
Y = y;
}
public float this[int index]
{
get
{
switch(index)
{
case 0: return X;
case 1: return Y;
default: throw new IndexOutOfRangeException();
}
}
set
{
switch(index)
{
case 0:
X = value;
break;
case 1:
Y = value;
break;
default: throw new IndexOutOfRangeException();
}
}
}
}