IEnumerator TurnOffFrashlight() { GFX.sprite = takeOutFrashlightImage; yield return(new WaitForSeconds(0.2f)); GFX.sprite = defaultImage[0]; rightHandMode = RightHandMode.Nothing; }
IEnumerator UseItemAnimation(string userType) { int mode = 0; if (rightHandMode == RightHandMode.Frashlight) { mode = 1; } else if (rightHandMode == RightHandMode.Flare) { mode = 2; } GFX.sprite = takingImage[mode]; if (userType == "Flare") { flareIsInHand = true; for (int i = 0; i < flareImage.Length; i++) { yield return(new WaitForSeconds(0.2f)); GFX.sprite = flareImage[i]; } rightHandMode = RightHandMode.Flare; yield return(new WaitForSeconds(11f)); flareIsInHand = false; rightHandMode = RightHandMode.Nothing; } else { float duration = 0.2f; Debug.Log("Animation start"); int userTypeIndex = -1; if (userType == "Bandage") { duration = 0.5f; userTypeIndex = 0; } else if (userType == "Water") { duration = 0.7f; userTypeIndex = 1; } else if (userType == "GlowStick") { userTypeIndex = 2; } yield return(new WaitForSeconds(0.2f)); if (rightHandMode == RightHandMode.Nothing) { GFX.sprite = holdInHandImage[userTypeIndex]; yield return(new WaitForSeconds(0.2f)); GFX.sprite = usingImage[userTypeIndex]; yield return(new WaitForSeconds(duration)); } else if (rightHandMode == RightHandMode.Frashlight) { GFX.sprite = holdInHandWithFrashlightImage[userTypeIndex]; yield return(new WaitForSeconds(0.2f)); GFX.sprite = usingWithFrashlightImage[userTypeIndex]; yield return(new WaitForSeconds(duration)); } else if (rightHandMode == RightHandMode.Flare) { GFX.sprite = holdInHandWithFlareImage[userTypeIndex]; yield return(new WaitForSeconds(0.2f)); GFX.sprite = usingWithFlareImage[userTypeIndex]; yield return(new WaitForSeconds(duration)); } } mode = 0; if (rightHandMode == RightHandMode.Frashlight) { mode = 1; } else if (rightHandMode == RightHandMode.Flare) { mode = 2; } GFX.sprite = defaultImage[mode]; }