Пример #1
0
    private void OnTriggerStay(Collider other)
    {
        if (other.CompareTag(playerTag))
        {
            timeToScore -= Time.deltaTime;

            if (timeToScore <= 0)
            {
                timeToScore = scoreDelay;
                var removedItem = inventory.RemoveRandomItem();
                if (removedItem != null)
                {
                    score.AddScore(removedItem.Points);
                    removedItem.Event_Destroy();
                }
                stamina.Replenish(staminaReplenishRate);
            }
        }
    }
Пример #2
0
    private void Update()
    {
        bool inputEat  = Input.GetAxis("Consume") > 0;
        bool shouldEat = inputEat && AttemptEat();

        if (shouldEat)
        {
            eating = true;
            if (stamina != null)
            {
                stamina.Replenish(staminaReplenish);
            }
        }

        if (!inputEat)
        {
            eating = false;
        }
    }
Пример #3
0
    private void Update()
    {
        UpdateTimers();

        bool shouldBoost = Input.GetAxis("Boost") > 0 && AttemptBoost();

        if (shouldBoost)
        {
            boosting = true;
            if (sprint != null)
            {
                sprint.PreventSprinting = true;
            }
            mover.SetMoveStats(boostStats);
            boostRemaining = boostDuration;
            if (stamina != null)
            {
                stamina.Replenish(1);
            }
        }
    }