IEnumerator CorUsingItem(ItemInfo info, bool allStop = false) { //Debug.Log("Use : " + info.name); float timer = 0; if (allStop == false) { float effectVolume; effectVolume = (SoundManager.Instance == null) ? 1 : SoundManager.Instance.effectVolume; audioSource.PlayOneShot(info.audioClip, effectVolume); // Active switch (info.type) { // 즉발 default: case ItemType.Coins: myEarnedCoin += (int)info.effectValue; yield break; case ItemType.CoinBox: SetEarnedCoinBox((int)info.duration, (int)info.effectValue); yield break; case ItemType.LifePotion: player.playerTimeBar.AddTimerBonus(info.effectValue); yield break; // 이하 액티브 case ItemType.Invincible: player.ActiveItemInvincible(info.duration); break; case ItemType.Minimalize: player.spriteBodyRenderer.transform.localScale = new Vector3(info.effectValue, info.effectValue, 1); break; case ItemType.SpeedDown: origValue = MapManager.Instance.speed; MapManager.Instance.speed *= info.effectValue; break; case ItemType.SlowMotion: Time.timeScale = info.effectValue; ItemPostProcess(true); break; } Image holder; if (usingItemDisplayHolders.ContainsKey(info.type) == false) { holder = Instantiate(usingItemDisplayHolderPrefab, usingItemDisplayer); holder.sprite = itemSprite[(int)info.type]; usingItemDisplayHolders.Add(info.type, holder); } else { holder = usingItemDisplayHolders[info.type]; } holder.fillAmount = 1; holder.gameObject.SetActive(true); // Timer while (timer < info.duration) { timer += Time.deltaTime; holder.fillAmount -= Time.deltaTime / info.duration; // 유지해야만 하는 아이템의 경우 여기에 넣어서 유지한다 switch (info.type) { case ItemType.SlowMotion: if (Time.timeScale != 0) { Time.timeScale = info.effectValue; } break; } yield return(Time.deltaTime); } holder.fillAmount = 0; //Debug.Log(Time.deltaTime); //Debug.Log(timer); holder.gameObject.SetActive(false); } else { usingItemDisplayHolders.Clear(); } // Deavtive switch (info.type) { // 이하 액티브 case ItemType.Invincible: player.playerStatus.invincible = false; break; case ItemType.Minimalize: player.spriteBodyRenderer.transform.localScale = new Vector3(1, 1, 1); break; case ItemType.SpeedDown: MapManager.Instance.speed = origValue; break; case ItemType.SlowMotion: Time.timeScale = 1; ItemPostProcess(false); break; } //Debug.Log("END : " + info.name); }