IEnumerator StoneSpawn() { while (state.Equals(GameState.OnGoing)) { if (!isMainCharMagic) { isMainCharMagic = true; MainCharAnim.SetBool("magic", true); // MiniRBAnim1.SetBool("clear", false); // MiniRBAnim2.SetBool("clear", false); } if (killCount < waveLimit) { rotateAngle.z = UnityEngine.Random.Range(-5.0f, 5.0f); gameObject.transform.Rotate(rotateAngle); //gameObject.transform.eulerAngles = new Vector3(0f, 0f, Mathf.Clamp(gameObject.transform.eulerAngles.z, -45f, -75f)); throwPower = TargetObject.transform.position - gameObject.transform.position; throwPower.Normalize(); StonePool.Respawn(transform.position, transform.rotation); yield return(new WaitForSeconds(3f)); } else { clearGameAudio.Play(); MainCharAnim.SetBool("magic", false); BigRbAnim.SetBool("clear", true); MiniRBAnim1.SetBool("clear", true); MiniRBAnim2.SetBool("clear", true); isMainCharMagic = false; Debug.Log("GameEnd!"); GameClear(); yield return(new WaitForEndOfFrame()); } } }
IEnumerator StoneSpawn() { while (true) { StonePool.Respawn(transform.position, transform.rotation); yield return(new WaitForSeconds(2f)); } }
void Update() { if (timeLineQueue.Count != 0) { //Debug.Log(timeStamp); string[] data = timeLineQueue.Peek().Split("/".ToCharArray()[0]); Debug.Log(float.Parse(data[0])); Debug.Log($"Time Stamp : {timeStamp}"); Debug.Log($"Calculate Stamp : {Time.time - timeStamp - 0.3f}"); if (float.Parse(data[0]) <= Time.time - timeStamp - 0.3f) { for (int loopCount = 1; loopCount < data.Length; loopCount++) { NotePool.Respawn(GeneratePos[int.Parse(data[loopCount])].position, Quaternion.identity); //Debug.Log($"Generate note at {int.Parse(data[loopCount])}, Time : {Time.time}"); } timeLineQueue.Dequeue(); } } }