private IEnumerator Reload(SkeletonKit kit) { float t = 0; while (t < 1 && reloading) { t += Time.deltaTime / reloadTime; kit.SetMainSprite(crossbowSprites[(int)(t * 5)]); yield return(new WaitForEndOfFrame()); } if (reloading) { loaded = true; Debug.Log("Reloaded"); } }
private IEnumerator FireBolt(SkeletonKit kit) { bool fired = false; float t = 0; while (t < 1) { t += Time.deltaTime / .1f; int spriteVal = (int)(t * 3); if (spriteVal == 2 && !fired) { SpawnBolt(kit); fired = true; } kit.SetMainSprite(crossbowSprites[(int)(6 + spriteVal)]); yield return(new WaitForEndOfFrame()); } }