/// <summary> /// Constructs a new RftVector with coords (x, y) modulo map dimensions. /// </summary> /// <param name="map">The Base RFT map size</param> /// <param name="x">The x position</param> /// <param name="y">The y position</param> public RftVector(Rft map, float x, float y) { Map = map; this._x = (x % map.Width + map.Width) % map.Width; this._y = (y % map.Height + map.Height) % map.Height; if (this._x > map.Width / 2) { this._x -= map.Width; } if (this._y > map.Height / 2) { this._y -= map.Height; } }
/// <summary> /// Constructs a new RftVector with coords (v.x, v.y) modulo map dimensions. /// </summary> public RftVector(Rft map, Vector2 v) { Map = map; this._x = (v.X % map.Width + map.Width) % map.Width; this._y = (v.Y % map.Height + map.Height) % map.Height; if (this._x > map.Width / 2) { this._x -= map.Width; } if (this._y > map.Height / 2) { this._y -= map.Height; } }
/// <summary> /// Constructs a new RftVector with coords (0, 0). /// </summary> /// <param name="map">The map to wrap RftVectors by</param> public RftVector(Rft map) { Map = map; this._x = 0; this._y = 0; }