// Start is called before the first frame update void Start() { numCallers = refGroup.GetNumParticipants(); waitTimeMax = refGroup.GetWaitTimeMax(); waitTimeRemaining = refGroup.GetWaitTimeRemaining(); callTimeMax = refGroup.GetCallTimeMax(); callTimeRemaining = refGroup.GetCallTimeRemaining(); callerCountText.text = refGroup.GetNumParticipants().ToString(); callDuration.GetComponent <TextMeshProUGUI>().text = callTimeMax.ToString(); }
//Call this function when the group disconnects // public float CalculateCashForCall(Call_Group disGroup) { //Variable to store total of new cash to add to total float newCash = 0.0f; float patiencePenalty = 0.0f; //Calculates money based on how many people are in the call float perPersonCash = disGroup.GetNumParticipants() * cashPerPersonInCall; //Calculates the penalty for patience patienceLeft = disGroup.GetWaitTimeRemaining() / disGroup.GetWaitTimeMax(); if (patienceLeft >= 0.66) { patiencePenalty = 1.0f; } else { patiencePenalty = patienceLeft; } //This is only for if they didnt complete the call fully //Bonus for completing a call. Depending on the amount of time left in the call. Less time = more money , More time = less money timeMax = disGroup.GetCallTimeMax(); timeLeftPercent = disGroup.GetCallTimeRemaining() / timeMax; float timeLeftBonus = cashCallComplete * (1.0f - timeLeftPercent) * patiencePenalty; // Little off but not bad //Calculates Streak bonus float streakBonus = streakConst * streak; newCash = perPersonCash + timeLeftBonus + fullCallCompleteBonus + streakBonus; totalCash += newCash; //Adds the calls earned cash into the daily earning daysEarning += newCash; //--- Debugs to check cash values ---// //Debug.Log("Per Person " + perPersonCash); //Debug.Log("Patient Pen " + patiencePenalty); //Debug.Log("Tl bonus " + timeLeftBonus); //Debug.Log("Streak " + streakBonus); //Return the cash earned from the call return(newCash); }