Tilt Five Unity API  1.3.0
Classes | Static Public Member Functions | Public Attributes | Static Private Attributes | List of all members
TiltFive.GameBoard Class Reference

Represents the game board. More...

Inheritance diagram for TiltFive.GameBoard:
TiltFive.UniformScaleTransform

Classes

struct  GameboardDimensions
 

Static Public Member Functions

static bool TryGetGameboardType (out GameboardType gameboardType)
 Attempts to check the latest glasses pose for the current gameboard type, such as LE, XE, or none. More...
 
static bool TryGetGameboardType (PlayerIndex playerIndex, out GameboardType gameboardType)
 
static bool TryGetGameboardDimensions (GameboardType gameboardType, out GameboardDimensions gameboardDimensions)
 Attempts to obtain the physical dimensions for a particular gameboard type. More...
 

Public Attributes

bool ShowGizmo
 Shows the game board gizmo in the editor. More...
 
bool ShowGrid
 
float GridHeightOffset = 0f
 
bool StickyHeightOffset = true
 
float GizmoOpacity = 0.75f
 Sets the opacity of the game board gizmo in the editor. More...
 
GameboardType GameboardType
 The gameboard configuration, such as LE, XE, or folded XE. More...
 

Static Private Attributes

static Dictionary< PlayerIndex, GameboardTypeplayerGameboards = new Dictionary<PlayerIndex, GameboardType>()
 

Additional Inherited Members

- Public Member Functions inherited from TiltFive.UniformScaleTransform
void Awake ()
 
- Protected Member Functions inherited from TiltFive.UniformScaleTransform
void UnifyScale ()
 Synchronizes the component values of the game object's local scale vector (e.g. [1,2,3] becomes [3,3,3]). More...
 
- Properties inherited from TiltFive.UniformScaleTransform
float localScale [get, set]
 The size of the object as a single float value, rather than a scale vector. More...
 
Vector3 position [get, set]
 The position vector for the associated transform. More...
 
Quaternion rotation [get, set]
 The rotation vector for the associated transform. More...
 

Detailed Description

Represents the game board.

Definition at line 28 of file GameBoard.cs.

Member Function Documentation

◆ TryGetGameboardDimensions()

static bool TiltFive.GameBoard.TryGetGameboardDimensions ( GameboardType  gameboardType,
out GameboardDimensions  gameboardDimensions 
)
static

Attempts to obtain the physical dimensions for a particular gameboard type.

Parameters
gameboardType
gameboardDimensions
Returns
Returns dimensions for GameboardType.GameboardType_LE if it fails.

Definition at line 155 of file GameBoard.cs.

156  {
157  if(gameboardType == GameboardType.GameboardType_None)
158  {
159  gameboardDimensions = new GameboardDimensions();
160  return false;
161  }
162 
163  // Default to the LE gameboard dimensions in meters.
164  T5_GameboardSize gameboardSize = new T5_GameboardSize(0.7f, 0.7f, 0.05f);
165  int result = 1;
166 
167  try
168  {
169  result = NativePlugin.GetGameboardDimensions(gameboardType, ref gameboardSize);
170  }
171  catch (Exception e)
172  {
173  Log.Error(e.Message);
174  }
175 
176  gameboardDimensions = new GameboardDimensions(gameboardSize);
177 
178  return result == 0;
179  }
GameboardType GameboardType
The gameboard configuration, such as LE, XE, or folded XE.
Definition: GameBoard.cs:57
The Logger.
Definition: Log.cs:42
static void Error(string m, params object[] list)
ERROR logging function call.
Definition: Log.cs:127

References TiltFive.Logging.Log.Error(), and TiltFive.NativePlugin.GetGameboardDimensions().

◆ TryGetGameboardType() [1/2]

static bool TiltFive.GameBoard.TryGetGameboardType ( out GameboardType  gameboardType)
static

Attempts to check the latest glasses pose for the current gameboard type, such as LE, XE, or none.

Parameters
gameboardTypeOutput gameboard type. Contains GameboardType.GameboardType_None if no pose was provided, which can happen if the user looks away and the head tracking camera loses sight of the gameboard.
Returns
Returns true on successful pose retrieval, false otherwise.

Definition at line 130 of file GameBoard.cs.

131  {
132  return TryGetGameboardType(PlayerIndex.One, out gameboardType);
133  }
static bool TryGetGameboardType(out GameboardType gameboardType)
Attempts to check the latest glasses pose for the current gameboard type, such as LE,...
Definition: GameBoard.cs:130
PlayerIndex
The Player index (e.g. Player One, Player Two, etc)

◆ TryGetGameboardType() [2/2]

static bool TiltFive.GameBoard.TryGetGameboardType ( PlayerIndex  playerIndex,
out GameboardType  gameboardType 
)
static

Definition at line 135 of file GameBoard.cs.

136  {
137  // Return false and a default gameboard if the player is nonexistent or disconnected.
138  if(!Player.TryGetGlassesHandle(playerIndex, out var glassesHandle)
139  || !playerGameboards.TryGetValue(playerIndex, out var currentGameboardType))
140  {
141  gameboardType = GameboardType.GameboardType_None;
142  return false;
143  }
144 
145  gameboardType = currentGameboardType;
146  return true;
147  }
static Dictionary< PlayerIndex, GameboardType > playerGameboards
Definition: GameBoard.cs:95

References TiltFive.GameBoard.playerGameboards.

Member Data Documentation

◆ GameboardType

GameboardType TiltFive.GameBoard.GameboardType

The gameboard configuration, such as LE, XE, or folded XE.

Definition at line 57 of file GameBoard.cs.

◆ GizmoOpacity

float TiltFive.GameBoard.GizmoOpacity = 0.75f

Sets the opacity of the game board gizmo in the editor.

Definition at line 50 of file GameBoard.cs.

◆ GridHeightOffset

float TiltFive.GameBoard.GridHeightOffset = 0f

Definition at line 41 of file GameBoard.cs.

◆ playerGameboards

Dictionary<PlayerIndex, GameboardType> TiltFive.GameBoard.playerGameboards = new Dictionary<PlayerIndex, GameboardType>()
staticprivate

Definition at line 95 of file GameBoard.cs.

Referenced by TiltFive.GameBoard.TryGetGameboardType().

◆ ShowGizmo

bool TiltFive.GameBoard.ShowGizmo

Shows the game board gizmo in the editor.

Definition at line 36 of file GameBoard.cs.

◆ ShowGrid

bool TiltFive.GameBoard.ShowGrid

Definition at line 39 of file GameBoard.cs.

◆ StickyHeightOffset

bool TiltFive.GameBoard.StickyHeightOffset = true

Definition at line 42 of file GameBoard.cs.


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