private void RenderArcTaps(ArcArc arc)
        {
            int timing = ArcGameplayManager.Instance.Timing;
            ArcTimingManager timingManager = ArcTimingManager.Instance;
            int offset = ArcAudioManager.Instance.AudioOffset;

            foreach (ArcArcTap t in arc.ArcTaps)
            {
                if (!timingManager.ShouldTryRender(t.Timing + offset, t.TimingGroup) || t.Judged || t.GroupHide())
                {
                    t.Enable = false;
                    continue;
                }
                float pos = timingManager.CalculatePositionByTiming(t.Timing + offset, t.TimingGroup) / 1000f;
                if (pos > -100 && pos <= 90)
                {
                    t.Alpha  = 1;
                    t.Enable = true;
                }
                else if (pos > 90 && pos <= 100)
                {
                    t.Enable = true;
                    t.Alpha  = (100 - pos) / 10f;
                }
                else
                {
                    t.Enable = false;
                }
            }
        }
        private void RenderTapNotes()
        {
            ArcTimingManager timing = ArcTimingManager.Instance;
            int offset = ArcAudioManager.Instance.AudioOffset;

            foreach (var t in Taps)
            {
                if (!timing.ShouldTryRender(t.Timing + offset) || t.Judged)
                {
                    t.Enable = false;
                    continue;
                }
                t.Position = timing.CalculatePositionByTiming(t.Timing + offset);
                if (t.Position > 100000 || t.Position < -10000)
                {
                    t.Enable = false;
                    continue;
                }
                t.Enable = true;
                float pos = t.Position / 1000f;
                t.transform.localPosition = new Vector3(Lanes[t.Track - 1], pos, 0);
                if (ArcCameraManager.Instance.EditorCamera)
                {
                    t.transform.localScale = new Vector3(1.53f, 2, 1);
                }
                else
                {
                    t.transform.localScale = new Vector3(1.53f, 2f + 5.1f * pos / 100f, 1);
                }
                t.Alpha = pos < 90 ? 1 : (100 - pos) / 10f;
            }
        }
Exemple #3
0
        private void RenderHoldNotes()
        {
            ArcTimingManager timing = ArcTimingManager.Instance;
            int offset = ArcAudioManager.Instance.AudioOffset;

            foreach (var t in Holds)
            {
                int duration = t.EndTiming - t.Timing;
                if (!timing.ShouldTryRender(t.Timing + offset, duration + 120) || t.Judged)
                {
                    t.Enable = false;
                    continue;
                }
                t.Position = timing.CalculatePositionByTiming(t.Timing + offset);
                float endPosition = timing.CalculatePositionByTiming(t.EndTiming + offset);
                if (t.Position > 100000 || endPosition < -10000)
                {
                    t.Enable = false;
                    continue;
                }
                t.Enable = true;
                float pos    = t.Position / 1000f;
                float length = (endPosition - t.Position) / 1000f;
                t.transform.localPosition = new Vector3(Lanes[t.Track - 1], pos, 0);
                t.transform.localScale    = new Vector3(1.53f, length / 3.79f, 1);
                t.boxCollider.center      = new Vector3(0, t.boxCollider.size.y / 2);

                float alpha = 1;
                if (t.Judging)
                {
                    t.From       = Mathf.Clamp((-pos / length), 0, 1);
                    t.FlashCount = (t.FlashCount + 1) % 4;
                    if (t.FlashCount == 0)
                    {
                        alpha = 0.85f;
                    }
                    t.Highlight = true;
                }
                else
                {
                    t.From      = 0;
                    alpha       = pos < 0 ? 0.5f : 1;
                    t.Highlight = false;
                }
                t.Alpha = alpha * 0.8627451f;
                t.To    = Mathf.Clamp((100 - pos) / length, 0, 1);
            }
        }
        private void RenderArcs()
        {
            ArcTimingManager timingManager = ArcTimingManager.Instance;
            int currentTiming = ArcGameplayManager.Instance.Timing;
            int offset        = ArcAudioManager.Instance.AudioOffset;

            foreach (var t in Arcs)
            {
                RenderArcTaps(t);
                int duration = t.EndTiming - t.Timing;
                if (!timingManager.ShouldTryRender(t.Timing + offset, t.TimingGroup, duration) || t.Judged || t.GroupHide())
                {
                    t.Enable = false;
                    continue;
                }
                t.Position    = timingManager.CalculatePositionByTiming(t.Timing + offset, t.TimingGroup);
                t.EndPosition = timingManager.CalculatePositionByTiming(t.EndTiming + offset, t.TimingGroup);
                if (Mathf.Min(t.Position, t.EndPosition) > 100000 || Mathf.Max(t.Position, t.EndPosition) < -100000)
                {
                    t.Enable = false;
                    continue;
                }
                t.Enable = true;
                t.transform.localPosition = new Vector3(0, 0, -t.Position / 1000f);
                if (!t.IsVoid)
                {
                    t.arcRenderer.EnableEffect = currentTiming > t.Timing + offset && currentTiming <= t.EndTiming + offset && !t.IsVoid && t.Judging;
                    foreach (var a in t.ArcGroup)
                    {
                        if (!a.Flag)
                        {
                            a.Flag = true;
                            float alpha = 1;
                            if (a.Judging)
                            {
                                a.FlashCount = (a.FlashCount + 1) % 5;
                                if (a.FlashCount == 0)
                                {
                                    alpha = 0.85f;
                                }
                                a.arcRenderer.Highlight = true;
                            }
                            else
                            {
                                alpha = 0.65f;
                                a.arcRenderer.Highlight = false;
                            }
                            alpha *= 0.8823592f;
                            a.arcRenderer.Alpha = alpha;
                        }
                    }
                }
                else
                {
                    t.arcRenderer.EnableEffect = false;
                    t.arcRenderer.Highlight    = false;
                    t.arcRenderer.Alpha        = 0.318627f;
                }
                t.arcRenderer.UpdateArc();
            }
            foreach (var t in Arcs)
            {
                t.Flag = false;
            }
        }
        private void RenderHoldNotes()
        {
            ArcTimingManager timing = ArcTimingManager.Instance;
            int offset = ArcAudioManager.Instance.AudioOffset;

            foreach (var t in Holds)
            {
                int duration = t.EndTiming - t.Timing;
                if (!timing.ShouldTryRender(t.Timing + offset, t.TimingGroup, duration) || t.Judged || t.GroupHide())
                {
                    t.Enable = false;
                    continue;
                }
                t.Position = timing.CalculatePositionByTiming(t.Timing + offset, t.TimingGroup);
                float endPosition = timing.CalculatePositionByTiming(t.EndTiming + offset, t.TimingGroup);
                t.Enable = true;
                if (t.Judging)
                {
                    t.Position = 0;
                }
                if (endPosition < t.Position)
                {
                    var p = t.Position;
                    t.Position  = endPosition;
                    endPosition = p;
                }
                if (t.Position > 100000 || endPosition < -100000)
                {
                    t.Enable = false;
                    continue;
                }
                if (endPosition > 100000)
                {
                    endPosition = 100000;
                }
                if (t.Position < -100000)
                {
                    t.Position = -100000;
                }
                float pos    = t.Position / 1000f;
                float length = (endPosition - t.Position) / 1000f;
                t.transform.localPosition = new Vector3(Lanes[t.Track - 1], pos, 0);
                t.transform.localScale    = new Vector3(1.53f, length / 3.79f, 1);
                t.boxCollider.center      = new Vector3(0, t.boxCollider.size.y / 2);

                float alpha = 1;
                if (t.Judging)
                {
                    t.FlashCount = (t.FlashCount + 1) % 4;
                    if (t.FlashCount == 0)
                    {
                        alpha = 0.85f;
                    }
                    t.Highlight = true;
                }
                else
                {
                    alpha       = t.Timing + offset < ArcGameplayManager.Instance.Timing ? 0.5f : 1;
                    t.Highlight = false;
                }
                t.Alpha = alpha * 0.8627451f;
            }
        }