Exemple #1
0
    public float ComputeRemainingCooldownDuration(Army army)
    {
        float num = 0f;

        if (army != null)
        {
            IGameService service = Services.GetService <IGameService>();
            if (service != null && service.Game != null)
            {
                ICooldownManagementService service2 = service.Game.Services.GetService <ICooldownManagementService>();
                if (service2 != null)
                {
                    foreach (Unit unit in army.Units)
                    {
                        Cooldown cooldown;
                        if (service2.TryGetCooldown(unit.GUID, out cooldown))
                        {
                            float num2 = (float)cooldown.TurnWhenStarted + cooldown.Duration - (float)(service.Game as global::Game).Turn;
                            if (num2 > num)
                            {
                                num = num2;
                            }
                        }
                    }
                }
            }
        }
        return(num);
    }
Exemple #2
0
 public static bool CheckCooldownPrerequisites(Army army)
 {
     if (army != null)
     {
         IGameService service = Services.GetService <IGameService>();
         if (service != null && service.Game != null)
         {
             ICooldownManagementService service2 = service.Game.Services.GetService <ICooldownManagementService>();
             if (service2 != null)
             {
                 foreach (Unit unit in army.Units)
                 {
                     Cooldown cooldown;
                     if (service2.TryGetCooldown(unit.GUID, out cooldown))
                     {
                         return(false);
                     }
                 }
                 return(true);
             }
         }
     }
     return(true);
 }