protected override void MovePhase() { base.MovePhase(); if (gameObject.activeSelf) { float ProgressBy100 = CurrentFrame * Speed; float ProgressBy1 = ProgressBy100 / 100; if (!IsHit && (!Mode.Equals(NoteInfo.SlideNoteStart) || (Mode.Equals(NoteInfo.SlideNoteStart) && Game.Frame < ReachFrame))) { float cX = NotePath.GetStarlightX(StartPos.x, EndPos.x, ProgressBy1); float cY = NotePath.GetStarlightY(ProgressBy100); CurrentPos = new Vector3(cX, cY, CurrentPos.z); Body.anchoredPosition3D = CurrentPos; Body.localScale = new Vector3(NotePath.GetStarlightScale(ProgressBy1), NotePath.GetStarlightScale(ProgressBy1), 1); BeforePos = CurrentPos; } else if (Mode.Equals(NoteInfo.SlideNoteStart) && !Game.Paused && (IsHit || Game.Frame >= ReachFrame)) { Body.anchoredPosition3D += new Vector3(((Game.Dispensor.Notes[NextNoteID].EndPos.x - EndPos.x) / ((SlideFrameDistance + SlideFrameCalibrator) / 60)) * Time.deltaTime, 0); if (IsHit) { FlickBorderLeft = Body.anchoredPosition3D.x - 98; FlickBorderRight = Body.anchoredPosition3D.x + 98; } } if (!Game.Paused) { if (!Flick.Equals(FlickMode.None) && ConnectorToNext != null && ConnectorToNext.gameObject.activeSelf) { ConnectorToNext.StartPos = Body.anchoredPosition3D; ConnectorToNext.StartScale = Body.localScale.x * 120; } if (!Flick.Equals(FlickMode.None) && ConnectorsFromPrevious.Count > 0) { for (int i = 0; i < ConnectorsFromPrevious.Count; i++) { if (ConnectorsFromPrevious[i] != null && !Game.Dispensor.Notes[ConnectorsFromPrevious[i].OwnerID].IsHit) { ConnectorsFromPrevious[i].EndPos = Body.anchoredPosition3D; ConnectorsFromPrevious[i].EndScale = Body.localScale.x * 120; } if (ConnectorsFromPrevious[i] != null && Game.Dispensor.Notes[ConnectorsFromPrevious[i].OwnerID].IsHit) { ConnectorsFromPrevious[i].gameObject.SetActive(false); } } } if (Mode.Equals(NoteInfo.LongNoteStart) && !IsHit) { TailToNext.SetStartPos(Body.anchoredPosition3D, ProgressBy1, SizeInPixel * (140f / 100)); } if ((Mode.Equals(NoteInfo.SlideNoteStart) || Mode.Equals(NoteInfo.SlideNoteCheckpoint) && TailToNext != null)) { TailToNext.SetStartPos(Body.anchoredPosition3D, (Mode.Equals(NoteInfo.SlideNoteStart) && Game.Frame >= ReachFrame) ? 1 : ProgressBy1, SizeInPixel * (140f / 100), (Game.Frame - LastSlideReachFrame) / (Game.Dispensor.Notes[NextNoteID].ReachFrame - LastSlideReachFrame)); } if (TailsFromPrevious.Count > 0) { for (int i = 0; i < TailsFromPrevious.Count; i++) { if (TailsFromPrevious[i] != null) { TailsFromPrevious[i].SetEndPos(Body.anchoredPosition3D, CurrentFrame * Speed > 100 ? 1 : ProgressBy1, SizeInPixel * (140f / 100)); } } } } } }
void LateUpdate() // frame : 0 to 1 { for (int i = 0; i < 20; i++) { basePos[i] = new Vector3(((19 - i) * startPos.x + i * endPos.x) / 19, ((19 - i) * startPos.y + i * endPos.y) / 19, 0); float curFrame = ((19 - i) * startFrame + i * endFrame) / 19; float scaledFrame = (2 * curFrame) / (curFrame + 1); if (gameMode.Equals(GameMode.Starlight)) { float baseX = NotePath.GetStarlightX(headStart, pressX, curFrame); if (curProgress > 0f) { baseX += ((releaseX - pressX) * curProgress); } float goalX = NotePath.GetStarlightX(tailStart, releaseX, curFrame); joint[i] = new Vector3(baseX + (((goalX - baseX) / 19f) * i), NotePath.GetStarlightY(100 * curFrame), 1); } else if (gameMode.Equals(GameMode.Theater) || gameMode.Equals(GameMode.Theater4) || gameMode.Equals(GameMode.Theater2L) || gameMode.Equals(GameMode.Theater2P)) { float baseX = NotePath.GetTheaterX(headStart, pressX, curFrame); if (curProgress > 0f) { baseX += (releaseX - pressX) * curProgress; } float goalX = NotePath.GetTheaterX(headStart + (tailStart - headStart) * theaterProg, pressX + (releaseX - pressX) * theaterProg, curFrame); if (gameMode.Equals(GameMode.Theater2P)) { joint[i] = new Vector3(baseX + (((goalX - baseX) / 19f) * i), NotePath.GetTheaterPortY(100 * curFrame), 1); } else { joint[i] = new Vector3(baseX + (((goalX - baseX) / 19f) * i), NotePath.GetTheaterY(100 * curFrame), 1); } } else if (gameMode.Equals(GameMode.Platinum)) { //float baseX = NotePath.GetPlatinumX(headStart, 0, curFrame); //if (curProgress > 0f) { baseX += ((releaseX - pressX) * curProgress); } //float goalX = NotePath.GetPlatinumX(tailStart, 0, curFrame); joint[i] = new Vector3(startPos.x + (((endPos.x - startPos.x) / 19f) * i), startPos.y + (((endPos.y - startPos.y) / 19f) * i), 1); } } if (!isNoTilt) { Vector2 tilt = new Vector2(basePos[0].x - basePos[19].x, basePos[0].y - basePos[19].y); tilt.Normalize(); curCos = tilt.x; curSin = tilt.y; } for (int i = 0; i < 20; i++) { float curFrame = ((19 - i) * startFrame + i * endFrame) / 19; if (gameMode.Equals(GameMode.Starlight)) { float curScale = NotePath.GetStarlightScale(curFrame) * startScale; columns[2 * i] = new Vector3(joint[i].x - (curSin * curScale) / 3, joint[i].y + (curCos * curScale) / 3, joint[i].z); columns[2 * i + 1] = new Vector3(joint[i].x + (curSin * curScale) / 3, joint[i].y - (curCos * curScale) / 3, joint[i].z); } else if (gameMode.Equals(GameMode.Theater) || gameMode.Equals(GameMode.Theater4) || gameMode.Equals(GameMode.Theater2L) || gameMode.Equals(GameMode.Theater2P)) { float curDeltaSin = curSin, curDeltaCos = curCos; if (endFrame <= 0) { curDeltaSin = ((19 - i) * curSin + i * (-1)) / 19; curDeltaCos = (19 - i) * curCos / 19; } float curScale = NotePath.GetTheaterScale(curFrame) * startScale; columns[2 * i] = new Vector3(joint[i].x - (curDeltaSin * curScale) / 3, joint[i].y + (curDeltaCos * curScale) / 3, joint[i].z); columns[2 * i + 1] = new Vector3(joint[i].x + (curDeltaSin * curScale) / 3, joint[i].y - (curDeltaCos * curScale) / 3, joint[i].z); } else if (gameMode.Equals(GameMode.Platinum)) { columns[2 * i] = new Vector3(joint[i].x - (curSin * startScale) / 3, joint[i].y + (curCos * startScale) / 3, joint[i].z); columns[2 * i + 1] = new Vector3(joint[i].x + (curSin * startScale) / 3, joint[i].y - (curCos * startScale) / 3, joint[i].z); //if (i == 19) //{ // columns[2 * i] = new Vector3(joint[i].x - (curSin * startScale) / 6, joint[i].y + (curCos * startScale) / 6, joint[i].z); // columns[2 * i + 1] = new Vector3(joint[i].x + (curSin * startScale) / 6, joint[i].y - (curCos * startScale) / 6, joint[i].z); //} //else //{ // columns[2 * i] = new Vector3(joint[i].x - (curSin * startScale) / 3, joint[i].y + (curCos * startScale) / 3, joint[i].z); // columns[2 * i + 1] = new Vector3(joint[i].x + (curSin * startScale) / 3, joint[i].y - (curCos * startScale) / 3, joint[i].z); //} } uvs[2 * i] = new Vector2(0, (19 - i) / 19f); uvs[2 * i + 1] = new Vector2(1, (19 - i) / 19f); } filter.mesh.Clear(); filter.mesh.vertices = columns; filter.mesh.uv = uvs; filter.mesh.triangles = tris; }