IEnumerator CreateSpark() { yield return(new WaitForSeconds(Random.Range(0f, 2f))); SparkController spark = Instantiate(sparkController, spawnPoint.position, Quaternion.identity); spark.SetEnergy(RndSparkCharge()); spark.track = tracks[Random.Range(0, 3)]; isRunningCoroutine = false; }
private void OnMouseDown() { int sparkPrice = economyManager.BuySpark(); if (sparkPrice != 0) { SparkController spark = Instantiate(sparkPrefab, spawnPoint.position, Quaternion.identity); spark.SetEnergy(sparkPrice); spark.track = track; spark.transform.tag = "PlayerSpark"; } }