Ejemplo n.º 1
0
        private void GetAttackTypeFromText(Action action, List <string> errors)
        {
            var text = action.Text.ToLower();
            var t    = Enum.GetValues(typeof(AttackType));

            AttackType[] types = new AttackType[t.Length];
            t.CopyTo(types, 0);
            t = types.Reverse().ToArray();
            foreach (AttackType type in t)
            {
                if (text.Contains(type.ToString().Replace("_", " ").ToLower()))
                {
                    action.Attack = new Attack
                    {
                        Type = type
                    };
                    return;
                }
            }
            errors.Add("Unable to find AttackType in " + action.Text);
        }