Example #1
0
 public void Tick(float deltaTime)
 {
     if (_gainTimer == null)
     {
         return;
     }
     _gainTimer.Tick(deltaTime);
 }
Example #2
0
 public void Tick(float deltaTime)
 {
     if (m_GainTimer == null)
     {
         return;
     }
     m_GainTimer.Tick(Time.deltaTime);
 }
    protected virtual void FixedUpdate()
    {
        m_SpawnDelayTimer?.Tick(Time.fixedDeltaTime);
        m_SpawnBarTimer?.Tick(Time.fixedDeltaTime);
        for (int i = m_ActiveBars.Count - 1; i >= 0; i--)
        {
            var bar = m_ActiveBars[i];
            bar.transform.position += m_Velocity * Time.fixedDeltaTime;

            if (bar.transform.position.z < -m_TrackLength)
            {
                Destroy(bar);
            }
        }
    }
Example #4
0
    protected void Update()
    {
        if (PauseMenu.isOn)
        {
            return;
        }
        m_ComboTimer?.Tick(Time.deltaTime);
        // Keyboard and mouse input
#if UNITY_EDITOR
        if ((Input.GetMouseButtonDown(0) && IsMouseOnTrack) || Input.GetKeyDown(key))
        {
            HitNote();
        }

        if ((Input.GetMouseButton(0) && IsMouseOnTrack) || Input.GetKey(key))
        {
            GetComponent <Renderer>().material = selected;
            HoldNote();
        }
        else
        {
            GetComponent <Renderer>().material = original;
            ReleaseNote();
            if (!longEffect.isStopped)
            {
                longEffect.Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear);
            }
        }
#elif UNITY_IOS || UNITY_ANDROID
        // Touch input
        bool isAnyTouchOnTrack = false;
        for (int i = 0; i < Input.touchCount; ++i)
        {
            if (!IsTouchOnTrack(Input.GetTouch(i)))
            {
                continue;
            }
            isAnyTouchOnTrack = true;
            // Pressed on this frame
            if (Input.GetTouch(i).phase == TouchPhase.Began)
            {
                HitNote();
                break;
            }
        }

        if (isAnyTouchOnTrack)
        {
            GetComponent <Renderer>().material = selected;
            HoldNote();
        }
        else
        {
            GetComponent <Renderer>().material = original;
            ReleaseNote();
            if (!longEffect.isStopped)
            {
                longEffect.Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear);
            }
        }
#endif
    }