Exemplo n.º 1
0
        IEnumerator DelayedDestroy(NoteBase n, GameObject go)
        {
            var rigid = go.AddComponent <Rigidbody>();

            if (n.Type == NoteType.Puck)
            {
                rigid.useGravity = false;
            }
            var re = go.GetComponentInChildren <LongNoteMeshModifier>();

            if (re != null)
            {
                Destroy(re.gameObject);
            }

            // ドリブルの場合は最後のものだけ飛ばす
            if (n.Type != NoteType.Dribble || (n as Dribble).IsLastNote)
            {
                rigid.AddForce(Vector3.forward * 1000);
                if (n.Type == NoteType.Knock)
                {
                    rigid.AddForce(Vector3.up * 50);
                }
                else if (n.Type == NoteType.Kick)
                {
                    rigid.AddForce(Vector3.up * 200);
                }
                else if (n.Type != NoteType.Puck)
                {
                    rigid.AddForce(Vector3.up * 500);
                }
                rigid.AddForce((n.Lane < 2 ? Vector3.left : Vector3.right) * 250);
                yield return(new WaitUntil(() => go.transform.position.z > 20 || go.transform.position.y < -50));
            }
            Destroy(go);
        }
Exemplo n.º 2
0
        bool Judge(NoteBase note, Transform tf, float judgePhase)
        {
            var touch     = TouchProvider.Instance;
            var info      = touch.PressCheck(note.Lane);
            var processed = false;

            switch (note.Type)
            {
            case NoteType.Kick:
                if (info == PressInfo.Tap)
                {
                    ScoreSubmit(Calculate(judgePhase));

                    processed = true;

                    // SFX
                    if (!noteFlag.HasFlag(NoteFlag.Kick))
                    {
                        NotesFX.Instance.Kick();
                    }

                    noteFlag |= NoteFlag.Kick;
                }

                break;

            case NoteType.Dribble:
                var d = (Dribble)note;

                if (d.IsFirstNote)
                {
                    if (info == PressInfo.Tap)
                    {
                        ScoreSubmit(Calculate(judgePhase));
                        NotesFX.Instance.DribbleStart();
                    }
                    processed = true;
                }

                if (info != PressInfo.None && judgePhase <= 0)
                {
                    ScoreSubmit(JudgeState.Great);
                    processed = true;
                    if (d.IsLastNote)
                    {
                        NotesFX.Instance.DribbleStop();
                    }
                    if (!noteFlag.HasFlag(NoteFlag.Dribble))
                    {
                        NotesFX.Instance.Dribble();
                    }

                    noteFlag |= NoteFlag.Dribble;
                }

                break;

            case NoteType.Knock:
                if (info == PressInfo.Slide)
                {
                    processed = true;
                    ScoreSubmit(JudgeState.Great);
                    if (!noteFlag.HasFlag(NoteFlag.Knock))
                    {
                        NotesFX.Instance.Knock();
                    }

                    noteFlag |= NoteFlag.Knock;
                }
                else if (info == PressInfo.Tap && judgePhase < -judgeThreshold * 0.5f)
                {
                    ScoreSubmit(JudgeState.Ok);
                    if (!noteFlag.HasFlag(NoteFlag.Knock))
                    {
                        NotesFX.Instance.Knock();
                    }

                    noteFlag |= NoteFlag.Knock;
                }

                break;

            case NoteType.Volley:
                var v = (Volley)note;

                if (info == PressInfo.Tap)
                {
                    processed = true;
                    ScoreSubmit(Calculate(judgePhase));
                    if (v.IsFirstNote && !noteFlag.HasFlag(NoteFlag.Receive))
                    {
                        NotesFX.Instance.Receive();
                        noteFlag |= NoteFlag.Receive;
                    }
                    else if (v.IsLastNote && !noteFlag.HasFlag(NoteFlag.Spike))
                    {
                        NotesFX.Instance.Spike();
                        noteFlag |= NoteFlag.Spike;
                    }
                    else if (!noteFlag.HasFlag(NoteFlag.Toss))
                    {
                        NotesFX.Instance.Toss();
                        noteFlag |= NoteFlag.Toss;
                    }
                }
                break;

            case NoteType.Puck:
                if (info != PressInfo.None && judgePhase <= 0)
                {
                    ScoreSubmit(JudgeState.Great);
                    processed = true;
                    if (!noteFlag.HasFlag(NoteFlag.Puck))
                    {
                        NotesFX.Instance.Puck();
                    }

                    noteFlag |= NoteFlag.Puck;
                }
                break;

            case NoteType.Rotate:
                //todo 回転
                break;

            case NoteType.Vibrate:
                //todo 振動
                break;
            }
            if (processed)
            {
                StartCoroutine(DelayedDestroy(note, notesDic[note].gameObject));
                notesDic.Remove(note);
            }
            return(processed);
        }