// Use this for initialization void Awake() { _tetrisManager = GetComponent <TetrisManager>(); _spawnManager = GetComponent <SpawnManager>(); DontDestroyOnLoad(gameObject); }
//좌우 이동 public void MoveXAxis(int side) { transform.position += new Vector3((side * batchGap), 0, 0); if (TetrisManager.IsValidGridPos(transform) == false) { transform.position -= new Vector3((side * batchGap), 0, 0); } Debug.Log("Out of Range"); }
// Use this for initialization void Start() { // spawner(); storedShapes = new List <GameObject>(); spawnOne(); tL = GameObject.FindGameObjectWithTag("tetrisObj").GetComponent <tetrisLogic>(); GameObject gm = GameObject.Find("GameManager"); gameOverMain = gm.GetComponent <TetrisManager>(); }
private void Awake() { if (!instance) { instance = this; gameObject.name = "TetrisManager"; } else { Destroy(gameObject); } }
private void SetupSingleton() { if (_instance != null && _instance != this) { Destroy(this.gameObject); } else { _instance = this; DontDestroyOnLoad(this.gameObject); } }
//배열 회전 공식 => a[i][j] -> a[j][N - 1 - i]; //시계방향 회전 public void TurnTetrimino() { transform.Rotate(0, 0, -90); if (TetrisManager.IsValidGridPos(transform) == false) { transform.Rotate(0, 0, 180); if (TetrisManager.IsValidGridPos(transform) == false) { transform.Rotate(0, 0, -90); } Debug.Log("fail to rotate Tetrimino"); } }
// Use this for initialization void Start() { losePanel.SetActive(false); loseConds = new List <Component>(); for (int i = 0; i < gameObject.transform.childCount; i++) { GameObject getObj = gameObject.transform.GetChild(i).gameObject; loseConds.Add(getObj.GetComponent <roof_obstacle>()); } //Debug.Log(loseConds.Count); GameObject gm = GameObject.Find("GameManager"); gameOverMain = gm.GetComponent <TetrisManager>(); tetrisShapes = GameObject.Find("Shapes"); }
public void Set(List <Vector2Int> shape) { // disable all if block is empty if (shape == null) { foreach (var sprite in m_Sprites) { sprite.enabled = false; } return; } // collision height var collisionHeight = TetrisManager.GetCollisionHeight(shape); if (collisionHeight <= m_MinHeight) { foreach (var sprite in m_Sprites) { sprite.enabled = false; } return; } // get active sprites var activeSprites = m_Sprites.Take(shape.Count).ToList(); // disable un active sprites foreach (var sprite in m_Sprites.Skip(activeSprites.Count())) { sprite.enabled = false; } // set active sprites positions var shapePosition = shape.Select(n => new Vector2Int(n.x, n.y - collisionHeight)).ToList(); for (var n = 0; n < shapePosition.Count; n++) { activeSprites[n].transform.localPosition = new Vector3(shapePosition[n].x + 0.5f, shapePosition[n].y + 0.5f, 0.5f); activeSprites[n].enabled = true; } }
void Start() { switch (Game.current_difficulty) { case 1: difficulty_mod = 1.2f; break; case 2: difficulty_mod = 1.0f; break; case 3: difficulty_mod = 0.5f; break; case 4: difficulty_mod = 0.3f; break; case 5: difficulty_mod = 0.1f; break; case 6: difficulty_mod = 0.05f; break; } tm = GameObject.FindGameObjectWithTag("Manager").GetComponent <TetrisManager>(); // Default position not valid? Then it's game over if (!isValidGridPos()) { tm.GameOver(); Destroy(gameObject); } }
private void Init() { TetrisManager.CreateInstance(); }
private void Start() { _manager = new TetrisManager(); }
void Start() { SpawnNew(); next = Random.Range(0, shapes.Length); manager = this; }