Beispiel #1
0
	void Update()
	{
		if (restart && Notes.Count == 0) {
			
		}
		wait += Time.deltaTime;
		if (wait < waitTime) {
			return;
		}
		// hide notes
		float currentAngle = GetCurrentAngle ();
		float disappearLimitBegin = currentAngle - behindPoleBegin;
		float disappearLimitEnd = currentAngle - behindPoleEnd;
		if (disappearLimitBegin < 0.0f) 
		{
			disappearLimitBegin += 360.0f;
		}

		if (disappearLimitEnd < 0.0f) 
		{
			disappearLimitEnd += 360.0f;
		}

		for (int i = Notes.Count - 1; i >= 0; --i) 
		{
			note = Notes [i];
			if (note.Played) 
			{
				float noteAngle = note.GetAngle ();
				if ((disappearLimitEnd > disappearLimitBegin && disappearLimitEnd < noteAngle + 360.0f && noteAngle < disappearLimitBegin) 
					|| (disappearLimitEnd < disappearLimitBegin && disappearLimitEnd < noteAngle && noteAngle < disappearLimitBegin))
				{
					note.gameObject.SetActive (false);
					Notes.RemoveAt (i);
					AvailableNotes.Add (note);
				}
			}
		}

		// create notes
		if (currentNote) 
		{
			float lengthAngleDiff = currentNote.NoteSetting.Length * noteLength;
			float currentNoteAngle = currentNote.GetAngle ();
			if (currentNoteAngle > currentAngle) 
			{
				currentNoteAngle -= 360.0f;
			}
			float currentLength = currentNoteAngle - currentAngle + creationAngle;

			if (currentLength >= lengthAngleDiff) 
			{
				currentNote = CreateNote (noteManager.GetNextNote (), currentNoteAngle - lengthAngleDiff);
			}
		} 
		else 
		{
			currentNote = CreateNote (noteManager.GetNextNote (), currentAngle + creationAngle);
		}
	}