Class BackgroundGrid
Inheritance
BackgroundGrid
Assembly: Xareus.Scenarios.Unity.Edition.dll
Syntax
public class BackgroundGrid
Constructors
BackgroundGrid(VisualElement)
Declaration
public BackgroundGrid(VisualElement root)
Parameters
Fields
MAX_ZOOM
Declaration
public static readonly float MAX_ZOOM
Field Value
MIN_ZOOM
Declaration
public static readonly float MIN_ZOOM
Field Value
Properties
BackgroundColor
Declaration
public Color BackgroundColor { get; set; }
Property Value
BackgroundPositionX
Declaration
public StyleBackgroundPosition BackgroundPositionX { get; }
Property Value
| Type |
Description |
| StyleBackgroundPosition |
|
BackgroundPositionY
Declaration
public StyleBackgroundPosition BackgroundPositionY { get; }
Property Value
| Type |
Description |
| StyleBackgroundPosition |
|
BackgroundSize
Declaration
public StyleBackgroundSize BackgroundSize { get; }
Property Value
| Type |
Description |
| StyleBackgroundSize |
|
MainLineColor
Declaration
public Color MainLineColor { get; set; }
Property Value
Offset
Declaration
public Vector2 Offset { get; set; }
Property Value
SecondaryLineColor
Declaration
public Color SecondaryLineColor { get; set; }
Property Value
StyleBackground
Declaration
public StyleBackground StyleBackground { get; }
Property Value
Texture
Declaration
public Texture2D Texture { get; }
Property Value
Zoom
Declaration
public float Zoom { get; set; }
Property Value
Methods
GetMagnetisedPosition(Vector2)
Magnetizes a position to the nearest grid line or intersection
Declaration
public Vector2 GetMagnetisedPosition(Vector2 worldPosition)
Parameters
| Type |
Name |
Description |
| Vector2 |
worldPosition |
Position in world coordinates (unzoomed)
|
Returns
| Type |
Description |
| Vector2 |
Magnetized position if close enough to a line, otherwise the original position
|
Move(Vector2)
Moves the grid by a delta offset
Declaration
public void Move(Vector2 delta)
Parameters
| Type |
Name |
Description |
| Vector2 |
delta |
|
SetZoom(float, Vector2)
Sets zoom level while keeping a specific view position anchored
Declaration
public void SetZoom(float newZoom, Vector2 anchorViewPosition)
Parameters
| Type |
Name |
Description |
| float |
newZoom |
|
| Vector2 |
anchorViewPosition |
|