25 lines
934 B
C#
25 lines
934 B
C#
namespace Pong.Scripts.Data;
|
|
|
|
/// <summary>
|
|
/// simple wrapper structure to a double that makes it easy to get commonly used calculations of the number.
|
|
/// </summary>
|
|
/// <param name="Coordinate">the coordinate you want to wrap.</param>
|
|
public readonly record struct GameCoordinate(float Coordinate)
|
|
{
|
|
/// <summary>
|
|
/// the original coordinate. you don't really need to use this as the struct has an implicit operator, but
|
|
/// its here if you need it.
|
|
/// </summary>
|
|
public readonly float Coordinate = Coordinate;
|
|
|
|
/// <summary>
|
|
/// get the coordinate but calculated by the extents of the wall size.
|
|
/// </summary>
|
|
public float ByWallSizeExtents => Coordinate - Constants.WallSizeExtents;
|
|
/// <summary>
|
|
/// get the coordinate but calculated by the wall size.
|
|
/// </summary>
|
|
public float ByWallSize => Coordinate - Constants.WallSize;
|
|
|
|
public static implicit operator float(GameCoordinate coord) => coord.Coordinate;
|
|
}
|