Skip to main content

MapManager

class SoftKitty.MasterNavigationMap.MapManager : MonoBehaviour

public static void SetPlayer(Transform _playerTransform)

Assigns the player's transform to the Master Map Navigation system.

This function must be called when the scene starts to initialize the player's position.


public static void SetCamera(Camera _camera)

Assigns the player's camera to the Master Map Navigation system. Otherwise Camera.main will be used.

This function must be called when the scene starts to initialize the player's orientation.


public static MapInteractive GetMiniMapInstance()

Retrieve the mini-map instance in the canvas.


public static MapInteractive GetWorldMapInstance()

Retrieve the world-map instance in the canvas.


public static string SaveFog()

Convert the current Fog of War data into a json string.


public static void LoadFog(string _json)

Load the Fog of War data with a json string.


public static void AddFog(Vector3 _worldPos, float _radius)

Cover a world space position with Fog of War by normalized radius (0~1).


public static void RemoveFog(Vector3 _worldPos, float _radius)

Reveal a world space position from Fog of War by normalized radius (0~1).


public static void ClearFog()

Clear all Fog of War from the map.


public static void FillFog()

Cover the whole map with Fog of War.


public static void NavigateToHere(Vector3 _worldPos)

Creates a navigation path from the player's current position to the specified world space position.

_worldPos: The target position in world space.


public static void StopNavigation()

Clears the current navigation path and stops the navigation.


public static void StartTrack(Transform _target)

Start tracking a transform on the mini-map, a white arrow will point to the target on the map.


public static void EndTrack()

Stop tracking a transform on the mini-map and hide the white arrow.


public static MapPoint PlaceMarker(Vector3 _worldPos)

Adding a custom marker on the map to mark points of interest.

Places a marker on the map at the specified world space position.

Return the MapPoint component representing the created marker.


public static void RemoveMarker(MapPoint _point)

Removes a previously placed marker from the map.

_point: The MapPoint component of the marker to be removed.


public static int GetLayerByPosition(Vector3 _pos)

Retrieves the layer ID of the map based on a given world space position. The layer ID where the position resides.

_pos: The target position in world space.


public static List<MapPoint> GetLayerEntrance(int _ownLayer, int _targetLayer)

Retrieves a list of entrance points to move from one map layer _ownLayer to another _targetLayer.

_ownLayer: The current layer ID.

_targetLayer: The destination layer ID.


public static MapPoint GetLayerClosestEntrance(int _ownLayer, int _targetLayer)

Finds the closest entrance point between one map layer _ownLayer to another _targetLayer.

_ownLayer: The current layer ID.

_targetLayer: The destination layer ID.