// Update is called once per frame void Update() { if (gameControllerScript.getEnd() || gameControllerScript.getPause()) { return; } timeInterval += Time.deltaTime; if (!(timeInterval >= curentSpawnTime)) { return; } int randomRange = 10 + 10 + 5 + 2 * gameControllerScript.GetUpgrate(4); int randomValue = Random.Range(0, randomRange); if (randomValue < 10) { state = 0; } else if (randomValue < 20) { state = 1; } else { state = 2; } switch (state) { case 0: if (minSpawnTime < curentSpawnTime) { curentSpawnTime -= incTime; } if (minRange < curentRange) { curentRange -= incRange; } timeInterval = 0; SpawnRocks(); break; case 1: timeInterval = 0; SpawnEnemy(Random.Range(0, flyEnemySpawns / 5) + 1); flyEnemySpawns++; break; case 2: timeInterval = 0; SpawnCoin(); break; } }
// Update is called once per frame void Update() { if (gameControllerScript.getEnd() || gameControllerScript.getPause()) { return; } float curentSpeed = startSpeed + increaseSpeed * gameControllerScript.gameTime / (1 + 0.2f * gameControllerScript.GetUpgrate(1)); transform.Translate(new Vector3(-curentSpeed, 0, 0)); if (transform.position.x < -15f) { Destroy(gameObject); } }
// Update is called once per frame void Update() { if (gameControllerScript.getEnd() || gameControllerScript.getPause()) { return; } float curentSpeed = startSpeed + (increaseSpeed * gameControllerScript.gameTime) / (1 + 0.2f * gameControllerScript.GetUpgrate(1)); transform.Translate(new Vector3(-curentSpeed, 0, 0)); if (transform.position.x < -17.75f) { transform.Translate(new Vector3(17.75f * 2 * curentSpeed / Mathf.Abs(curentSpeed), 0, 0)); } }