Exemplo n.º 1
0
        /// <summary>
        /// Возвращает случайное решение из типизированного набора решений, если таковые имеются.
        /// </summary>
        public static GameEventDecision GetRandom(this GameEventDecision[] gameEventDecisions, GameEventDecisionType decisionType)
        {
            var typedDecisions = gameEventDecisions.Where(el => el.DecisionType == decisionType).ToArray();

            if (typedDecisions.Length == 0)
            {
                throw new RapWayException($"Нет ни одного решения типа \"{decisionType}\"");
            }

            return(typedDecisions[Random.Range(0, typedDecisions.Length)]);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Возвращает случайные данные решения по типу
 /// </summary>
 public GameEventDecision GetRandomDecision(GameEventDecisionType decisionType)
 => gameEventDecisions.GetRandom(decisionType);
Exemplo n.º 3
0
 /// <summary>
 /// Выбирает решение определенного типа и отображает его на странице "eventDecisionPage"
 /// </summary>
 private void Decide(GameEventDecisionType type)
 {
     eventDecisionPage.Show(_eventInfo.GetRandomDecision(type));
     Close();
 }