void Update() { instance = this; var energy = (Time.time / 2.0f) % 10 / 10; var life = (Time.time % 10) / 10; energyBar.transform.localScale = new Vector3(energy, 1, 1); lifeBar.transform.localScale = new Vector3(life, 1, 1); if (hasChanges && match3 != null) { if (waitCounter++ < waitTime) { return; } hasChanges = !match3.check(); if (state == NeedsFallDown) { fallDown(); state = NeedsRefill; } else if (state == NeedsRefill) { refill(); state = Done; } else if (hasChanges && state == Done) { delete(); state = NeedsFallDown; comboCounter++; text = "Points: " + points + " Combo: x" + comboCounter; } else { comboCounter = 0; text = "Points: " + points; } waitCounter = 0; } output.text = text; //Resolution res = Screen.currentResolution; //screen = new Vector3 (res.width, res.height); if (lastScale == scale) { return; } match3 = new Match3(); match3.init(w, h); hasChanges = true; lastScale = scale; foreach (var item in gameObject.GetComponentsInChildren <Tile>()) { if (item.tag != "keep") { Destroy(item.gameObject); } } data = new TileData[h][]; //size = (int) (scale * 3); for (int y = 0; y < h; y++) { var row = new TileData[w]; for (int x = 0; x < w; x++) { row [x] = new TileData { y = y, x = x }; } data [y] = row; } for (int tempY = 0; tempY < h; tempY++) { for (int tempX = 0; tempX < w; tempX++) { createButton(tempY, tempX, data [tempY] [tempX]); } } refreshColours(); }