// Update is called once per frame void Update() { y_down = Random.Range(-2.5f, 2); y_up = Random.Range(2, 3.8f); { transform.position = Vector3.MoveTowards(transform.position, target, Time.deltaTime * speed); if (transform.position == target && target.y != y_down) { target.y = y_down; target.x -= speedRun; } else if (transform.position == target && target.y != y_up) { target.y = y_up; target.x -= speedRun; } } if (gameObject.transform.position.x < -10) { Destroy(gameObject); } if (gameObject.transform.position.x < -7 && gameObject.transform.position.x > -7.15f) { Birds_player.CountScore(); } }
void Update() { target = new Vector3(transform.position.x - speed, Random.Range(-4, 4), 0); transform.position = Vector3.MoveTowards(transform.position, target, Time.deltaTime * speed); target.x += speed; if (gameObject.transform.position.x < -10) { Destroy(gameObject); } if (gameObject.transform.position.x < -7 && gameObject.transform.position.x > -7.2f) { Birds_player.CountScore(); } }
// Update is called once per frame void Update() { { transform.position = Vector3.MoveTowards(transform.position, target, Time.deltaTime * speed); target.x -= speed; if (gameObject.transform.position.x < -7 && gameObject.transform.position.x > -7.1f) { Birds_player.CountScore(); } if (gameObject.transform.position.x < -10) { Destroy(gameObject); } } }