Class Blocks
Manages all block and their movement
Inheritance
Namespace: Tetris
Assembly: cs.temp.dll.dll
Syntax
public class Blocks : MonoBehaviour
Fields
ActiveSpawn
List for ActiveSpawn bool, a request for SpawnMino(Int32, String)
Declaration
public static readonly List<bool> ActiveSpawn
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<System.Boolean> |
blockPrefab
Gets a Unity prefab for a cube with pre-applied material etc.
Declaration
public GameObject blockPrefab
Field Value
Type | Description |
---|---|
GameObject |
HoldArea
Coordinates for area where each player have it's held block, if such a block exists
Declaration
public static List<Vector3> HoldArea
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<Vector3> |
HoldBlock
List for HoldBlock GameObjects
Declaration
public static readonly List<GameObject> HoldBlock
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<GameObject> |
holdSpawn
List for holdSpawn bool
Declaration
public List<bool> holdSpawn
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<System.Boolean> |
HoldType
Array for HoldType strings
Declaration
public static readonly string[] HoldType
Field Value
Type | Description |
---|---|
System.String[] |
HoldUsed
List for holdUsed bool
Declaration
public static List<bool> HoldUsed
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<System.Boolean> |
IsFalling
List for IsFalling bool, false when soft dropping
Declaration
public static readonly List<bool> IsFalling
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<System.Boolean> |
KeybindHardDrop
Declaration
public static string[] KeybindHardDrop
Field Value
Type | Description |
---|---|
System.String[] |
KeybindHold
Declaration
public static string[] KeybindHold
Field Value
Type | Description |
---|---|
System.String[] |
KeybindLeft
Declaration
public static string[] KeybindLeft
Field Value
Type | Description |
---|---|
System.String[] |
KeybindRight
Declaration
public static string[] KeybindRight
Field Value
Type | Description |
---|---|
System.String[] |
KeybindSoftDrop
Declaration
public static string[] KeybindSoftDrop
Field Value
Type | Description |
---|---|
System.String[] |
lastDir
List for LastDir Bool, describes direction for auto-repeat
Declaration
public List<bool> lastDir
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<System.Boolean> |
LockCounter
Counter of how many rotations/moves happened when the lock conditions are met and TimeLock was running
Declaration
public static List<int> LockCounter
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<System.Int32> |
Remarks
After reaching 15, block locks immediately after a rotation or a move
lockDeepestRow
Deepest row reached by currently active block
Declaration
public List<int> lockDeepestRow
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<System.Int32> |
Remarks
The LockCounter resets if the block reaches a new deepest floor
move
Used for Tetris.Blocks.CanMove(System.Int32,System.String)
Declaration
public bool move
Field Value
Type | Description |
---|---|
System.Boolean |
otherMat
Declaration
public Material otherMat
Field Value
Type | Description |
---|---|
Material |
PlayerIds
List of player ids, used to get player count
Declaration
public static List<int> PlayerIds
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<System.Int32> |
PreviewArea
Coordinates for area where each player has it's next prepared block
Declaration
public static List<Vector3> PreviewArea
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<Vector3> | x, y, z |
PreviewBlock
List for PreviewBlock GameObject Stores block for Tetris.Blocks.Preview(System.Int32)
Declaration
public static List<GameObject> PreviewBlock
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<GameObject> |
randomType
Array of block types used in SpawnMino(Int32, String)
Declaration
public string[] randomType
Field Value
Type | Description |
---|---|
System.String[] |
rIndex
Random integer for picking from randomType
Declaration
public int rIndex
Field Value
Type | Description |
---|---|
System.Int32 |
spawn
Used for Tetris.Blocks.CanSpawn(System.Int32,System.String)
Declaration
public bool spawn
Field Value
Type | Description |
---|---|
System.Boolean |
SpawnArea
Coordinates for area above the game space where all blocks remain when not in use
Declaration
public static Vector3 SpawnArea
Field Value
Type | Description |
---|---|
Vector3 | x, y, z |
StartArea
Coordinates for area where each player starts
Declaration
public static List<Vector3> StartArea
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<Vector3> | x, y, z |
Tetrominos
List of all blocks
Declaration
public static readonly List<Tetromino> Tetrominos
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<Tetromino> |
Remarks
Each player has one of each type, locked blocks don't exist in this list
timeAutoRepeat
Auto-repeat timers for Tetris.Blocks.Controls
Declaration
public List<float> timeAutoRepeat
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<System.Single> |
timeBeginAutoRepeat
List for timeBeginAutoRepeat float
Declaration
public List<float> timeBeginAutoRepeat
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<System.Single> |
timeFall
Timers for Tetris.Blocks.Falling
Declaration
public List<float> timeFall
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<System.Single> |
TimeLock
Lock timers for Tetris.Blocks.Controls and Tetris.Blocks.Falling
Declaration
public static List<float> TimeLock
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<System.Single> |
timeSoftDrop
Soft drop timers for Tetris.Blocks.Controls
Declaration
public List<float> timeSoftDrop
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<System.Single> |
timeToAutoRepeat
Time for a block to move to side when auto-repeat is active
Declaration
public float timeToAutoRepeat
Field Value
Type | Description |
---|---|
System.Single |
timeToBeginAutoRepeat
Time for a block to begin auto-repeat after a direction key is held
Declaration
public float timeToBeginAutoRepeat
Field Value
Type | Description |
---|---|
System.Single |
TimeToFall
Time for a block to fall one block down
Declaration
public static float TimeToFall
Field Value
Type | Description |
---|---|
System.Single |
timeToLock
Time for a block to lock in place
Declaration
public float timeToLock
Field Value
Type | Description |
---|---|
System.Single |
TimeToSoftDrop
Time for a block to fall when soft drop key is held down
Declaration
public static float TimeToSoftDrop
Field Value
Type | Description |
---|---|
System.Single |
Methods
InitializePlayer(Int32)
Initializes all variables needed for given player
Declaration
public void InitializePlayer(int playerId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | playerId | Player id |
OriginalColors(Int32)
Declaration
public static void OriginalColors(int playerId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | playerId |
RemovePlayer(Int32)
Removes all variables needed for given player
Declaration
public void RemovePlayer(int playerId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | playerId | Player id |
SpawnMino(Int32, String)
Spawns a block
Declaration
protected void SpawnMino(int playerId, string type)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | playerId | Player id |
System.String | type | Type of a block |