BomberUnits
...a Unity learning project
Helpers Class Reference

Contains various static helpful functions usable from any other component. More...

+ Collaboration diagram for Helpers:

Static Public Member Functions

static void Shuffle< T > (this IList< T > list)
 Provides Fisher-Yates in-place shuffling for any list-interface object.
 
static int GetUID ()
 Provides unique integers between 1 and 9999 to be used as UID. More...
 
static void RunLater (MonoBehaviour behaviour, System.Action method, float waitSeconds)
 Like MonoBehavior.Invoke("FunctionName", 2f); but can include params. More...
 
static IEnumerator RunLaterCoroutine (System.Action method, float waitSeconds)
 Coroutine to enable the 'RunLater' helper.
 
static string ToString (this IDictionary dict, string name)
 Prints the content of any dictionary. More...
 
static int GetTilesLayerMask ()
 
static int GetPlayerLayerMask ()
 
static int GetTileObjectLayerMask ()
 
static Vector3 RoundTo (this Vector3 v, float fraction)
 
static GameObject EnsureTopLevelParent (string name)
 

Static Public Attributes

static readonly int tilesLayerNr = 9
 
static readonly int playerLayerNr = 10
 
static readonly int tileObjectLayerNr = 14
 

Static Private Attributes

static List< int > UIDs = new List<int>()
 UID list to ensure uniqueness.
 

Detailed Description

Contains various static helpful functions usable from any other component.

Definition at line 15 of file Helpers.cs.

Member Function Documentation

◆ GetUID()

static int GetUID ( )
inlinestatic

Provides unique integers between 1 and 9999 to be used as UID.

Uniqueness is verified by checking against a static list of all UIDs.

Definition at line 46 of file Helpers.cs.

◆ RunLater()

static void RunLater ( MonoBehaviour  behaviour,
System.Action  method,
float  waitSeconds 
)
inlinestatic

Like MonoBehavior.Invoke("FunctionName", 2f); but can include params.

Usage: Utils.RunLater( ()=> FunctionName(true, Vector.one, "or whatever parameters you want"), 2f); If no behaviour to run the coroutine from is given, the GameManager will be used.

Definition at line 60 of file Helpers.cs.

◆ ToString()

static string ToString ( this IDictionary  dict,
string  name 
)
inlinestatic

Prints the content of any dictionary.

Visuals depend on the content's ToString() implementations.

Definition at line 82 of file Helpers.cs.


The documentation for this class was generated from the following file: