Add initial game code

This commit is contained in:
Aslan 2025-09-12 08:34:06 -04:00
parent f80a60e208
commit 1383997ebf
55 changed files with 1355 additions and 0 deletions

37
scripts/GameObject.cs Normal file
View file

@ -0,0 +1,37 @@
public partial class GameObject
{
public string Name { get; private set; }
public CoordinateVector Position { get; private set; }
public CoordinateVector Size { get; private set; }
public GameObject Parent { get; private set; }
public GameObject(string name, CoordinateVector position, CoordinateVector size, GameObject parent)
{
this.Name = name;
this.Position = position;
this.Size = size;
this.Parent = parent;
}
public virtual void Simulate() { }
public void Move(CoordinateVector movementVector)
{
this.Position = Helpers.AddCoordinates(this.Position, movementVector);
}
public void MoveTo(CoordinateVector destination)
{
this.Position = destination;
}
public bool TravelTo(CoordinateVector destination, bool useWarp)
{
decimal speedAU = useWarp ? 10000 : 0.1M;
decimal speed = Helpers.GetCoordinateFromAU(speedAU);
this.Position = Helpers.CalculateMovedCoordinates(this.Position, destination, speed);
return Helpers.CompareCoordinates(this.Position, destination);
}
}