//if you come from pause you need to set pause to false before running a new level public void SetEasy() { if (sv.getPause()) { sv.setPause(false); } GameObject.FindGameObjectWithTag("Options").SetActive(false); inst.SetActive(true); StartCoroutine(StartLevel("Easy")); }
// Update is called once per frame void Update() { pause = sv.getPause(); if (pause == false) { transform.Translate(new Vector3(0, 1, 0) * speed * Time.deltaTime); } }
// Update is called once per frame void Update() { pause = sv.getPause(); if (pause == false) { offset = new Vector2(0, Time.time * speed); GetComponent <Renderer>().material.mainTextureOffset = offset; } }
// Update is called once per frame void Update() { pause = sv.getPause(); if (pause == false) { timer -= Time.deltaTime; if (timer <= 0 && !(coin.tag == "Tyre" && sv.getObstacles() == false)) { Vector2 coinPos = new Vector2(Random.Range(-6.5f, 6.9f), transform.position.y); Instantiate(coin, coinPos, transform.rotation); timer = delaytimer; } } }
// Update is called once per frame void Update() { pause = sv.getPause(); if (pause == false) { timer -= Time.deltaTime; if (timer <= 0) { randomSpeed = Random.Range(6, 8); Vector2 snowflakePos = new Vector2(Random.Range(-8f, 8f), transform.position.y); snowflake.GetComponent <EnemycarMove>().speed = randomSpeed; Instantiate(snowflake, snowflakePos, transform.rotation); timer = delaytimer; } } }
// Update is called once per frame void Update() { pause = sv.getPause(); obstacles = sv.getObstacles(); if (pause == false && obstacles == true && boostMode == false) { timer -= Time.deltaTime; if (timer <= 0) { Vector3 carPos = new Vector3(Random.Range(-cameraWidth / 2 + 2.5f, cameraWidth / 2 - 2.5f), transform.position.y, 0); //get random position in the area above the camera // 2.5f keeps the randomly spawned cars off the grass carNo = (int)Random.Range(0, 4); //get random car from the prefabs Instantiate(cars[carNo], carPos, transform.rotation); //instantiate it with the random position timer = delaytimer; //reset the timer } } }
// Update is called once per frame void Update() { pause = sv.getPause(); if (pause == false) { timer -= Time.deltaTime; if (timer <= 0) { Vector3 treePos = new Vector3(Random.Range(-cameraWidth / 2, -cameraWidth / 2 + 1.2f), transform.position.y, -8); //get random position in the area above the camera // 2.5f keeps the randomly spawned cars off the grass treeNo = (int)Random.Range(0, 2); //get random car from the prefabs Instantiate(trees[treeNo], treePos, transform.rotation); //instantiate it with the random position treePos = new Vector3(Random.Range(cameraWidth / 2, cameraWidth / 2 - 1.2f), transform.position.y, -8); //get random position in the area above the camera // 2.5f keeps the randomly spawned cars off the grass treeNo = (int)Random.Range(0, 2); //get random car from the prefabs Instantiate(trees[treeNo], treePos, transform.rotation); //instantiate it with the random position timer = delaytimer; //reset the timer } } }
// Update is called once per frame void Update() { pause = sv.getPause(); if (collision == false && pause == false) { mousePosition = Input.mousePosition; mousePosition = Camera.main.ScreenToWorldPoint(mousePosition); mousePosition.x = Mathf.Clamp(mousePosition.x, -6.5f, 6.25f); mousePosition.y = Mathf.Clamp(mousePosition.y, -(Screen.height / 200) + 1.2f, (Screen.height / 200) - 1.2f); //Debug.Log(Screen.height); // mousePosition.y = Mathf.Clamp(mousePosition.x, -6.5f, 6.7f); //if (mousePosition.x < -6.5f || mousePosition.x > 6.7f) //{ // transform.position = Vector2.Lerp(transform.position, mousePosition, moveSpeed); //} //else //{ transform.position = Vector2.Lerp(transform.position, mousePosition, moveSpeed); //} } }