void UpdateCurDynamicBrick() { for (int i = 0; i < dynamicBricks.Count; i++) { DynamicBrick db = dynamicBricks [i]; db.Update(); } }
void UpdateLeaveDynamicBrick() { for (int i = 0; i < leaveDynamicBricks.Count; i++) { DynamicBrick db = leaveDynamicBricks [i]; db.Update(); if (db.Over) { pool.Free(db); leaveDynamicBricks.Remove(db); i--; } } }
void DynamicEffect() { bool leave = player.transform.localPosition.x > curValidateX + 2f; for (int i = 0; i < dynamicBricks.Count; i++) { DynamicBrick db = dynamicBricks [i]; db.Update(); // if (player.transform.localPosition.x > db.Go.transform.localPosition.x) { // leaveCount++; // leaveDynamicBricks.Add (db); // SetLeave (db, leaveCount); // dynamicBricks.Remove (db); // i--; // } } UpdateLeaveDynamicBrick(); UpdateSimulatorPot(); leave = true; if (leave && dynamicBricks.Count < 20) { curValidateX = player.transform.localPosition.x; int x, y; int r = Random.Range(0, 10); if (r < 3) { x = Random.Range(10, 15); y = Random.Range(-5, 5); } else if (r < 6) { x = Random.Range(3, 8); y = Random.Range(-15, -10); } else { x = Random.Range(3, 8); y = Random.Range(10, 15); } GenerateBlockBrick(new Vector2(endPot.x, 0), 3, 3, new Vector3(x, y, x), delayTime_Cell * 5, false); } }