GameCore Class

Contains all the information about a game of Project L.

Definition

Namespace: ProjectLCore.GameLogic
Assembly: ProjectLCore (in ProjectLCore.dll) Version: 1.0.0+d0f5e2a7a5f4bb0431970f279d2f79d24b15d256
C#
public class GameCore
Inheritance
Object    GameCore

Constructors

GameCore Initializes a new instance of the GameCore class.

Properties

CurrentGamePhase The current GamePhase.
CurrentPlayer The player who's turn it currently is.
CurrentTurn Information about the current turn.
GameState Information about the shared resources in the game.
Players The players playing the game.
PlayerStates Information about the resources of each player.

Methods

AddListener(ICurrentPlayerListener) Subscribes the player listener to the events of this GameCore.
AddListener(ICurrentTurnListener) Subscribes the turn listener to the events of this GameCore.
FinalizeGame Finishes up internal game state and prepares for evaluating the results of the game. Should be called after CurrentGamePhase changes to Finished. Throws an exception if this method is called more than once.
GetNextTurnInfo Prepares the next turn and updates CurrentPlayer and CurrentGamePhase.
GetPlayerInfos Creates a read-only PlayerStatePlayerInfo wrapper for each PlayerState in PlayerStates.
GetPlayerRankings Determines the rank of each player based on their score, number of completed puzzles and leftover tetrominos. If this method is called before FinalizeGame, it will not take into account the points lost for unfinished puzzles.
GetPlayerWithId Returns the Player matching the given ID. Throws an exception if no such player exists.
InitializeGame Gives every player a O1 and I2 tetromino from the shared reserve. And fills the black and white puzzle rows with puzzles from the decks. Throws an exception if this method is called more than once.
InitializeGameAsync Gives every player a O1 and I2 tetromino from the shared reserve. Then asynchronously fills the black and white puzzle rows with puzzles from the decks. Throws an exception if this method is called more than once.
ProcessAction Adjusts the GameState and the PlayerState of the current player based on the given action. Doesn't check if the action is valid. Use an ActionVerifier to check if the action is valid before calling this function.
ProcessActionAsync Asynchronously adjusts the GameState and the PlayerState of the current player based on the given action. Doesn't check if the action is valid. Use an ActionVerifier to check if the action is valid before calling this function.
RemoveListener(ICurrentPlayerListener) Unsubscribes the player listener from the events of this GameCore.
RemoveListener(ICurrentTurnListener) Unsubscribes the turn listener from the events of this GameCore.
TryGetNextPuzzleFinishedBy Gets a FinishedPuzzleInfo from the FinishedPuzzlesQueue of the given player. The return value indicates whether there was something in the queue or not.

Fields

MaxPlayers The maximum number of players allowed.

See Also