Example #1
0
 /// <summary>
 /// Method for cast hero ability
 /// </summary>
 /// <param name="abilityController"></param>
 private static void CastAllAbility(AbilityController abilityController)
 {
     Console.WriteLine();
     Console.WriteLine($"Cast all ability from {abilityController.GetType().Name} class :");
     MethodInfo[] methodInfo = abilityController.GetType().GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance);
     foreach (var info in methodInfo)
     {
         info.Invoke(abilityController, null);
     }
 }
Example #2
0
        /// <summary>
        /// Method for show hero ability data
        /// </summary>
        /// <param name="abilityController"></param>
        private static void ShowAbilityData(AbilityController abilityController)
        {
            Console.WriteLine($"List ability data from {abilityController.GetType().Name} class :");

            FieldInfo[] fieldInfo = abilityController.GetType().GetFields(BindingFlags.NonPublic | BindingFlags.Instance);
            foreach (var info in fieldInfo)
            {
                if (info.GetCustomAttribute <IgnoreAttribute>() is null)
                {
                    Console.WriteLine($"{info.Name} ability value is {info.GetValue(abilityController)}.");
                }
                else
                {
                    Console.WriteLine($"Can't show {info.Name} value because the Range field has Ignore costume attribute.");
                }
            }
        }