void AddToGrid(TerisBlock teris) { if (teris.isBomb) { BombEffect(teris); } else { foreach (Transform children in teris.transform) { int roundedX = Mathf.RoundToInt(children.transform.position.x); int roundedY = Mathf.RoundToInt(children.transform.position.y); grid[roundedX, roundedY] = children; if (CheckForGameover(roundedY)) { break; } } switch (teris.ID) { case 1: falled1 = true; break; case 2: falled2 = true; break; } teris.enabled = false; } CheckForLines(); CheckTwoTerisFalled(); }
IEnumerator StartNewRound() { waitingForNextRound = true; yield return(new WaitForSeconds(0.01f)); teris1 = null; teris2 = null; NewTetromino(); }
void AddToGridNew2(TerisBlock teris1, TerisBlock teris2) { teris1.transform.SetParent(allTiles); teris2.transform.SetParent(allTiles); falled1 = true; falled2 = true; teris1.enabled = false; teris2.enabled = false; CheckForLines(); CheckTwoTerisFalled(); }
public void CheckClash(TerisBlock another) { foreach (Vector3 pos in currentPoints) { if (another.currentPoints.Contains(pos)) { another.MoveBack(); break; } } }
void AddToGrid(TerisBlock teris1, TerisBlock teris2) { teris1.transform.SetParent(alltiles); teris2.transform.SetParent(alltiles); if (teris1.isBomb) { BombEffect(teris1); } else { foreach (Transform children in teris1.transform) { int roundedX = Mathf.RoundToInt(children.transform.position.x); int roundedY = Mathf.RoundToInt(children.transform.position.y); grid[roundedX, roundedY] = children; if (CheckForGameover(roundedY)) { break; } } teris1.enabled = false; } if (teris2.isBomb) { BombEffect(teris2); } else { foreach (Transform children in teris2.transform) { int roundedX = Mathf.RoundToInt(children.transform.position.x); int roundedY = Mathf.RoundToInt(children.transform.position.y); grid[roundedX, roundedY] = children; if (CheckForGameover(roundedY)) { break; } } teris2.enabled = false; } falled1 = true; falled2 = true; CheckForLines(); CheckTwoTerisFalled(); }
void AddToGridNew(TerisBlock teris) { teris.transform.SetParent(allTiles); switch (teris.ID) { case 1: falled1 = true; break; case 2: falled2 = true; break; } teris.enabled = false; CheckForLines(); CheckTwoTerisFalled(); }
void BombEffect(TerisBlock teris) { teris.isBomb = false; teris.enabled = false; GameObject effect = Instantiate(Resources.Load <GameObject>("Effect/Bomb_Anim_Effect"), teris.transform.position, Quaternion.identity); Sound.Instance.PlayEffect("Explosion"); StartCoroutine(camShake.Shake(.15f, .25f)); Transform children = teris.transform.GetChild(0); int roundedX = Mathf.RoundToInt(children.transform.position.x); int roundedY = Mathf.RoundToInt(children.transform.position.y); for (int x = roundedX - 2; x < roundedX + 3; x++) { for (int y = roundedY - 2; y < roundedY + 3; y++) { int newx = Mathf.Clamp(x, 0, 9); int newy = Mathf.Clamp(y, 0, 19); if (grid[newx, newy] != null) { Destroy(grid[newx, newy].gameObject); grid[newx, newy] = null; } } } switch (teris.ID) { case 1: falled1 = true; break; case 2: falled2 = true; break; } Destroy(effect, 0.55f); teris.gameObject.SetActive(false); }
public void NewTetromino() { if (Game.Instance.gameOver) { return; } falled1 = false; falled2 = false; GameObject go1 = Instantiate(Resources.Load <GameObject>(next1.prefabPath), spawnPoint1.position, Quaternion.identity); teris1 = go1.GetComponent <TerisBlock>(); teris1.ID = 1; GameObject go2 = Instantiate(Resources.Load <GameObject>(next2.prefabPath), spawnPoint2.position, Quaternion.identity); teris2 = go2.GetComponent <TerisBlock>(); teris2.ID = 2; waitingForNextRound = false; RandomNextTeris(); }
public bool CheckRotClash(TerisBlock another, bool isBlock) { foreach (Vector3 pos in currentPoints) { if (another.currentPoints.Contains(pos)) { if (isBlock) { another.RotBack(); return(false); } else { RotBack(); another.RotBack(); return(false); } } } return(true); }
void BombEffect(TerisBlock teris) { if (teris.transform.GetChild(0).GetComponent <Animator>() != null) { teris.transform.GetChild(0).GetComponent <Animator>().SetTrigger("Dispear"); } teris.enabled = false; GameObject effect = Instantiate(Resources.Load <GameObject>("Effect/BombEffect"), teris.transform.position, Quaternion.identity); Transform children = teris.transform.GetChild(0); int roundedX = Mathf.RoundToInt(children.transform.position.x); int roundedY = Mathf.RoundToInt(children.transform.position.y); for (int x = roundedX - 2; x < roundedX + 3; x++) { for (int y = roundedY - 2; y < roundedY + 3; y++) { int newx = Mathf.Clamp(x, 0, 9); int newy = Mathf.Clamp(y, 0, 20); if (grid[newx, newy] != null) { Destroy(grid[newx, newy].gameObject); grid[newx, newy] = null; } } } switch (teris.ID) { case 1: falled1 = true; break; case 2: falled2 = true; break; } Destroy(effect, 2f); Destroy(teris.gameObject, 0.5f); }
public override void execute(TerisBlock teris1, TerisBlock teris2) { }
public abstract void execute(TerisBlock teris1, TerisBlock teris2);