IEnumerator Load() { yield return(new WaitForSeconds(0.5f)); async = ChangeScene(_sceneName); async.allowSceneActivation = false; float timer = 0f; float minProcess = 0f; while (timer < minTimeLoad) { minProcess = Mathf.Clamp(timer / minTimeLoad * 0.9f * RandomPlus.getValue(), minProcess, 1f); timer += Time.deltaTime; float step = (Time.deltaTime / minTimeLoad * 0.9f) * RandomPlus.getValue(); minProcess += step; slider.value = minProcess; yield return(0); } while (!async.isDone) { if (async.progress >= 0.9f) { button.gameObject.SetActive(true); slider.value = 1; break; } else { slider.value = Mathf.Clamp(async.progress, minProcess, 1f); } yield return(0); } }
protected void DropTriger(float exDropRate = 1f) { foreach (var item in listDrop) { if (RandomPlus.getValue() < item.dropRate * exDropRate) { GameObject g = Instantiate(samleItemDrop); g.SetActive(true); g.GetComponent <LoadItem>()?.Load(item); g.transform.SetParentWithoutChangeScale(null, transform.position); } } }