Word Game Builder 2.0.1f2
Reference Manual
Public Member Functions | Static Public Member Functions | Properties | List of all members
WordGamePlayer Class Reference

Represents a word game player. It tracks scores, holds tiles, and can be controlled by an AI agent. More...

+ Inheritance diagram for WordGamePlayer:
+ Collaboration diagram for WordGamePlayer:

Public Member Functions

void ClearSelection ()
 Clears the player's selected tiles. Also deselected them if they implement ISelectableLetterTile. More...
 
bool DeselectTile (ILetterTile tile)
 Attempts to deselect a tile. If the tile implements ISelectableLetterTile, this follows selection rules. More...
 
void Initialize (int highScore, string bestWord, int bestWordScore, string lastWord, int lastWordScore, IList< string > previousWords, int lastPenalty)
 Initialize the player. More...
 
void ResetAllData ()
 Resets all player data, and clears both selected and held tiles. More...
 
void ResetAllScores ()
 Resets all player scores. More...
 
void ResetBestWord ()
 Resets the best word. More...
 
void ResetHighScore ()
 Resets the high score. More...
 
void ResetLastPenalty ()
 Resets the last penalty. More...
 
void ResetLastWord ()
 Resets the last word. More...
 
void ResetPreviousWords ()
 Resets all previous words. More...
 
void ResetScore ()
 Resets the current score. More...
 
bool SelectTile (ILetterTile tile)
 Attempts to select a tile. If the tile implements ISelectableLetterTile, this follows selection rules. More...
 
AsyncTask SubmitWord ()
 Submits the word for checking against the current langauge's word list. More...
 
AsyncTask SubmitWord (float wordMultiplier)
 Submits the word for checking against the current langauge's word list. More...
 
AsyncTask SubmitWord (WordGameLanguage language, float wordMultiplier=1)
 Submits the word for checking against the specified langauge's word list. More...
 
- Public Member Functions inherited from WGBBase
GetComponentFromInterface< T > ()
 Gets a component from its interface type. More...
 
GetComponentInChildrenFromInterface< T > ()
 Gets a component from its interface type, searching through this GameObject and all children. More...
 
T[] GetComponentsFromInterface< T > ()
 Gets all components from its interface type. More...
 
T[] GetComponentsInChildrenFromInterface< T > ()
 Gets all components from its interface type, searching through this GameObject and all children. More...
 
- Public Member Functions inherited from IMonoBehaviour
void CancelInvoke ()
 Cancels all Invoke calls on this MonoBehaviour. More...
 
void CancelInvoke (string methodName)
 Cancels all Invoke calls with name methodName on this behaviour. More...
 
int GetInstanceID ()
 Returns the instance id of the object. More...
 
void Invoke (string methodName, float time)
 Invokes the method methodName in time seconds. More...
 
void InvokeRepeating (string methodName, float time, float repeatRate)
 Invokes the method methodName in time seconds. More...
 
bool IsInvoking ()
 Is any invoke pending on this MonoBehaviour? More...
 
bool IsInvoking (string methodName)
 Is any invoke on methodName pending? More...
 
Coroutine StartCoroutine (IEnumerator routine)
 Starts a coroutine. More...
 
Coroutine StartCoroutine (string methodName)
 Starts a coroutine named methodName. More...
 
Coroutine StartCoroutine (string methodName, object value)
 Starts a coroutine named methodName. More...
 
void StopAllCoroutines ()
 Stops all coroutines running on this behaviour. More...
 
void StopCoroutine (string methodName)
 Stops all coroutines named methodName running on this behaviour. More...
 
string ToString ()
 Returns the name of the game object. More...
 

Static Public Member Functions

static IWordGamePlayer FindPlayer (string name)
 Finds a player by name. More...
 
static IWordGamePlayer[] GetAllPlayers ()
 Finds all active players in the scene. More...
 
- Static Public Member Functions inherited from WGBBase
static T FindObjectOfTypeFromInterface< T > ()
 Finds the first object of interface type T. More...
 
static T[] FindObjectsOfTypeFromInterface< T > ()
 Finds all objects of interface type T. More...
 
static T InstantiateFromInterface< T > (T original)
 Instantiate a GameObject from interface type T. More...
 
static T InstantiateFromInterface< T > (T original, Vector3 position, Quaternion rotation)
 Instantiate a GameObject from interface type T at the specified position and rotation. More...
 
static void Log (object message, string prefix, string type)
 Logs a prefixed message. More...
 
static void Log (object message, string prefix, string type, Object context)
 Logs a prefixed message, with context. More...
 
static void LogError (object message, string prefix, string type)
 Logs a prefixed erorr. More...
 
static void LogError (object message, string prefix, string type, Object context)
 Logs a prefixed exception, with context. More...
 
static void LogException (System.Exception ex)
 Logs an exception. More...
 
static void LogException (System.Exception ex, Object context)
 Logs an exception, with context. More...
 
static void LogWarning (object message, string prefix, string type)
 Logs a prefixed warning. More...
 
static void LogWarning (object message, string prefix, string type, Object context)
 Logs a prefixed warning, with context. More...
 

Properties

string bestWord [get]
 Gets the player's best word. More...
 
int bestWordScore [get]
 Gets the score of the player's best word. More...
 
IList< ILetterTileheldTiles [get]
 Gets the list of the player's held tiles. More...
 
int highScore [get]
 Gets the player's high score. More...
 
bool inputEnabled [get, set]
 Controls whether or not input has been enabled for this player. More...
 
int lastPenalty [get]
 Gets the last penalty value applied to the player. More...
 
WordGameResult lastResult [get]
 Gets the last word result. This value is set before event callbacks. More...
 
string lastWord [get]
 Gets the player's last word. More...
 
int lastWordScore [get]
 Gets the score of the player's last word. More...
 
int maxTiles [get, set]
 The maximum amount of tiles that a player should hold. More...
 
bool multiplyByPermutations [get, set]
 If true, the score will be multiplied by the amount of permutations found. More...
 
WGBEvent onWordResult [get, set]
 This event fires whenever a word result is returned from a word check. More...
 
bool orderedWordCheck [get, set]
 Should word checks be ordered? More...
 
string playerID [get, set]
 The player ID. Use this for games with multiple players. More...
 
IList< string > previousWords [get]
 Gets the list of previous words used by the player. More...
 
int previousWordsCapacity [get, set]
 The amount of previous words to track. More...
 
int score [get, set]
 Gets or sets the player's current score. More...
 
int scorePenalty [get, set]
 The penalty for submitting the same word multiple times, multiplied by the number of pervious submissions. More...
 
IList< ILetterTileselectedTiles [get]
 Gets the list of the player's selected tiles. More...
 
string wordStringPlural [get, set]
 The plural string for "word". Used for localization. More...
 
string wordStringSingular [get, set]
 The singular string for "word". Used for localization. More...
 
- Properties inherited from WGBBase
object userData [get, set]
 Additional user data associated with this object. This is unused by default. More...
 
- Properties inherited from IWordGamePlayer
string bestWord [get]
 Gets the player's best word. More...
 
int bestWordScore [get]
 Gets the score of the player's best word. More...
 
IList< ILetterTileheldTiles [get]
 Gets the list of held tiles. More...
 
int highScore [get]
 Gets the player's high score. More...
 
bool inputEnabled [get, set]
 Controls whether or not input has been enabled for this player. More...
 
WordGameResult lastResult [get]
 Gets the last word result. This value should be set before event callbacks. More...
 
string lastWord [get]
 Gets the player's last word. More...
 
int lastWordScore [get]
 Gets the score of the player's last word. More...
 
int maxTiles [get, set]
 The maximum amount of tiles that a player should hold. More...
 
bool multiplyByPermutations [get, set]
 If orderedWordCheck = false and multiplyByPermutations = true, the score will be multiplied by the amount of words found. More...
 
WGBEvent onWordResult [get, set]
 This event should fire whenever a word result is returned from a word check. More...
 
bool orderedWordCheck [get, set]
 Should word checks be ordered? More...
 
int score [get, set]
 Gets or sets the player's current score. More...
 
IList< ILetterTileselectedTiles [get]
 Gets a list of the player's play tiles. More...
 
- Properties inherited from IMonoBehaviour
bool enabled [get, set]
 Enabled Behaviours are Updated, disabled Behaviours are not. More...
 
GameObject gameObject [get]
 The game object this component is attached to. A component is always attached to a game object. More...
 
HideFlags hideFlags [get, set]
 Should the object be hidden, saved with the scene or modifiable by the user? More...
 
string name [get, set]
 The name of the object. More...
 
string tag [get, set]
 The tag of this game object. More...
 
Transform transform [get]
 The Transform attached to this GameObject. A component is always attached to a transform. More...
 
object userData [get, set]
 Additional user data associated with this object. This is unused by default. More...
 

Detailed Description

Represents a word game player. It tracks scores, holds tiles, and can be controlled by an AI agent.

This class contains many convenient methods for creating a word game.

Note
Loading and saving scores from disk are not implemented - in order to have persistent data, the player will need to be initialized on load.

Member Function Documentation

void ClearSelection ( )
inline

Clears the player's selected tiles. Also deselected them if they implement ISelectableLetterTile.

Implements IWordGamePlayer.

bool DeselectTile ( ILetterTile  tile)
inline

Attempts to deselect a tile. If the tile implements ISelectableLetterTile, this follows selection rules.

Parameters
tileThe tile to select.
Returns
True if the tile was deselected; otherwise, false.

Implements IWordGamePlayer.

+ Here is the call graph for this function:

static IWordGamePlayer FindPlayer ( string  name)
inlinestatic

Finds a player by name.

Parameters
nameThe name to search for.
Returns
A player, or null if no matching player is found.

+ Here is the caller graph for this function:

static IWordGamePlayer [] GetAllPlayers ( )
inlinestatic

Finds all active players in the scene.

Returns
All active players.

+ Here is the caller graph for this function:

void Initialize ( int  highScore,
string  bestWord,
int  bestWordScore,
string  lastWord,
int  lastWordScore,
IList< string >  previousWords,
int  lastPenalty 
)
inline

Initialize the player.

Used for loading saved data.

Parameters
highScoreThe player's high score.
bestWordThe player's best word.
bestWordScoreThe score value of the player's best word.
lastWordThe player's last word.
lastWordScoreThe score value of the player's last word.
previousWordsA list of the players' previous words.
lastPenaltyThe last penalty value applied to the player.
void ResetAllData ( )
inline

Resets all player data, and clears both selected and held tiles.

Implements IWordGamePlayer.

void ResetAllScores ( )
inline

Resets all player scores.

Implements IWordGamePlayer.

void ResetBestWord ( )
inline

Resets the best word.

Implements IWordGamePlayer.

void ResetHighScore ( )
inline

Resets the high score.

Implements IWordGamePlayer.

void ResetLastPenalty ( )
inline

Resets the last penalty.

void ResetLastWord ( )
inline

Resets the last word.

Implements IWordGamePlayer.

void ResetPreviousWords ( )
inline

Resets all previous words.

void ResetScore ( )
inline

Resets the current score.

Implements IWordGamePlayer.

bool SelectTile ( ILetterTile  tile)
inline

Attempts to select a tile. If the tile implements ISelectableLetterTile, this follows selection rules.

Parameters
tileThe tile to select.
Returns
True if the tile was selected; otherwise, false.

Implements IWordGamePlayer.

+ Here is the call graph for this function:

AsyncTask SubmitWord ( )
inline

Submits the word for checking against the current langauge's word list.

This method is asynchronous.

Returns
An object representing an asynchronous task.

Implements IWordGamePlayer.

AsyncTask SubmitWord ( float  wordMultiplier)
inline

Submits the word for checking against the current langauge's word list.

Parameters
wordMultiplierThe score multiplier to apply to the entire submission.

This method is asynchronous.

Returns
An object representing an asynchronous task.
AsyncTask SubmitWord ( WordGameLanguage  language,
float  wordMultiplier = 1 
)
inline

Submits the word for checking against the specified langauge's word list.

Parameters
languageThe language to check.
wordMultiplierThe score multiplier to apply to the entire submission.

This method is asynchronous.

Returns
An object representing an asynchronous task.

+ Here is the call graph for this function:

Property Documentation

string bestWord
get

Gets the player's best word.

Implements IWordGamePlayer.

int bestWordScore
get

Gets the score of the player's best word.

Implements IWordGamePlayer.

IList<ILetterTile> heldTiles
get

Gets the list of the player's held tiles.

Held tiles are tiles that belong to the player, but will not be submitted.

Implements IWordGamePlayer.

int highScore
get

Gets the player's high score.

Implements IWordGamePlayer.

bool inputEnabled
getset

Controls whether or not input has been enabled for this player.

It is the responsibilty of the letter tile to check for (or ignore) this value. This is handled automatically by the default LetterTile class.

Implements IWordGamePlayer.

int lastPenalty
get

Gets the last penalty value applied to the player.

WordGameResult lastResult
get

Gets the last word result. This value is set before event callbacks.

Implements IWordGamePlayer.

string lastWord
get

Gets the player's last word.

Implements IWordGamePlayer.

int lastWordScore
get

Gets the score of the player's last word.

Implements IWordGamePlayer.

int maxTiles
getset

The maximum amount of tiles that a player should hold.

Implements IWordGamePlayer.

bool multiplyByPermutations
getset

If true, the score will be multiplied by the amount of permutations found.

Implements IWordGamePlayer.

WGBEvent onWordResult
getset

This event fires whenever a word result is returned from a word check.

Variables set:

  • WGBEvent.currentLanguage
  • WGBEvent.currentPlayer

Implements IWordGamePlayer.

bool orderedWordCheck
getset

Should word checks be ordered?

Implements IWordGamePlayer.

string playerID
getset

The player ID. Use this for games with multiple players.

IList<string> previousWords
get

Gets the list of previous words used by the player.

int previousWordsCapacity
getset

The amount of previous words to track.

int score
getset

Gets or sets the player's current score.

Setting this value will automatically set a new high score, if it is higher than the previous high score.

Implements IWordGamePlayer.

int scorePenalty
getset

The penalty for submitting the same word multiple times, multiplied by the number of pervious submissions.

IList<ILetterTile> selectedTiles
get

Gets the list of the player's selected tiles.

Play tiles are tiles that will be submitted for checking.

Implements IWordGamePlayer.

string wordStringPlural
getset

The plural string for "word". Used for localization.

string wordStringSingular
getset

The singular string for "word". Used for localization.