Ejemplo n.º 1
0
 private IEnumerator fix(float fixerSkill)
 {
     _fixTime = 0f;
     fixBarController.initBar();
     while (_fixTime < _timeToSucess)
     {
         _fixTime += Time.deltaTime * fixerSkill;
         fixBarController.updateBar(Mathf.Clamp(_fixTime / _timeToSucess, 0f, 1f));
         yield return(new WaitForEndOfFrame());
     }
     eventSuccess?.Invoke(_name, transform.position, _id);
     StopAllCoroutines();
     Invoke("destroy", 1);
 }
Ejemplo n.º 2
0
    private IEnumerator timer()
    {
        float totalTime = 0f;

        while (totalTime < _timeToFail / _hardness)
        {
            totalTime += Time.deltaTime;
            failBarController.updateBar(1 - Mathf.Clamp(totalTime / _timeToFail, 0f, 1f));
            yield return(new WaitForEndOfFrame());
        }

        if (_fixTime < _timeToSucess)
        {
            eventFail?.Invoke(_name, transform.position, _id);
            StopAllCoroutines();
        }
        Invoke("destroy", 1);;
    }