Exemple #1
0
 public void CastSpell(DevSpell spell)
 {
     Anim.SetInteger("PrimaryAbility", Content.Instance.GetAbilityIndex(Info.CurrentPrimaryAbility.Key));
     Anim.SetInteger("SpellNumber", Content.Instance.GetSpellIndex(spell));
     Anim.SetTrigger("CastSpell");
     Anim.SetBool("Busy", true);
 }
Exemple #2
0
    public void ExecuteMovementSpell(DevSpell spell)
    {
        if (MovementSpellRoutineInstance != null)
        {
            StopCoroutine(MovementSpellRoutineInstance);
        }

        MovementSpellRoutineInstance = StartCoroutine("MovementRoutine_" + spell.Key);
    }
Exemple #3
0
    public void InturruptAttack()
    {
        EndAttack();
        Instance.SetAttackAnimation();
        Anim.SetTrigger("InturruptAttack");

        Instance.InturruptAttack();

        CurrentSpellInCast = null;
    }
Exemple #4
0
    public bool AttemptUseSpell(DevSpell spell)
    {
        bool canUseSpell = CanUseSpell(spell);

        if (!canUseSpell)
        {
            WarnAboutCooldown();
        }
        return(canUseSpell);
    }
Exemple #5
0
    internal void ColliderHitPlayers(List <ActorInstance> sentTargets, string actionKey, string actionValue, uint attackIdCounter)
    {
        List <string> targetIDs = new List <string>();

        DevAbility tempAbility = Content.Instance.GetAbility(LocalUserInfo.Me.ClientCharacter.CurrentPrimaryAbility.Key);

        for (int i = 0; i < sentTargets.Count; i++)
        {
            if (sentTargets[i].Info.ID != LocalUserInfo.Me.ClientCharacter.ID)
            {
                targetIDs.Add(sentTargets[i].Info.Name);
            }
        }


        if (actionKey == "spell")
        {
            SocketClient.Instance.SendHitSpell(targetIDs, attackIdCounter);

            GameObject tempHit;
            tempHit = ResourcesLoader.Instance.GetRecycledObject(tempAbility.HitEffect);
            tempHit.transform.position = Instance.Weapon.transform.position;
            tempHit.GetComponent <HitEffect>().Play();

            DevSpell tempSpell = Content.Instance.GetPlayerSpell(actionValue);
            if (!string.IsNullOrEmpty(tempSpell.HitSound))
            {
                AudioControl.Instance.PlayInPosition(tempSpell.HitSound, tempHit.transform.position);
            }
        }
        else
        {
            if (ActorAttack.InSecondaryMode)
            {
                SocketClient.Instance.SendHitSecondaryMode(targetIDs);
            }
            else
            {
                SocketClient.Instance.SendUsedPrimaryAbility(targetIDs, attackIdCounter);
            }

            string randomHitSound = tempAbility.HitSounds[Random.Range(0, tempAbility.HitSounds.Count)];
            AudioControl.Instance.PlayInPosition(randomHitSound, transform.position);

            GameObject tempHit;
            tempHit = ResourcesLoader.Instance.GetRecycledObject(tempAbility.HitEffect);
            tempHit.transform.position = Instance.Weapon.transform.position;
            tempHit.GetComponent <HitEffect>().Play();
        }
    }
Exemple #6
0
    public void Set(DevSpell spell, bool locked)
    {
        if (locked)
        {
            Lock();
        }
        else
        {
            Unlock();
        }

        CurrentSpell = spell;
        Refresh();
    }
Exemple #7
0
    public int GetSpellIndex(DevSpell spell)
    {
        for (int i = 0; i < Abilities.Count; i++)
        {
            for (int a = 0; a < Abilities[i].Spells.Count; a++)
            {
                if (Abilities[i].Spells[a] == spell)
                {
                    return(a);
                }
            }
        }

        return(0);
    }
Exemple #8
0
    public SpellBoxUI GetSpellBox(DevSpell Sepll)
    {
        SpellBoxUI tempBox;

        for (int i = 0; i < SpellContainer.childCount; i++)
        {
            tempBox = SpellContainer.GetChild(i).GetComponent <SpellBoxUI>();

            if (tempBox != null && tempBox.CurrentSpell == Sepll)
            {
                return(tempBox);
            }
        }

        return(null);
    }
Exemple #9
0
    public void CastSpellComplete(bool isPlayer)
    {
        if (CurrentSpellInCast != null)
        {
            switch (CurrentSpellInCast.spellTypeEnumState)
            {
            case SpellTypeEnumState.normal:
            {
                GameObject damageZone = ResourcesLoader.Instance.GetRecycledObject(CurrentSpellInCast.ColliderPrefab);

                damageZone.transform.position = Instance.transform.position;
                damageZone.transform.rotation = Instance.LastFireRot;

                damageZone.GetComponent <ActorDamageInstance>().SetInfo(Instance, "spell", CurrentSpellInCast.Key, CurrentSpellAttackId, isPlayer);
                break;
            }

            case SpellTypeEnumState.projectile:
            {
                GameObject damageZone = ResourcesLoader.Instance.GetRecycledObject(CurrentSpellInCast.ColliderPrefab);

                damageZone.transform.position = Instance.transform.position;
                damageZone.transform.rotation = Instance.LastFireRot;


                damageZone.GetComponent <ProjectileArrow>().SetInfo(Instance, "spell", CurrentSpellInCast.Key, (LocalUserInfo.Me.ClientCharacter.ID == Instance.Info.ID), CurrentSpellAttackId, 1f, 15f, isPlayer);
                break;
            }

            case SpellTypeEnumState.explosion:
            {
                GameObject damageZone = ResourcesLoader.Instance.GetRecycledObject(CurrentSpellInCast.ColliderPrefab);

                damageZone.transform.position = Instance.transform.position;
                damageZone.transform.rotation = Instance.LastFireRot;


                damageZone.GetComponent <ProjectileArrowExplosive>().SetInfo(Instance, "spell", CurrentSpellInCast.Key, (LocalUserInfo.Me.ClientCharacter.ID == Instance.Info.ID), CurrentSpellAttackId, 1f, 15f, isPlayer);
                break;
            }
            }
            CurrentSpellInCast = null;
        }
    }
Exemple #10
0
    public void EndAttack()
    {
        ActorAttack.EnsureStopSecondaryMode();
        Instance.StartCombatMode();
        Instance.BackwardLeftHand();
        Instance.ForwardWeapon();
        CurrentSpellInCast = null;

        if (LoadAttackValueInstance != null)
        {
            StopCoroutine(LoadAttackValueInstance);
            LoadAttackValueInstance = null;
        }
        LoadAttackValue = 0f;

        Anim.SetBool("Attacking", false);
        Anim.SetBool("Charging", false);
        InGameMainMenuUI.Instance.StopChargingAttack();
    }
Exemple #11
0
    private void CastSpell(int spellIndex)
    {
        Aim();
        StopAim();
        ActorAttack.EnsureStopSecondaryMode();
        DevSpell spell = Content.Instance.GetSpellAtIndex(spellIndex);

        if (spell == null)
        {
            return;
        }

        if (LocalUserInfo.Me.ClientCharacter.CurrentPrimaryAbility.LVL < spell.Level)
        {
            return;
        }

        bool usedSpell = LocalUserInfo.Me.ClientCharacter.SpellsCooldowns.AttemptUseSpell(spell);

        if (usedSpell)
        {
            usedSpell = ManaUsage.Instance.UseMana(spell.Mana);
        }
        if (usedSpell)
        {
            InGameMainMenuUI.Instance.ActivatedSpell(spell.Key);

            if (spell.spellTypeEnumState == SpellTypeEnumState.movement)
            {
                ExecuteMovementSpell(spell);
            }

            AttackIdCounter++;
            CurrentSpellAttackId = AttackIdCounter;
            CurrentSpellInCast   = spell;

            LocalUserInfo.Me.ClientCharacter.SpellsCooldowns.UseSpell(spell);
            SocketClient.Instance.SendUsedSpell(spell.Key, CurrentSpellAttackId);

            Instance.CastSpell(spell);
        }
    }
Exemple #12
0
    public void UseSpell(DevSpell spell)
    {
        float cooldown = spell.Cooldown * LocalUserInfo.Me.ClientCharacter.ClientPerks.CooldownModifier;

        SetSpellInCooldown(spell.Key, cooldown);
    }
Exemple #13
0
 public bool CanUseSpell(DevSpell spell)
 {
     return(GetCurrentSpellCooldown(spell.Key) <= 0);
 }