Example #1
0
    private void MoveNote(GameObject note)
    {
        NoteData noteData = note.GetComponent <NoteComponent>().noteData;

        note.transform.localPosition = new Vector3
                                       (
            GetNoteXPos(noteData.line),
            GetNoteYPos(noteData.timing - TimeCalc.GetTiming(Time.time - WAITTIME, sheetM) + WAITTIMING),
            0
                                       );
    }
Example #2
0
    /// <summary>
    /// Stop time calc
    /// </summary>
    /// <param name="key">item key</param>
    private void StopCalc(string key)
    {
        if (!TimeCalc.ContainsKey(key))
        {
            Debug.LogError("key:" + key + " not exist.");
            return;
        }

        TimeCalc.GetTimeCalc(key).IsOverTime = true;
        TimeCalc.GetTimeCalc(key).StartTime  = -1;
    }
Example #3
0
    /// <summary>
    /// Start time calc
    /// </summary>
    /// <param name="key">item key</param>
    private void StartCalc(string key)
    {
        if (!TimeCalc.ContainsKey(key))
        {
            Debug.LogError("key:" + key + " not exist.");
            return;
        }

        TimeCalc.GetTimeCalc(key).IsOverTime = false;
        TimeCalc.GetTimeCalc(key).StartTime  = Time.realtimeSinceStartup;
    }
Example #4
0
    /// <summary>
    /// Remove time calc dictionary item.
    /// </summary>
    /// <param name="key">item key</param>
    /// <returns>is remove succeed</returns>
    public bool RemoveFromTimeCalc(string key)
    {
        StopCalc(key);

        if (!TimeCalc.ContainsKey(key))
        {
            Debug.LogError("Cannot remove key:" + key + " to time calc cause key not exist.");
            return(false);
        }

        TimeCalc.m_timeCalcList.Remove(TimeCalc.GetTimeCalc(key));
        return(true);
    }
Example #5
0
    public float GetCalcTime(string key)
    {
        if (!TimeCalc.ContainsKey(key))
        {
            Debug.LogError("key:" + key + " not exist.");
            return(-1);
        }

        if (TimeCalc.GetTimeCalc(key).StartTime < 0)
        {
            Debug.LogError("Time calc key:" + key + " stopped or never start.");
            return(-1);
        }

        return(Time.realtimeSinceStartup - TimeCalc.GetTimeCalc(key).StartTime);
    }
Example #6
0
    /// <summary>
    /// Is over time
    /// </summary>
    /// <param name="key">item key</param>
    /// <returns>is over</returns>
    public bool IsCalcTimeOver(string key)
    {
        if (!TimeCalc.ContainsKey(key))
        {
            Debug.LogError("key:" + key + " not exist.");
            return(false);
        }

        if (TimeCalc.GetTimeCalc(key).StartTime < 0)
        {
            Debug.LogError("Time calc key:" + key + " stopped or never start.");
            return(false);
        }

        return(TimeCalc.GetTimeCalc(key).IsOverTime);
    }
Example #7
0
    /// <summary>
    /// Add time calc dictionary item, delegate execute every frame.
    /// </summary>
    /// <param name="key">item key</param>
    /// <param name="duration">time over duration</param>
    /// <param name="l_timeCalcIntDelegate">delegate</param>
    /// <returns>is add succeed</returns>
    public bool AddFrameDelegateToTimeCalc(string key, float duration, DelegateHelper.FloatDelegate l_floatDelegate = null)
    {
        if (TimeCalc.ContainsKey(key))
        {
            Debug.LogError("Cannot add key:" + key + " to time calc cause key already exist.");
            return(false);
        }

        TimeCalc.m_timeCalcList.Add(new TimeCalc()
        {
            key = key, IsOverTime = true, StartTime = -1, OverTimeDuration = duration, m_TimeCalcFloatDelegate = l_floatDelegate, DelegateMode = 4
        });

        StartCalc(key);
        return(true);
    }
Example #8
0
    private void HandleLongNoteDown(int i)
    {
        float     time      = LongObjs[i].qObj.noteData.Time;
        Judgement judgement = JudgeGap(time - Time.time);

        if (judgement == Judgement.NONE)
        {
            return;
        }

        LongObjs[i].isInLongNote = true;


        LongNoteData longNoteData = LongObjs[i].qObj.noteData as LongNoteData;

        ApplyHealth(healthRecovers[(int)judgement]);
        uICon.JudgeEffect(judgeString[(int)judgement], time - Time.time);

        if (judgement <= Judgement.GREAT)
        {
            LongObjs[i].judgement = judgement;
        }
        else
        {
            LongObjs[i].judgement = Judgement.NICE;
        }

        LongObjs[i].endTime = time + TimeCalc.GetTime(longNoteData.lengthTiming, sheetM);
        for (double ti = longNoteData.timing + 0.25; ti < longNoteData.timing + longNoteData.lengthTiming; ti += 0.25)
        {
            LongObjs[i].tick.Enqueue(TimeCalc.GetTime(ti + WAITTIMING, sheetM) + WAITTIME);
        }


        if (judgement != Judgement.BAD)
        {
            IncreaseCombo();
        }
        else
        {
            ResetCombo();
        }
    }
Example #9
0
 public void SetTime(SheetManager sheetManager)
 {
     Time = TimeCalc.GetTime(timing + GameManager.WAITTIMING, sheetManager) + GameManager.WAITTIME;
 }
Example #10
0
 /// <summary>
 /// IsTimeCalcKeyExist
 /// </summary>
 /// <param name="key">item key</param>
 /// <returns>is key exist</returns>
 public bool IsTimeCalcKeyExist(string key)
 {
     return(TimeCalc.ContainsKey(key));
 }