Beispiel #1
0
        public int GetNextActionTime(ActionControlType actionType)
        {
            if (actions.ContainsKey((int)actionType))
            {
                return (int)(DateTime.Now - actions[(int)actionType]).TotalMilliseconds;
            }

            return 0;
        }
Beispiel #2
0
        public bool CanPerformAction(ActionControlType actionType)
        {
            int timeInterval = GetInterval(actionType);

            if (actions.ContainsKey((int)actionType))
            {
                if ((DateTime.Now - actions[(int)actionType]).TotalMilliseconds < timeInterval)
                {
                    return false;
                }
            }

            return true;
        }
Beispiel #3
0
 public static int GetInterval(ActionControlType actionType)
 {
     switch (actionType)
     {
         //TODO: Verificar os valores exatos.
         case ActionControlType.USE_ATTACK_SPELL: return 2000;
         case ActionControlType.USE_HEAL_POTION: return 1000;
         case ActionControlType.USE_HEAL_SPELL: return 1000;
         case ActionControlType.USE_MANA_POTION: return 1000;
         case ActionControlType.USE_SUPORT_SPELL: return 1000;
         case ActionControlType.LOGIN: return 10000;
         default: return 0;
     }
 }
Beispiel #4
0
 public void ActionPerformed(ActionControlType actionType)
 {
     actions[(int)actionType] = DateTime.Now;
 }