Esempio n. 1
0
        public void HandleCooldown(Dictionary <string, object> props)
        {
            Cooldown old = GetCooldown((string)props["CdType"], false);

            if (old != null)
            {
                cooldowns.Remove(old);
            }
            Cooldown cooldown = new Cooldown();

            cooldown.name       = (string)props["CdType"];
            cooldown.length     = (long)props["CdLength"] / 1000f;
            cooldown.expiration = Time.time + cooldown.length;
            cooldowns.Add(cooldown);
            string[] args = new string[1];
            AtavismEventSystem.DispatchEvent("COOLDOWN_UPDATE", args);
            //ClientAPI.Write("Got cooldown: " + cooldown.name + " with length: " + cooldown.length);
        }
Esempio n. 2
0
        public override bool Activate()
        {
            // TODO: Enhance the target/self setting based on whether the current
            // target is friendly or an enemy
            Cooldown _cooldown = GetLongestActiveCooldown();

            if (_cooldown != null)
            {
                if (_cooldown.expiration > Time.time)
                {
                    return(false);
                }
            }
            if (ClientAPI.GetTargetObject() != null && targetType != TargetType.Self)
            {
                //  if (Vector3.Distance(ClientAPI.GetTargetObject().GameObject.transform.position, ClientAPI.GetPlayerObject().GameObject.transform.position) < distance)
                if (castTime > 0 && !castingInRun)
                {
                    StartCoroutine(ActivateWait());
                }
                else
                {
                    NetworkAPI.SendTargetedCommand(ClientAPI.GetTargetOid(), "/ability " + id);
                }
            }
            else
            {
                if (castTime > 0 && !castingInRun)
                {
                    StartCoroutine(ActivateWait());
                }
                else
                {
                    NetworkAPI.SendTargetedCommand(ClientAPI.GetPlayerOid(), "/ability " + id);
                }
            }
            return(true);
        }