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); } } }
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; } }
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); } } }