using System; using System.Collections.Generic; using System.Numerics; using System.Text.Json; using BubbleSocketCore.Input; namespace BubbleSocketCore.Simulation.Entity { class CircleEntity : IEntity { private int Id; private Vector2 Position; private Vector2 Center; private float Radius; private float Speed; public CircleEntity() { Center = new Vector2(150, 75); Radius = 70.0f; Speed = 2; } public IEntity ApplyInputs(int elapsedTick, List inputs) { long millis = elapsedTick * TickService.simulationTickRateInMs; Position.X = Radius * (float)Math.Cos(millis / (Speed * 1000.0)) + Center.X; Position.Y = Radius * (float)Math.Sin(millis / (Speed * 1000.0)) + Center.Y; return this; } public IEntity Clone() { return new CircleEntity(); } public int GetId() { return Id; } public Dictionary Serialize() { return new Dictionary{ { "id", Id }, {"position", new List { Position.X, Position.Y } }, }; } public void SetId(int entityId) { Id = entityId; } public override string ToString() { return JsonSerializer.Serialize(Serialize()); } } }