// Use this for initialization void Start() { gameManager = GameObject.Find("GameManager").GetComponent <DropsGameManager>(); transform.position = new Vector3(Random.Range(-gameManager.maxDistanceFromCenter, gameManager.maxDistanceFromCenter), 1, 4.5f); startingX = transform.position.x; transform.localScale = transform.localScale * Random.Range(0.8f, 1.2f); rotationSpeed = rotationSpeed * Random.Range(-1f, 1f); Vector3 newPosition = transform.position; transform.rotation = Quaternion.Euler(0, phase * rotationSpeed, 0); newPosition += Vector3.back * fallSpeed * Time.deltaTime; if (wave) { newPosition.x = startingX + Mathf.Sin(transform.position.z); } transform.position = newPosition; }
// Use this for initialization void Start () { stopped = false; gameManager = GameObject.Find("GameManager").GetComponent<DropsGameManager>(); timeTotal = gameManager.GetTimeLeft(); bombDelay = Random.Range(timeTotal/bombCountMax, timeTotal/bombCountMin); }