/// <summary> /// Create all necessary particles from a tap at a given position, of a given judge type and detail, and with a given /// y-offset to account for in spawning the textYOffset. /// </summary> public void TapAt(float2 position, JudgeType judgeType, JudgeDetail judgeDetail, float textYOffset) { if (judgeType != JudgeType.Lost) { TapParticleAt(position); } position.y += textYOffset; TextParticleAt(position, judgeType, judgeDetail); }
/// <summary> /// Create a text particle at the given position with the given type. /// If needed, create the detail particle. /// </summary> private void TextParticleAt(float2 position, JudgeType judgeType, JudgeDetail judgeDetail) { GameObject text = textParticlePool[currentTextParticleIndex]; text.GetComponent <Transform>().position = new float3(position, 0); text.GetComponent <Renderer>().material = textJudgeMaterials[(int)judgeType]; text.GetComponent <ParticleSystem>().Play(); IncrementOrCycle(ref currentTextParticleIndex, textParticlePoolSize); //Early - Late if (judgeDetail == JudgeDetail.Early) { earlylateJudgeRenderer.material = earlyJudgeMaterial; earlylateJudgeParticleSystem.Clear(); earlylateJudgeParticleSystem.Play(); } if (judgeDetail == JudgeDetail.Late) { earlylateJudgeRenderer.material = lateJudgeMaterial; earlylateJudgeParticleSystem.Clear(); earlylateJudgeParticleSystem.Play(); } }