public void Activate(GameObject piece) { foreach (GameObject spawn in GameObject.FindGameObjectsWithTag("Spawn Box")) { SpawnBox box = spawn.GetComponent <SpawnBox>(); if (box.getLastPieceComponent().player != piece.GetComponent <Piece>().player) { Activation(box.getLastPiece()); } } }
private void keyControl() { if (commandsEnable) { switch (controls) { case Player.Controls.Arrow: if (Input.GetKeyDown(KeyCode.UpArrow)) { spawner.getLastPieceComponent().rotation(); } if (Input.GetKey(KeyCode.DownArrow)) { spawner.getLastPieceComponent().fastDrop(); } else { spawner.getLastPieceComponent().resetDrop(); } if (Input.GetKeyDown(KeyCode.RightArrow)) { spawner.getLastPieceComponent().movePiece(1); } if (Input.GetKeyDown(KeyCode.LeftArrow)) { spawner.getLastPieceComponent().movePiece(-1); } if (Input.GetKeyDown(KeyCode.O)) { ActivateBonus(); } if (Input.GetKeyDown(KeyCode.L)) { ActivateMalus(); } break; default: if (Input.GetKeyDown(KeyCode.Z)) { spawner.getLastPieceComponent().rotation(); } if (Input.GetKey(KeyCode.S)) { spawner.getLastPieceComponent().fastDrop(); } else { spawner.getLastPieceComponent().resetDrop(); } if (Input.GetKeyDown(KeyCode.D)) { spawner.getLastPieceComponent().movePiece(1); } if (Input.GetKeyDown(KeyCode.Q)) { spawner.getLastPieceComponent().movePiece(-1); } if (Input.GetKeyDown(KeyCode.T)) { ActivateBonus(); } if (Input.GetKeyDown(KeyCode.G)) { ActivateMalus(); } break; } } }