Пример #1
0
    private void FixedUpdate()
    {
        CheckLowVelocity();

        if (_iscatch)
        {
            LeftHand.Catch();
            RightHand.Catch();
        }
        else
        {
            LeftHand.UnCatch();
            RightHand.UnCatch();
        }

        if (delayUntilRecoveryStartsCounter > 0f)
        {
            delayUntilRecoveryStartsCounter -= Time.fixedDeltaTime;
        }

        if (LeftHand.catched || RightHand.catched)
        {
            if (LeftHand.catched && RightHand.catched)
            {
                stamina -= Time.fixedDeltaTime * HoverSpeed;
            }
            else
            {
                stamina -= 2f * Time.fixedDeltaTime * HoverSpeed;
            }
            if (stamina < 0f)
            {
                stamina = 0f;
                delayUntilRecoveryStartsCounter = DelayUntilRecoveryStarts;
            }
        }
        else
        {
            if (delayUntilRecoveryStartsCounter <= 0f)
            {
                if (stamina < 1f)
                {
                    stamina += Time.fixedDeltaTime * RecoverySpeed;
                    if (stamina > 1f)
                    {
                        stamina = 1f;
                    }
                }
            }
        }
    }
Пример #2
0
    private void FixedUpdate()
    {
        CheckLowVelocity();

        if (_iscatch)
        {
            LeftHand.Catch();
            RightHand.Catch();
        }
        else
        {
            LeftHand.UnCatch();
            RightHand.UnCatch();
        }
    }
Пример #3
0
    private void FixedUpdate()
    {
        CheckLowVelocity();

        if (_iscatch)
        {
            LeftHand.Catch();
            RightHand.Catch();
        }
        else
        {
            LeftHand.UnCatch();
            RightHand.UnCatch();
        }
        if (LeftHand.catched || RightHand.catched)
        {
            if (LeftHand.catched && RightHand.catched)
            {
                stamina -= Time.fixedDeltaTime / hover_time;
            }
            else
            {
                stamina -= 2 * Time.fixedDeltaTime / hover_time;
            }
            if (stamina < 0)
            {
                stamina = 0f;
            }
        }
        else
        {
            stamina += Time.fixedDeltaTime / recovery_time;
            if (stamina > 1)
            {
                stamina = 1f;
            }
        }
    }