public void Run_State(Teamstate curState) { switch (curState) { case Teamstate.WORKING: SpriteObject.GetComponent <SpriteAnimator> ().enabled = true; Patience_Multiplier = patienceBaseDecrease * 0.05f; break; case Teamstate.GAMING: SpriteObject.GetComponent <SpriteAnimator> ().enabled = true; Patience_Multiplier = patienceBaseDecrease * 0.1f; break; case Teamstate.UPLOADING: SpriteObject.GetComponent <SpriteAnimator> ().enabled = true; Patience_Multiplier = patienceBaseDecrease * 0.2f; break; case Teamstate.WATCHING: SpriteObject.GetComponent <SpriteAnimator> ().enabled = false; Patience_Multiplier = patienceBaseDecrease * 0.2f; break; } // Debug.Log (this.name + " is currently: " + curState); //Isnert IfStatement(PowerFailure) //{ //} //else //{ if (!MediatorScript.gameStarted || MediatorScript.usingHelp) { return; } if (MediatorScript.powerFailure) { //decrease by constant value Patience_Value -= 0.1f; return; } Be_Impatient(); IncreasePatience(); }
IEnumerator ChangingStates() { yield return(new WaitForEndOfFrame()); yield return(new WaitUntil(() => MediatorScript.gameStarted)); while (!MediatorScript.gameOver) { yield return(new WaitForEndOfFrame()); // Debug.Log (this.name + ": " + CurrentState.ToString ()); int rand = Random.Range(0, MAX_INDEX); if (MediatorScript.StatesChange_Counter >= 9) { MAX_INDEX = 1; } else { if (MediatorScript.timeLeft > 165) { MAX_INDEX = 2; } else if (MediatorScript.timeLeft < 165) { MAX_INDEX = 4; } if (rand == 3 && MediatorScript.WatchingStates > 0) { rand = Random.Range(0, 3); } else if (rand == 3 && MediatorScript.WatchingStates <= 0) { MediatorScript.LimitState(); } } // Debug.Log ("Chosen Random: " + rand); yield return(new WaitUntil(() => !MediatorScript.usingHelp)); foreach (Teamstate t in System.Enum.GetValues(typeof(Teamstate))) { if (rand == (int)t) { CurrentState = t; } } yield return(new WaitForSeconds(StateChangeTime)); if (MediatorScript.StatesChange_Counter < 9) { MediatorScript.StatesChange_Counter++; } else if (MediatorScript.StatesChange_Counter >= 9) { MediatorScript.StatesChange_Counter = 0; } Debug.Log(MediatorScript.StatesChange_Counter); ShowChangeState(); MediatorScript.ResetStates(); } }