puzzlegame - eisclimber/ExPresS-XR GitHub Wiki

PuzzleGame

Class in ExPresSXR.Minigames.Puzzle

Inherits from UnityEngine.MonoBehaviour

Summary

The main logic of a socket-based puzzle game.

public class PuzzleGame : MonoBehaviour

Fields

Name Description
DEFAULT_FIELD_HEIGHT Default height of the puzzle (in tiles).
DEFAULT_FIELD_WIDTH Default width of the puzzle (in tiles).
OnCompleted Emitted when the puzzle was completed.
OnPieceSubmitted Emitted when a piece is submitted, providing its index.
OnScoreChanged Emitted when the score changes (i.e. a piece is submitted), providing the score.
OnStarted Emitted when the puzzle was started.

Methods

Name Description
EndGame() Stops the game.
GetUnsubmittedPieceAt(int) Returns the piece prefab if the provided index is valid and the piece was unsubmitted.
IdxToBoardPos(int) Converts a puzzle piece idx to a board position (Vector2).
InstantiatePieceInSocket(int,PutBackSocketInteractor) Instantiates the puzzle piece with the provided id in the socket.
ResetPuzzle() Resets the progress of the puzzle. Pieces must be cleaned up manually.
StartGame() Starts the game.

Properties

Name Description
CurrentScore The current score of the puzzle.
NumCompleted Current number of submitted pieces.
NumPieces Number of pieces in the puzzle.
NumUnsubmittedPieces Number of unsubmitted pieces.
PieceSubmitted Boolean list which pieces were submitted.
SpeedBonusPrefix Bonus prefix added to the ScoreNumbers when a speed bonus is granted.
⚠️ **GitHub.com Fallback** ⚠️