Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        Vector3 t = transform.position;

        t.x = ParamCalculator.VanillaPositionToUnityX(NoteData.Position + NoteData.Width / 2);
        t.y = ParamCalculator.TimeToPositionY(NoteData.Time);

        if (NoteData.Direction == -1)
        {
            Vector3 pos = t;
            pos.x = t.y + 2f - 4.25f;
            pos.y = t.x * 9f / 16f * 0.8f;
            transform.localRotation = Quaternion.Euler(0f, 0f, -90f);
            transform.position      = pos;
        }
        else if (NoteData.Direction == 1)
        {
            Vector3 pos = t;
            pos.x = -t.y - 2f + 4.255f;
            pos.y = t.x * 9f / 16f * 0.8f;
            transform.localRotation = Quaternion.Euler(0f, 0f, 90f);
            transform.position      = pos;
        }
        else
        {
            transform.position      = t;
            transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
        }
    }
Ejemplo n.º 2
0
    void UpdateHorizons()
    {
        if (Mathf.Abs(GridDir) > 1)
        {
            foreach (var line in GridLines)
            {
                line.Time = int.MinValue;
                line.Transform.position = new Vector3(-100, -100, -1);
            }
            return;
        }
        double STEP    = (ParamCalculator.BarToTime(1000f) - ParamCalculator.BarToTime(0f)) * BeatPerRow / 4000f;
        double MAXTIME = (int)((TimeControlSystem.CurrentTimeMillis + 1000) / STEP) * STEP;
        double MINTIME = (int)((TimeControlSystem.CurrentTimeMillis - 700) / STEP) * STEP;
        IEnumerator <TimeTransformPair> horis;

        int c = 0;

        for (double i = MINTIME; i < MAXTIME; i += STEP)
        {
            c++;
        }
        for (int i = GridLines.Count; i < c; i++)
        {
            Transform n = Instantiate(Resources.Load <GameObject> ("UI/GridLineHorizon"), transform).transform;
            GridLines.Add(new TimeTransformPair(0, n));
        }

        horis = GridLines.GetEnumerator();
        for (double i = MINTIME; i < MAXTIME; i += STEP)
        {
            if (!horis.MoveNext())
            {
                continue;
            }
            horis.Current.Time = (int)i;
            horis.Current.Transform.position = new Vector3(0, ParamCalculator.TimeToPositionY((int)i), -1);
            horis.Current.Transform.rotation = Quaternion.Euler(0, 0, 0);
            horis.Current.Transform.GetComponent <LineRenderer> ().startColor = DirColors [GridDir + 1];
            horis.Current.Transform.GetComponent <LineRenderer> ().endColor   = DirColors [GridDir + 1];
            if (GridDir != 0)
            {
                horis.Current.Transform.rotation = Quaternion.Euler(0, 0, 90);
                Vector3 v   = horis.Current.Transform.position;
                Vector3 pos = horis.Current.Transform.position;
                pos.x  = -v.y - 2f + 4.25f;
                pos.x *= GridDir;
                pos.y  = 0;
                horis.Current.Transform.position = pos;
            }
        }
        while (horis.MoveNext())
        {
            horis.Current.Time = int.MinValue;
            horis.Current.Transform.position = new Vector3(-100, -100, -1);
        }
    }