/// <summary> /// Grabs a specific tetromino piece. /// </summary> /// <param name="type">The type of tetromino piece being requested.</param> /// <returns>A specific tetromino piece whose type is <paramref name="type"/>.</returns> public static Tetromino GetTetromino(TetrominoType type) { Tetromino tetromino; switch (type) { case TetrominoType.I: tetromino = new StraightPolyomino(); break; case TetrominoType.O: tetromino = new SquarePolyomino(); break; case TetrominoType.Z: tetromino = new SkewPolyomino(); break; case TetrominoType.T: tetromino = new TPolyomino(); break; case TetrominoType.L: tetromino = new LPolyomino(); break; default: tetromino = new SkewPolyomino(); break; } return(tetromino); }
// ppoulin // Les instructions suivantes ne devraient pas se retrouver dans la version finale // du travail. // CIC-2 //Barre cyan // La création des instances des petits blocs selon leurs décalages. //TetrominoLittleBlock b1 = new TetrominoLittleBlock(0, 0, Color.Cyan); //TetrominoLittleBlock b2 = new TetrominoLittleBlock(1, 0, Color.Cyan); //TetrominoLittleBlock b3 = new TetrominoLittleBlock(2, 0, Color.Cyan); //TetrominoLittleBlock b4 = new TetrominoLittleBlock(3, 0, Color.Cyan); //T magenta // La création des instances des petits blocs selon leurs décalages. //TetrominoLittleBlock b1 = new TetrominoLittleBlock(0, 0, Color.Magenta); //TetrominoLittleBlock b2 = new TetrominoLittleBlock(1, 0, Color.Magenta); //TetrominoLittleBlock b3 = new TetrominoLittleBlock(1, -1, Color.Magenta); //TetrominoLittleBlock b4 = new TetrominoLittleBlock(2, 0, Color.Magenta); ////Right snake green // La création des instances des petits blocs selon leurs décalages. //TetrominoLittleBlock b1 = new TetrominoLittleBlock(0, 0, Color.Green); //TetrominoLittleBlock b2 = new TetrominoLittleBlock(1, 0, Color.Green); //TetrominoLittleBlock b3 = new TetrominoLittleBlock(1, -1, Color.Green); //TetrominoLittleBlock b4 = new TetrominoLittleBlock(2, -1, Color.Green); ////Left snake red // La création des instances des petits blocs selon leurs décalages. //TetrominoLittleBlock b1 = new TetrominoLittleBlock(0,-1, Color.Red); //TetrominoLittleBlock b2 = new TetrominoLittleBlock(1,-1, Color.Red); //TetrominoLittleBlock b3 = new TetrominoLittleBlock(1, 0, Color.Red); //TetrominoLittleBlock b4 = new TetrominoLittleBlock(2, 0, Color.Red); //Left gun blue // La création des instances des petits blocs selon leurs décalages. //TetrominoLittleBlock b1 = new TetrominoLittleBlock(0, 0, Color.Blue); //TetrominoLittleBlock b2 = new TetrominoLittleBlock(0, 1, Color.Blue); //TetrominoLittleBlock b3 = new TetrominoLittleBlock(1, 1, Color.Blue); //TetrominoLittleBlock b4 = new TetrominoLittleBlock(2, 1, Color.Blue); //Light gun orange // La création des instances des petits blocs selon leurs décalages. //TetrominoLittleBlock b1 = new TetrominoLittleBlock(0, 0, Color.Yellow); //TetrominoLittleBlock b2 = new TetrominoLittleBlock(0, 1, Color.Yellow); //TetrominoLittleBlock b3 = new TetrominoLittleBlock(1, 1, Color.Yellow); //TetrominoLittleBlock b4 = new TetrominoLittleBlock(2, 1, Color.Yellow); // ppoulin // Paramètres non documentés // MCP-3 /// <summary> /// Constructeur de la classe Tetromino /// </summary> public Tetromino(int topLeftColumnOffset, int topLeftRowOffset, TetrominoType type) { this.topLeftColumnOffset = topLeftColumnOffset; this.topLeftRowOffset = topLeftRowOffset; texture = new Texture("littleblock.bmp"); sprite = new Sprite(texture); }
/// <summary> /// This function retrieves a tetromino sprite by given type /// </summary> /// <param name="type"></param> /// <returns></returns> public SpriteRenderer GetTetrominoSprite(TetrominoType type, bool isGhost = false) { SpriteRenderer sr = tetrominoSpawner.GetTetrominoSprite(type, isGhost); sr.sortingOrder = 1; return(sr); }
private void InstantiateNewTetromino(TetrominoType tetromino) { GameObject newTetromino; switch (tetromino) { case TetrominoType.I: newTetromino = Instantiate(PrefabI, transform); break; case TetrominoType.J: newTetromino = Instantiate(PrefabJ, transform); break; case TetrominoType.L: newTetromino = Instantiate(PrefabL, transform); break; case TetrominoType.O: newTetromino = Instantiate(PrefabO, transform); break; case TetrominoType.S: newTetromino = Instantiate(PrefabS, transform); break; case TetrominoType.T: newTetromino = Instantiate(PrefabT, transform); break; case TetrominoType.Z: newTetromino = Instantiate(PrefabZ, transform); break; default: newTetromino = Instantiate(PrefabI, transform); break; } newTetromino.transform.localPosition = new Vector3(NewTetroCoordX, NewTetroCoordY); newTetromino.GetComponent <Tetromino>().LandedEvent += OnTetrominoLandedReaction; }
public static Vector2Int[] TetrominoTiles(TetrominoType type) { switch (type) { case TetrominoType.Z: return(Z_TETROMINO); case TetrominoType.S: return(S_TETROMINO); case TetrominoType.J: return(J_TETROMINO); case TetrominoType.L: return(L_TETROMINO); case TetrominoType.O: return(O_TETROMINO); case TetrominoType.I: return(I_TETROMINO);; case TetrominoType.T: return(T_TETROMINO); default: throw new Exception("Tried to get tetromino of unknown type"); } }
public Tetromino(TetrominoType type, Vec2 pos, int angle, bool locked) { Type = type; Pos = pos; Angle = angle; Locked = locked; }
/// <summary> /// Create a new tetromino /// </summary> public Tetromino(TetrominoType type) { this.Type = type; this.MinoTiles = (Vector2Int[])TetrominoTiles(type).Clone(); CurrentRotationState = Rotation.Up; CurrentSpinReward = SpinReward.None; }
public int GetTetrominoCount(TetrominoType tetrominoType) { switch (tetrominoType) { case TetrominoType.I: return(ITetrominoCount); case TetrominoType.J: return(JTetrominoCount); case TetrominoType.L: return(LTetrominoCount); case TetrominoType.O: return(OTetrominoCount); case TetrominoType.S: return(STetrominoCount); case TetrominoType.T: return(TTetrominoCount); case TetrominoType.Z: return(ZTetrominoCount); } return(-1); }
/// <summary> /// Spawn a tetromino and position the blocks of the spawned tetromino by type. /// </summary> /// <param name="tetroType"> Type of tetromino that needs to be spawned.</param> public void SpawnTetrominoBlocks(TetrominoType tetroType) { tetroSystem.tetroController.curType = tetroType; // Assign spawn location by the type if (tetroType == TetrominoType.I || tetroType == TetrominoType.O) { _spawnLocation = _spawnMiddle; } else { _spawnLocation = _spawnLeftMiddle; } // Update the blocks position tetroSystem.tetroController.blocks[0].UpdatePosition(_spawnLocation); tetroSystem.tetroController.UpdateBlocksPosition(_spawnLocation); // Assign Initial index of each block int index = 0; foreach (TetrominoBlockController ti in tetroSystem.tetroController.blocks) { ti.InitializeBlocks(tetroSystem.tetroController, index); index++; } }
public void AddNextTetromino() { if (NextTetromino != null) { ActiveTetromino = NextTetromino; } else { TetrominoType activeTetrominoType = TetrominoType.Empty; while (activeTetrominoType == TetrominoType.Empty) { activeTetrominoType = (TetrominoType)_randomizer.Next(2); } ActiveTetromino = new Tetromino(this, activeTetrominoType); } TetrominoType tetrominoType = TetrominoType.Empty; while (tetrominoType == TetrominoType.Empty) { tetrominoType = (TetrominoType)_randomizer.Next(8); } Tetromino tetromino = new Tetromino(this, tetrominoType); NextTetromino = tetromino; switch (ActiveTetromino.TetrominoType) { case TetrominoType.I: TetrisStatictics.ITetrominoCount++; break; case TetrominoType.J: TetrisStatictics.JTetrominoCount++; break; case TetrominoType.L: TetrisStatictics.LTetrominoCount++; break; case TetrominoType.O: TetrisStatictics.OTetrominoCount++; break; case TetrominoType.S: TetrisStatictics.STetrominoCount++; break; case TetrominoType.T: TetrisStatictics.TTetrominoCount++; break; case TetrominoType.Z: TetrisStatictics.ZTetrominoCount++; break; } }
/// <param name="tetrominoBlock">Dwuwymiarowa tablica 4x4 reprezentująca kwadraty za pomocą true/false</param> /// <param name="type">Typ tetromino</param> public Tetromino(TetrominoType type, Color color) { Type = type; Color = color; Rotation = TetrominoRatationMode.First; Position = new int[4][]; }
public void Set(int x, int y, TetrominoType tetrominoType) { if (x < 0 || x >= Width || y < 0 || y >= Height) { return; } m_Data[x + y * Width] = tetrominoType; }
public GameState(TetrominoType firstBlock, IGameRules gameRules, IRng rng) { NextTetromino = firstBlock; GameRules = gameRules; Rng = rng; Board = new MutableBoard(gameRules); Time = 0; Level = 0; }
public static IEnumerable <Result> BruteForce(IGameState state) { // TODO: parallelize this TetrominoType tetrominoType = state.NextTetromino; var simulator = new PieceSimulator(state.GameRules, state.Board); var comparer = new TetrominoComparer(state.GameRules); var seenStates = new HashSet <ITetromino>(comparer); var steps = new Queue <GameStep>(); // IRS: foreach (var input in Input.Initials()) { var t = simulator.SpawnTetromino(tetrominoType, input); if (t == null) { continue; } if (seenStates.Contains(t)) { continue; } seenStates.Add(t); steps.Enqueue(new GameStep(t, input)); } while (steps.Count > 0) { var prev = steps.Dequeue(); if (prev.Tetromino.Locked) { var nextState = state.Next(prev.Tetromino, prev.Inputs); yield return(new Result( new GameStep(prev.Tetromino, prev.Inputs), state, nextState)); continue; } foreach (var input in Input.Successors(prev.Inputs)) { var t = simulator.StepTetromino(prev.Tetromino, input); if (seenStates.Contains(t)) { continue; } seenStates.Add(t); steps.Enqueue(new GameStep(t, prev.Inputs, input)); } } }
public Tetromino(TetrisLevel tetrisLevel, TetrominoType type) { TetrominoType = type; TetrisLevel = tetrisLevel; Positions = new List <Point>(); CreateTetromino(); Active = true; }
public TgmRng(UInt32 state, TetrominoType initialBlock) { m_State = state; m_History = new TetrominoType[HistorySize]; m_History[0] = TetrominoType.Z; m_History[1] = TetrominoType.Z; m_History[2] = TetrominoType.S; m_History[3] = TetrominoType.S; AddHistory(m_History, initialBlock); }
public ITetromino CreateTetromino() { TetrominoType type = this.GenerateRandomTetrominoType(); var typeOfTetromino = Assembly.GetExecutingAssembly().GetTypes() .FirstOrDefault(v => v.Name == type.ToString()); ITetromino tetromino = (ITetromino)Activator.CreateInstance(typeOfTetromino); return(tetromino); }
private bool TestTetromino(TetrominoType tetrominoType, Vec2 pos, int angle) { foreach (var p in m_GameRules.GetTetrominoPoints(tetrominoType, pos, angle)) { if (m_Board.Get(p.x, p.y) != TetrominoType.Empty) { return(false); } } return(true); }
private void StartNewGame() { m_data.CurrentLevelTimer = TimeLevel; m_data.CurrentLevel = 1; m_data.FilledLinesCount = 0; m_data.CurrentScore = 0; InstantiateNewTetromino(GetNextTetrominoType()); m_nextTetromino = GetNextTetrominoType(); m_preview.ShowPreview(m_nextTetromino); }
public static TetrominoDrawing GetTetrominoColors(TetrominoType tetrominoType) { TetrominoDrawing tetrominoDrawing = new TetrominoDrawing(); switch (tetrominoType) { case TetrominoType.I: tetrominoDrawing.FillColor = Color.Cyan; tetrominoDrawing.BorderColor = Color.LightCyan; return(tetrominoDrawing); case TetrominoType.J: tetrominoDrawing.FillColor = Color.Blue; tetrominoDrawing.BorderColor = Color.LightBlue; return(tetrominoDrawing); case TetrominoType.L: tetrominoDrawing.FillColor = Color.OrangeRed; tetrominoDrawing.BorderColor = Color.Orange; return(tetrominoDrawing); case TetrominoType.O: tetrominoDrawing.FillColor = Color.Yellow; tetrominoDrawing.BorderColor = Color.White; return(tetrominoDrawing); case TetrominoType.S: tetrominoDrawing.FillColor = Color.Green; tetrominoDrawing.BorderColor = Color.LightGreen; return(tetrominoDrawing); case TetrominoType.T: tetrominoDrawing.FillColor = Color.Purple; tetrominoDrawing.BorderColor = Color.Orchid; return(tetrominoDrawing); case TetrominoType.Z: tetrominoDrawing.FillColor = Color.Red; tetrominoDrawing.BorderColor = Color.LightCoral; return(tetrominoDrawing); case TetrominoType.Filled: tetrominoDrawing.FillColor = Color.LightGray; tetrominoDrawing.BorderColor = Color.White; return(tetrominoDrawing); default: case TetrominoType.Empty: tetrominoDrawing.FillColor = Color.Black; tetrominoDrawing.BorderColor = Color.FromArgb(12, 29, 43); return(tetrominoDrawing); } }
public ITetromino SpawnTetromino(TetrominoType tetrominoType, Input input) { var t = new Tetromino(tetrominoType, m_Board.GetSpawnPos(), 0, false); ApplyRotate(t, input.Rotate, false); if (!TestTetromino(t)) { return(null); } ApplyGravity(t); return(t); }
/// <summary> /// Add a new bag of 7 tetrominos to the bag generator queue. /// </summary> private void AddNewBag() { // Copy a new bag of all 7 pieces. List <TetrominoType> drawingBag = new List <TetrominoType>(STANDARD_BAG); Random rand = new Random(); // Choose random tetrominos from the bag and add them to the generator queue. for (int i = drawingBag.Count; i > 0; i--) { int chosenTetrominoIndex = rand.Next(i); TetrominoType addedTetrominoType = drawingBag[chosenTetrominoIndex]; TetrominoBag.Enqueue(new Tetromino(addedTetrominoType)); drawingBag.RemoveAt(chosenTetrominoIndex); } }
/// <summary> /// Ctor /// </summary> /// <param name="type">The Type of tetromino.</param> /// <param name="texture">The name of the texture file being applied to the blocks</param> public Tetromino(TetrominoType type, string texture) { Type = type; Random random = new Random(); int randomNumber = random.Next(0, 500); if (randomNumber == 42) { TextureName = "CageFace"; } else { TextureName = texture; } }
/// <summary> /// This function Returns a tetromino sprite of given ID /// </summary> /// <param name="ID">Tetromino ID</param> /// <returns></returns> public SpriteRenderer GetTetrominoSprite(int ID, bool ghost = false) { List <SpriteRenderer> srList; TetrominoType type = (TetrominoType)ID; if (ghost) { if (!ghostPool.TryGetValue(type, out srList)) { throw new KeyNotFoundException(); } } else { if (!pool.TryGetValue(type, out srList)) { throw new KeyNotFoundException(); } } for (int i = 0; i < srList.Count; i++) { if (!srList[i].gameObject.activeInHierarchy) { //srList[i].gameObject.SetActive(true); return(srList[i]); } } if (ghost) { SpriteRenderer gh_sr = CreateGhostSprite(ID); srList.Add(gh_sr); return(gh_sr); } else { SpriteRenderer sr = CreateSprite(ID); srList.Add(sr); return(sr); } }
/// <summary> /// 7-Bag Random Generator. Randomly pick tetromino from a _bag of tetrminoes. /// </summary> /// <returns>Retrun a tetromino gameObject.</returns> public GameObject PickTetromino() { // If the shuffule number is greater than the index length, then shuffule the bag index. TetrominoType newType = new TetrominoType(); // For first round shuffule if (shuffleCounter >= 6) { //_bag.AddRange(tetrominoSpawnList); _bagIdxList = ShuffleIndex(); shuffleCounter = 0; // Assign the last tetromino in the bag GameObject newLocalTetro = GameObject.Instantiate(_tmpTetromino, transform); newType = tetrominoSpawnList[_bagIdxList[shuffleCounter]].GetComponent <TetrominoController>().curType; // Add sprite to the "Next Tetromino" box tetroSystem.AddNextTetrominoSprite(newType); return(newLocalTetro); } // Pick the tetromino by index and spawn it GameObject newTetro = GameObject.Instantiate(tetrominoSpawnList[_bagIdxList[shuffleCounter]], transform); // For Next Box operation newType = tetrominoSpawnList[_bagIdxList[shuffleCounter + 1]].GetComponent <TetrominoController>().curType; // Add sprite to the "Next Tetromino" box tetroSystem.AddNextTetrominoSprite(newType); // Assign next object in the bag _tmpTetromino = tetrominoSpawnList[_bagIdxList[shuffleCounter + 1]]; // Increase shuffule counter shuffleCounter++; // Return new tetromino object return(newTetro); }
private static TetrominoType NextBlock(ref UInt32 state, TetrominoType[] history) { TetrominoType r = TetrominoType.Empty; for (int i = 0; i < HistoryRetry; ++i) { r = (TetrominoType)(Next(ref state) % 7); if (!history.Contains(r)) // piece is not in history { break; } r = (TetrominoType)(Next(ref state) % 7); } AddHistory(history, r); return(r); }
public static Tetromino GetRandom( ) { int r = Random.Next(( int )TetrominoType.Count); // Re roll if the previous == new if (r == ( int )previous) { r = Random.Next(( int )TetrominoType.Count); } // TODO: Cast r to TetrominoShape? switch (r) { case 0: previous = TetrominoType.ILong; return(new Tetromino(Tetris.TetrominoType.ILong)); case 1: previous = TetrominoType.IShort; return(new Tetromino(Tetris.TetrominoType.IShort)); case 2: previous = TetrominoType.L; return(new Tetromino(Tetris.TetrominoType.L)); case 3: previous = TetrominoType.LInvert; return(new Tetromino(Tetris.TetrominoType.LInvert)); case 4: previous = TetrominoType.Z; return(new Tetromino(Tetris.TetrominoType.Z)); case 5: previous = TetrominoType.ZInvert; return(new Tetromino(Tetris.TetrominoType.ZInvert)); default: break; } return(new Tetromino(TetrominoType.IShort)); }
/// <summary> /// Randomly select a tetromino object from prefabs and spawn the tetromino piece. /// Also sets the correct color of tile sprite. /// </summary> public void SpawnTetromino() { // Randomly Pick one piece of Tetromino GameObject localGO = PickTetromino(); // Assign new tetromino to Tetromino System tetroSystem.currentTetromino = localGO; tetroSystem.tetroController = tetroSystem.currentTetromino.GetComponent <TetrominoController>(); //tetroSystem.tetroMove = tetroSystem.currentTetromino.GetComponent<TetrominoMovementController>(); // Assign new tetromino type and spawn the 4 blocks of the current tetromino type TetrominoType newType = tetroSystem.tetroController.curType; SpawnTetrominoBlocks(newType); // Add new tetromino to TetrominoesInGame list tetroSystem.tetrominoesInGame.Add(localGO); // For T-Spin check initialization GridSystem.gridInstance.isLineCleared = false; }
//Реакция поля на приземление фигуры private void OnTetrominoLandedReaction(Tetromino tetromino) { List <int> rows = tetromino.GetRows(); //Получаем строки, в которые упала фигура DropTetromino(tetromino); if (IsLost()) { FinishGame(); return; } InstantiateNewTetromino(m_nextTetromino); m_nextTetromino = GetNextTetrominoType(); m_preview.ShowPreview(m_nextTetromino); int filledRowsCount = CheckAndDeleteFilledRows(rows); m_data.AddScore(filledRowsCount); m_data.FilledLinesCount += filledRowsCount; }
public void ShowPreview(TetrominoType tetrominoType) { if (m_tetraminoPreview != null) { Destroy(m_tetraminoPreview); } switch (tetrominoType) { case TetrominoType.I: m_tetraminoPreview = Instantiate(PrefabI, transform); break; case TetrominoType.J: m_tetraminoPreview = Instantiate(PrefabJ, transform); break; case TetrominoType.L: m_tetraminoPreview = Instantiate(PrefabL, transform); break; case TetrominoType.O: m_tetraminoPreview = Instantiate(PrefabO, transform); break; case TetrominoType.S: m_tetraminoPreview = Instantiate(PrefabS, transform); break; case TetrominoType.T: m_tetraminoPreview = Instantiate(PrefabT, transform); break; case TetrominoType.Z: m_tetraminoPreview = Instantiate(PrefabZ, transform); break; } }
public Tetromino(TetrominoType type) { this.Type = type; RotationState = 0; switch (type) { case TetrominoType.I:; this.Color = ConsoleColor.Cyan; break; case TetrominoType.O: this.Color = ConsoleColor.DarkYellow; break; case TetrominoType.T: this.Color = ConsoleColor.Magenta; break; case TetrominoType.S: this.Color = ConsoleColor.Green; break; case TetrominoType.Z: this.Color = ConsoleColor.DarkRed; break; case TetrominoType.J: this.Color = ConsoleColor.White; break; case TetrominoType.L: this.Color = ConsoleColor.Red; break; } this.Blocking = fromShort(rotationData[(int)Type][RotationState]); }
public Tetromino(TetrominoType type, bool isGhost) { this.Type = type; this.Angle = 180; switch (this.Type) { case Tetromino.TetrominoType.I: this.Blocs = new Bloc[4]; this.Blocs[0] = new Bloc(this, new Position(0, 0), isGhost); this.Blocs[1] = new Bloc(this, new Position(1, 0), isGhost); this.Blocs[2] = new Bloc(this, new Position(2, 0), isGhost); this.Blocs[3] = new Bloc(this, new Position(3, 0), isGhost); this.Pivot = new Vector2(1.5f, 0.5f); this.SpawnLocationOffset = new Position(0, 0); break; case Tetromino.TetrominoType.O: this.Blocs = new Bloc[4]; this.Blocs[0] = new Bloc(this, new Position(0, 0), isGhost); this.Blocs[1] = new Bloc(this, new Position(1, 0), isGhost); this.Blocs[2] = new Bloc(this, new Position(0, 1), isGhost); this.Blocs[3] = new Bloc(this, new Position(1, 1), isGhost); this.Pivot = new Vector2(0.5f, 0.5f); this.SpawnLocationOffset = new Position(1, 0); break; case Tetromino.TetrominoType.T: this.Blocs = new Bloc[4]; this.Blocs[0] = new Bloc(this, new Position(0, 0), isGhost); this.Blocs[1] = new Bloc(this, new Position(1, 0), isGhost); this.Blocs[2] = new Bloc(this, new Position(2, 0), isGhost); this.Blocs[3] = new Bloc(this, new Position(1, 1), isGhost); this.Pivot = new Vector2(1f, 0f); this.SpawnLocationOffset = new Position(0, 0); break; case Tetromino.TetrominoType.L: this.Blocs = new Bloc[4]; this.Blocs[0] = new Bloc(this, new Position(0, 0), isGhost); this.Blocs[1] = new Bloc(this, new Position(1, 0), isGhost); this.Blocs[2] = new Bloc(this, new Position(2, 0), isGhost); this.Blocs[3] = new Bloc(this, new Position(2, 1), isGhost); this.Pivot = new Vector2(1f, 0f); this.SpawnLocationOffset = new Position(0, 0); break; case Tetromino.TetrominoType.J: this.Blocs = new Bloc[4]; this.Blocs[0] = new Bloc(this, new Position(0, 0), isGhost); this.Blocs[1] = new Bloc(this, new Position(1, 0), isGhost); this.Blocs[2] = new Bloc(this, new Position(2, 0), isGhost); this.Blocs[3] = new Bloc(this, new Position(0, 1), isGhost); this.Pivot = new Vector2(1f, 0f); this.SpawnLocationOffset = new Position(0, 0); break; case Tetromino.TetrominoType.Z: this.Blocs = new Bloc[4]; this.Blocs[0] = new Bloc(this, new Position(1, 0), isGhost); this.Blocs[1] = new Bloc(this, new Position(2, 0), isGhost); this.Blocs[2] = new Bloc(this, new Position(0, 1), isGhost); this.Blocs[3] = new Bloc(this, new Position(1, 1), isGhost); this.Pivot = new Vector2(1f, 0f); this.SpawnLocationOffset = new Position(0, 0); break; case Tetromino.TetrominoType.S: this.Blocs = new Bloc[4]; this.Blocs[0] = new Bloc(this, new Position(0, 0), isGhost); this.Blocs[1] = new Bloc(this, new Position(1, 0), isGhost); this.Blocs[2] = new Bloc(this, new Position(1, 1), isGhost); this.Blocs[3] = new Bloc(this, new Position(2, 1), isGhost); this.Pivot = new Vector2(1f, 0f); this.SpawnLocationOffset = new Position(0, 0); break; } }
private Tetromino(char[,] image, Color color, Coordinates position, TetrominoType type) : base(image, color, position) { this.Type = type; }