/// <summary> /// Universal transition probability checking function /// <param name="nChanceFactor">Equal to one tenth of the persentage.</param> /// <param name="state">State trying to transition to.</param> /// <param name="fExtraChanceFactor">Extra chance if any (1.0f by default).</param> /// </summary> public bool Transition(float nChanceFactor, EMState state, float fExtraChanceFactor) { float nChance = 0f; if (nChanceFactor * fExtraChanceFactor <= 10f) { m_EMFSM.ChangeState(state); return(true); } else { nChance = Random.Range(0f, nChanceFactor); if (nChance <= 1f) { m_EMFSM.ChangeState(state); } return(true); } return(false); }