Class AbstractMinimap
Abstract minimap that contains basic functions for minimap.
Implements
Namespace: nickmaltbie.MinimapTools.Minimap
Assembly: cs.temp.dll.dll
Syntax
public abstract class AbstractMinimap : MonoBehaviour, IMinimap
Fields
backgroundImage
Background image for the minimap.
Declaration
protected Texture2D backgroundImage
Field Value
Type | Description |
---|---|
Texture2D |
backgroundRt
Transform of background image.
Declaration
protected RectTransform backgroundRt
Field Value
Type | Description |
---|---|
RectTransform |
defaultShape
Default bounds for the minimap.
Declaration
public static readonly MinimapSquare defaultShape
Field Value
Type | Description |
---|---|
MinimapSquare |
icons
Collection of icons contained in this minimap.
Declaration
protected Dictionary<IMinimapIcon, GameObject> icons
Field Value
Type | Description |
---|---|
Dictionary<IMinimapIcon, GameObject> |
maskShape
Shape of the minimap mask.
Declaration
protected Sprite maskShape
Field Value
Type | Description |
---|---|
Sprite |
Properties
MapOffset
Map offset for the minimap relative to the map size. A value of (0,0) would indicate centered map. A value of (1,1) would indicate shift the minimap by 1 unit of the minimap viewing area.
Declaration
public abstract Vector2 MapOffset { get; }
Property Value
Type | Description |
---|---|
Vector2 |
MapScale
Scale factor for map on screen.
Declaration
public abstract float MapScale { get; }
Property Value
Type | Description |
---|---|
Single |
MinimapBounds
Get the MinimapSquare version of the minimap bounds.
Declaration
protected MinimapSquare MinimapBounds { get; }
Property Value
Type | Description |
---|---|
MinimapSquare |
PixelsPerUnit
Number of pixels per unit of the minimap size.
Declaration
public float PixelsPerUnit { get; }
Property Value
Type | Description |
---|---|
Single | Returns the number of pixels per unit for sizing the minimap. |
Source
Source of shape for the minimap.
Declaration
protected abstract MinimapBoundsSource Source { get; }
Property Value
Type | Description |
---|---|
MinimapBoundsSource |
Methods
AddIcon(IMinimapIcon)
Add an icon to the minimap.
Declaration
public virtual bool AddIcon(IMinimapIcon minimapIcon)
Parameters
Type | Name | Description |
---|---|---|
IMinimapIcon | minimapIcon | Icon to add to the minimap. |
Returns
Type | Description |
---|---|
Boolean | True if the object was added successfully, false otherwise. |
Awake()
Initial minimap setup.
Declaration
public virtual void Awake()
GetMinimapPosition(Vector3)
Translates a position from world space to normalized minimap space.
Declaration
public virtual Vector2 GetMinimapPosition(Vector3 worldPosition)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | worldPosition | Position of the object in world space. |
Returns
Type | Description |
---|---|
Vector2 | Normalized minimap position, will scale positions within the minimap to between (0,0) and (1,1). |
GetRotation()
Get the rotation of the minimap with respect to the vertical axis.
Declaration
public float GetRotation()
Returns
Type | Description |
---|---|
Single | Rotation of the minimap in degrees. |
GetSize()
Get the size of the minimap texture in pixels.
Declaration
public Vector2Int GetSize()
Returns
Type | Description |
---|---|
Vector2Int | Vector2Int of the width and height of the minimap. |
GetWorldBounds()
Get the world bounds for the minimap.
Declaration
public IMinimapShape GetWorldBounds()
Returns
Type | Description |
---|---|
IMinimapShape | World bound that the minimap represents. |
LateUpdate()
Move each object following minimap rules.
Declaration
public virtual void LateUpdate()
MapAxisHoriz()
Direction of the axis horizontal along the minimap plane.
Declaration
public Vector3 MapAxisHoriz()
Returns
Type | Description |
---|---|
Vector3 | Horizontal directional vector. |
MapAxisVert()
Direction of the vertical axis along the minimap plane.
Declaration
public Vector3 MapAxisVert()
Returns
Type | Description |
---|---|
Vector3 | Vertical direction vector. |
MapNormal()
Get the normal vector for the plane of this minimap.
Declaration
public Vector3 MapNormal()
Returns
Type | Description |
---|---|
Vector3 | Vector normal to the minimap plane. |
RemoveIcon(IMinimapIcon)
Remove an icon from the minimap.
Declaration
public virtual bool RemoveIcon(IMinimapIcon minimapIcon)
Parameters
Type | Name | Description |
---|---|---|
IMinimapIcon | minimapIcon | Icon to remove to the minimap. |
Returns
Type | Description |
---|---|
Boolean | True if the object was removed successfully, false otherwise. |
Start()
Add any icons from the minimap to this object during the start.
Declaration
public virtual void Start()
UpdateMinimapIconPosition(IMinimapIcon)
Update the position of a minimap icon based on its current position.
Declaration
protected virtual void UpdateMinimapIconPosition(IMinimapIcon icon)
Parameters
Type | Name | Description |
---|---|---|
IMinimapIcon | icon | icon to update position of. |