Good morning.
For some reason, a set of integers I have are not multiplying at all. Regardless of whatever I do, the value in the inspector always remains 0, and the values that are lower in the hierarchy of the calculation remain 0 as well. It’s a very simple code and I don’t understand why it’s not working.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class StaminaCalculator : MonoBehaviour
{
PlayerCharacterStats playerCharacterStats;
private int Endurance;
//Timer\\
protected float Timer;
private int delayAmount = 1;
//Stamina\\
public int enduranceMultiplierValue = 4;
public int enduranceMultiplier;
private int staminaBaseAmount = 10;
private int maxStamina;
private int staminaRegneration;
public bool staminaFull;
public int staminaPool;
void Awake(){
playerCharacterStats = gameObject.GetComponent<PlayerCharacterStats>();
}
void start(){
}
void update(){
Timer += Time.deltaTime;
Endurance = playerCharacterStats.Endurance;
//Stamina Management & Generation\\
enduranceMultiplier = (enduranceMultiplierValue * Endurance);
maxStamina = staminaBaseAmount + enduranceMultiplier;
staminaPool = maxStamina;
if (staminaPool == maxStamina){
staminaFull = true;
}
while (staminaFull == false){
if(Timer >= delayAmount){
Timer = 0;
staminaPool++;
}
}
}
}
The line that’s not calculating properly is enduranceMultiplier = (enduranceMultiplierValue * Endurance);