public void spawnNext() { getPositions(); current = next; current.transform.position = spawnpos; current.active = true; createNext(); //starts at nextpos }
private void createNext() { // Random Index int i = Random.Range(0, tetrisBlocks.Length); // Spawn Group at current Position next = Instantiate(tetrisBlocks[i], nextpos, Quaternion.identity).GetComponent <tetrisBehavior>(); next.active = false; print("Spawned block"); }
private void Start() { current = null; hold = null; flag = GameObject.FindGameObjectWithTag("Flag").GetComponent <Flag>(); main_cam = GameObject.FindGameObjectWithTag("MainCamera"); offset = main_cam.GetComponent <Camera>().orthographicSize; getPositions(); createNext(); spawnNext(); // we need to ensure that the game's time scale is always set to one when the game has started Time.timeScale = 1f; }
public void hold_transfer() { getPositions(); current.active = false; if (hold != null) { hold.active = true; hold.transform.position = current.transform.position; current.transform.position = holdpos; tetrisBehavior temp = hold; hold = current; current = temp; } else { current.transform.position = holdpos; hold = current; spawnNext(); } }