using System; using Newtonsoft.Json; namespace Nibriboard.RippleSpace { /// /// An abstract class representing a coordinate reference to a location. /// [JsonObject(MemberSerialization.OptIn)] public abstract class Reference : ICloneable { public Plane Plane { get; set; } /// /// The name of the plane that this reference is located on. /// Mainly used by the serialisation system that sends things to the client. /// public string PlaneName { get { return Plane.Name; } } /// /// The x position of this reference. /// [JsonProperty] public T X { get; set; } /// /// The y position of this reference. /// [JsonProperty] public T Y { get; set; } public Reference(Plane inPlane, T inX, T inY) { Plane = inPlane; X = inX; Y = inY; } /// /// Creates a new blank . /// Don't use this yourself! This is only for Newtonsoft.Json to use when deserialising references. /// public Reference() { } public override string ToString() { return $"({X}, {Y}, {Plane.Name})"; } public abstract object Clone(); } }