Пример #1
0
 IEnumerator UpdatePosition()
 {
     while (true)
     {
         transform.position = CountersController.determinePosition(gameObject, settings.Position, settings.Index);
         yield return(new WaitForSeconds(10));
     }
 }
Пример #2
0
        void Update()
        {
            if (GameObject.Find("SongProgressPanel") != null && settings.Mode != ICounterMode.BaseGame)
            {
                Destroy(GameObject.Find("SongProgressPanel"));
            }
            if (CountersController.rng)
            {
                settings.Index    = UnityEngine.Random.Range(0, 5);
                settings.Position = (ICounterPositions)UnityEngine.Random.Range(0, 4);
            }
            else
            {
                if (CountersController.settings.RNG)
                {
                    transform.position = Vector3.Lerp(
                        transform.position,
                        CountersController.determinePosition(gameObject, settings.Position, settings.Index),
                        Time.deltaTime);
                }
                else
                {
                    transform.position = CountersController.determinePosition(gameObject, settings.Position, settings.Index);
                }
            }

            if (_audioTimeSync == false)
            {
                _audioTimeSync = Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().FirstOrDefault();
                return;
            }

            var time = 0f;

            if (useTimeLeft)
            {
                time = _audioTimeSync.songLength - _audioTimeSync.songTime;
            }
            else
            {
                time = _audioTimeSync.songTime;
            }

            if (time <= 0f)
            {
                return;
            }
            if (settings.Mode == ICounterMode.Original)
            {
                _timeMesh.text    = $"{Math.Floor(time / 60):N0}:{Math.Floor(time % 60):00}";
                _image.fillAmount = (useTimeLeft ? 1 : 0) - _audioTimeSync.songTime / _audioTimeSync.songLength * (useTimeLeft ? 1 : -1);
            }
            else if (settings.Mode == ICounterMode.Percent)
            {
                _timeMesh.text = $"{((useTimeLeft ? 1 : 0) - ((_audioTimeSync.songTime / _audioTimeSync.songLength) * 100) * (useTimeLeft ? 1 : -1)).ToString("00")}%";
            }
        }
Пример #3
0
 void Awake()
 {
     settings           = CountersController.settings.speedConfig;
     transform.position = CountersController.determinePosition(gameObject, settings.Position, settings.Index);
     StartCoroutine(GetRequired());
     for (var i = 0; i < settings.DecimalPrecision; i++)
     {
         precision += "0";
     }
 }
Пример #4
0
 void Awake()
 {
     settings           = CountersController.settings.noteConfig;
     transform.position = CountersController.determinePosition(gameObject, settings.Position, settings.Index);
     if (transform.parent == null)
     {
         StartCoroutine(GetRequired());
     }
     else
     {
         Init();
     }
 }
Пример #5
0
 void Awake()
 {
     settings           = CountersController.settings.progressConfig;
     transform.position = CountersController.determinePosition(gameObject, settings.Position, settings.Index);
     useTimeLeft        = settings.ProgressTimeLeft;
     if (settings.Mode == ICounterMode.BaseGame && gameObject.name != "SongProgressPanel")
     {
         StartCoroutine(YeetToBaseCounter());
     }
     else if (settings.Mode != ICounterMode.BaseGame)
     {
         StartCoroutine(WaitForLoad());
     }
 }
Пример #6
0
 void Update()
 {
     if (CountersController.rng)
     {
         settings.Index    = UnityEngine.Random.Range(0, 5);
         settings.Position = (ICounterPositions)UnityEngine.Random.Range(0, 4);
     }
     else
     {
         if (CountersController.settings.RNG)
         {
             transform.position = Vector3.Lerp(
                 transform.position,
                 CountersController.determinePosition(gameObject, settings.Position, settings.Index),
                 Time.deltaTime);
         }
         else
         {
             transform.position = CountersController.determinePosition(gameObject, settings.Position, settings.Index);
         }
     }
 }
Пример #7
0
 void Update()
 {
     if (CountersController.rng)
     {
         settings.Index            = UnityEngine.Random.Range(0, 5);
         settings.Position         = (ICounterPositions)UnityEngine.Random.Range(0, 4);
         settings.DecimalPrecision = UnityEngine.Random.Range(0, 5);
     }
     else
     {
         if (CountersController.settings.RNG)
         {
             transform.position = Vector3.Lerp(
                 transform.position,
                 CountersController.determinePosition(gameObject, settings.Position, settings.Index),
                 Time.deltaTime);
         }
         else
         {
             transform.position = CountersController.determinePosition(gameObject, settings.Position, settings.Index);
         }
     }
     if (settings.Mode == ICounterMode.Average)
     {
         rSpeedList.Add((this.right.bladeSpeed + this.left.bladeSpeed) / 2f);
         float average = 0;
         foreach (float speed in rSpeedList)
         {
             average += speed;
         }
         average         /= rSpeedList.Count;
         counterText.text = average.ToString(precision);
     }
     else if (settings.Mode == ICounterMode.SplitAverage)
     {
         rSpeedList.Add(right.bladeSpeed);
         float rAverage = 0;
         foreach (float speed in rSpeedList)
         {
             rAverage += speed;
         }
         rAverage /= rSpeedList.Count;
         lSpeedList.Add(left.bladeSpeed);
         float lAverage = 0;
         foreach (float speed in lSpeedList)
         {
             lAverage += speed;
         }
         lAverage        /= lSpeedList.Count;
         counterText.text = string.Format("{0} | {1}", lAverage.ToString(precision), rAverage.ToString(precision));
     }
     else if (settings.Mode == ICounterMode.Top5Sec)
     {
         fastest.Add((this.right.bladeSpeed + this.left.bladeSpeed) / 2f);
     }
     else
     {
         fastest.Add((this.right.bladeSpeed + this.left.bladeSpeed) / 2f);
         if (settings.Mode == ICounterMode.Both)
         {
             rSpeedList.Add((this.right.bladeSpeed + this.left.bladeSpeed) / 2f);
             float average = 0;
             foreach (float speed in rSpeedList)
             {
                 average += speed;
             }
             average         /= rSpeedList.Count;
             counterText.text = average.ToString(precision);
         }
         else if (settings.Mode == ICounterMode.SplitBoth)
         {
             rSpeedList.Add(right.bladeSpeed);
             float rAverage = 0;
             foreach (float speed in rSpeedList)
             {
                 rAverage += speed;
             }
             rAverage /= rSpeedList.Count;
             lSpeedList.Add(left.bladeSpeed);
             float lAverage = 0;
             foreach (float speed in lSpeedList)
             {
                 lAverage += speed;
             }
             lAverage        /= lSpeedList.Count;
             counterText.text = string.Format("{0} | {1}", lAverage.ToString(precision), rAverage.ToString(precision));
         }
     }
 }