Files
SteveGibson 0f5e0b6a30 Blackholio Rebrand and Polish (#11)
* Circle splitting and recombining;
Client re-coloring

* Renamed Entity.id into Entity.entity_id

* Client refactor; Polish; Bugfixes

* Store username between game runs

* Renamed EntityActor.OnUpdate to OnEntityUpdate

* [WIP] C# server

* [WIP] C# server

* Changed `DateTimeOffset` to `long` in C# module

* Parallax background

* Animate entities when they get consumed

* Fixed respawn button

* Draft into Steve's branch (#12)

* Small changes

* Changes to align with the tutorial.

* Fixed rebase issue

* Merged ConnectionManager and EntityManager into GameManager for tutorial simplicity

* Renaming Actor -> Controller for simplicity's sake, although Actor is a good name

* actor -> entityController

* Merged ArenaController into GameManager for simplicity and cleaned up a few things

* Small cleanup to keep it in line with the tutorial

* Small changes to how overlapping works

* Rebrand to Blackholio

* Rebrand to Blackholio (missed one)

* Added a README.md

* fixed readme

---------

Co-authored-by: Steve Gibson <steve@clockwokrlabs.io>
Co-authored-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
Co-authored-by: Tyler Cloutier <cloutiertyler@aol.com>
2025-01-18 01:10:32 -05:00

25 lines
721 B
C#

using System;
[SpacetimeDB.Type]
public partial struct DbVector2
{
public float x;
public float y;
public DbVector2(float x, float y)
{
this.x = x;
this.y = y;
}
public float SqrMagnitude => x * x + y * y;
public float Magnitude => MathF.Sqrt(SqrMagnitude);
public DbVector2 Normalized => this / Magnitude;
public static DbVector2 operator +(DbVector2 a, DbVector2 b) => new DbVector2(a.x + b.x, a.y + b.y);
public static DbVector2 operator -(DbVector2 a, DbVector2 b) => new DbVector2(a.x - b.x, a.y - b.y);
public static DbVector2 operator *(DbVector2 a, float b) => new DbVector2(a.x * b, a.y * b);
public static DbVector2 operator /(DbVector2 a, float b) => new DbVector2(a.x / b, a.y / b);
}