void Start() { EventManager.AddBallSwanInvoker(this); ballSpawnEvent.Invoke(); timer = gameObject.AddComponent <Timer>(); float d = Random.Range(ConfigurationUtils.Min, ConfigurationUtils.Max); timer.Duration = d; timer.Run(); }
private IEnumerator SpawnRoutine() { while (true) { yield return(new WaitForSeconds(spawnDelay)); BallSpawnEvent?.Invoke(spawnPoints); } }
// Update is called once per frame void Update() { if (timer.Finished || transform.position.y - .05f < ScreenUtils.ScreenBottom) { //BallSpawner bs=Camera.main.GetComponent<BallSpawner>(); //bs.Spawn(); ballSpawnEvent.Invoke(); Destroy(gameObject); } if (Speedtimer.Finished) { rigidbidy.velocity = speed; noSpeed = true; } }