Ejemplo n.º 1
0
    public void SetAttackAnimation()
    {
        DevAbility dPA = Content.Instance.GetAbility(Info.CurrentPrimaryAbility.Key);

        if (CurrentGrowEffect != null)
        {
            CurrentGrowEffect.gameObject.SetActive(false);
            CurrentGrowEffect = null;
        }

        if (!string.IsNullOrEmpty(dPA.GrowingEffect))
        {
            CurrentGrowEffect = ResourcesLoader.Instance.GetRecycledObject(dPA.GrowingEffect);
            CurrentGrowEffect.transform.SetParent(SpellSpot);
            CurrentGrowEffect.transform.position   = SpellSpot.position;
            CurrentGrowEffect.transform.localScale = Vector3.one * 2f;
        }

        if (Info.Equipment.Weapon != null && Info.Equipment.Weapon.SubType == "twohanded")
        {
            Anim.SetInteger("AttackType", dPA.TwoHandAttackAnimations[Random.Range(0, dPA.TwoHandAttackAnimations.Count)]);
        }
        else
        {
            Anim.SetInteger("AttackType", dPA.OneHandAttackAnimations[Random.Range(0, dPA.OneHandAttackAnimations.Count)]);
        }
    }
Ejemplo n.º 2
0
    public void SetInfo(ActorInstance parent, string actionKey, string actionValue, bool triggerHit, uint attackIdCounter, float chargeValue, float speed, bool isPlayer)
    {
        ActionKey       = actionKey;
        ActionValue     = actionValue;
        AttackIDCounter = attackIdCounter;
        CurrentAbility  = Content.Instance.GetAbility(actionKey);
        ParentActor     = parent;

        this.IsPlayer = isPlayer;

        transform.parent = null;

        CurrentMaxFlightTime = MaxFlightTime;
        TriggerHit           = triggerHit;

        InFlight = true;

        if (m_Particles != null)
        {
            m_Particles.Play();
        }

        ChargeValue = chargeValue;

        if (Trail != null)
        {
            Trail.Clear();
        }
    }
Ejemplo n.º 3
0
    public DevSpell GetSpellAtIndex(int iIndex)
    {
        DevAbility tempPA = GetAbility(LocalUserInfo.Me.ClientCharacter.CurrentPrimaryAbility.Key);

        if (iIndex < tempPA.Spells.Count)
        {
            return(tempPA.Spells[iIndex]);
        }

        return(null);
    }
Ejemplo n.º 4
0
 public bool IsInitialPerkValue(DevAbility ability, PAPerk perk)
 {
     for (int i = 0; i < ability.InitialPerks.Count; i++)
     {
         if (ability.InitialPerks[i].Key == perk.Key)
         {
             return(ability.InitialPerks[i].Level == perk.Points);
         }
     }
     return(false);
 }
Ejemplo n.º 5
0
    public virtual void SetInfo(ActorInstance instance, string actionKey, string actionValue, bool isPlayer)
    {
        this.ParentActor = instance;
        this.ActionKey   = actionKey;
        this.ActionValue = actionValue;
        this.IsPlayer    = isPlayer;

        this.gameObject.SetActive(true);

        CurrentAbility = Content.Instance.GetAbility(actionKey);

        Hit = false;
    }
Ejemplo n.º 6
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();
        }
    }
Ejemplo n.º 7
0
    public void SetInfo(DevAbility devPA, PAPerk perk)
    {
        currentPerk = Content.Instance.GetPerk(perk.Key);
        bool isInitialValue = Content.Instance.IsInitialPerkValue(devPA, perk);

        txtTitle.text    = currentPerk.Name;
        iconImage.sprite = currentPerk.Icon;

        float percentValue = GetPerkValue(currentPerk, perk);

        txtPrecent.text = PerkValueFormatter.Instance.GetFormattedValue(currentPerk, percentValue, false);

        txtPrecent.color = isInitialValue ? initialPerkColor : originalTextColor;
    }
Ejemplo n.º 8
0
    public bool CanUsePA()
    {
        DevAbility devAbility = Content.Instance.GetAbility(Instance.Info.CurrentPrimaryAbility.Key);
        bool       canUse     = true;

        if (devAbility.ManaCost > 0)
        {
            if (!ManaUsage.Instance.CanUseMana(devAbility.ManaCost))
            {
                ManaUsage.Instance.WarnAboutMana();
                canUse = false;
            }
        }
        return(canUse);
    }
Ejemplo n.º 9
0
    public void ActivatePrimaryAbility(float load)
    {
        DevAbility devAbility = Content.Instance.GetAbility(Instance.Info.CurrentPrimaryAbility.Key);

        switch (devAbility.attackTypeEnumState)
        {
        case SpellTypeEnumState.normal:
        {
            break;
        }

        case SpellTypeEnumState.projectile:
        {
            Instance.FireProjectile(false, load, 0);
            break;
        }
        }
    }
Ejemplo n.º 10
0
    public void FireProjectile(bool isPlayer, float ChargeValue, uint attackIdCounter)
    {
        DevAbility dPA = Content.Instance.GetAbility(Info.CurrentPrimaryAbility.Key);

        GameObject projectile = ResourcesLoader.Instance.GetRecycledObject(dPA.ProjectilePrefab);

        if (!string.IsNullOrEmpty(dPA.GrowingEffect))
        {
            projectile.transform.localScale = Mathf.Lerp(0.1f, 2.5f, ChargeValue) * Vector3.one;
            projectile.transform.position   = SpellSpot.position;
        }
        else
        {
            projectile.transform.position = Weapon.transform.position;
        }

        projectile.transform.rotation = LastFireRot;
        projectile.GetComponent <ProjectileArrow>().SetInfo(this, Info.CurrentPrimaryAbility.Key, "", isPlayer, attackIdCounter, ChargeValue, 15f, isPlayer);
    }
Ejemplo n.º 11
0
    public void ActivatePrimaryAbility()
    {
        DevAbility devAbility = Content.Instance.GetAbility(Instance.Info.CurrentPrimaryAbility.Key);

        if (devAbility.ManaCost > 0)
        {
            ManaUsage.Instance.UseMana(devAbility.ManaCost);
        }

        switch (devAbility.attackTypeEnumState)
        {
        case SpellTypeEnumState.normal:
        {
            AttackMelee();
            break;
        }

        case SpellTypeEnumState.projectile:
        {
            FireProjectile();
            break;
        }
        }
    }
Ejemplo n.º 12
0
    public void RefreshWindow()
    {
        List <Ability> Abilities = ShowingCharAbilities ? LocalUserInfo.Me.ClientCharacter.CharAbilities : LocalUserInfo.Me.ClientCharacter.PrimaryAbilities;

        CurrentPA    = Abilities[SelectedPA];
        CurrentDevPA = Content.Instance.GetAbility(CurrentPA.Key);

        ClearContainers();

        GameObject tempObj;
        DevAbility tempDevPA;

        for (int i = 0; i < Abilities.Count; i++)
        {
            tempObj = ResourcesLoader.Instance.GetRecycledObject("PASelectionButtonUI");
            tempObj.transform.SetParent(PAContainer, false);

            AddPASelectionListener(tempObj.GetComponent <Button>(), i);

            tempDevPA = Content.Instance.GetAbility(Abilities[i].Key);

            tempObj.GetComponent <Image>().color = tempDevPA.PAColor;

            tempObj.transform.GetChild(tempObj.transform.childCount - 1).GetComponent <Image>().sprite        = tempDevPA.Icon;
            tempObj.transform.GetChild(tempObj.transform.childCount - 1).GetComponent <Outline>().effectColor = tempDevPA.PAColor;

            if (SelectedPA == i)
            {
                tempObj.transform.localScale = Vector3.one * 1.2f;
            }
            else
            {
                tempObj.transform.localScale = Vector3.one;
            }
        }

        PAName.text   = CurrentDevPA.Name;
        PAIcon.sprite = CurrentDevPA.Icon;
        PALevel.text  = CurrentPA.LVL.ToString();

        float toLevelUpPrecent;

        if (CurrentPA.Key == "charTalent")
        {
            toLevelUpPrecent = (LocalUserInfo.Me.ClientCharacter.EXP / (LocalUserInfo.Me.ClientCharacter.NextLevelXP * 1f));
        }
        else
        {
            toLevelUpPrecent = (CurrentPA.Exp / (CurrentPA.NextLevelXP * 1f));
        }

        PAEXPPrecent.text = (Mathf.FloorToInt(toLevelUpPrecent * 100)) + "%";
        PABar.fillAmount  = toLevelUpPrecent;


        PAIcon.GetComponent <Outline>().effectColor = CurrentDevPA.PAColor;
        m_FrameImage.color = CurrentDevPA.PAColor;

        foreach (KeyValuePair <string, PAPerk> keyValuePair in CurrentPA.Perks)
        {
            tempObj = ResourcesLoader.Instance.GetRecycledObject("UpgradeInfoPanel");
            tempObj.transform.SetParent(UpgradeContainer, false);
            tempObj.GetComponent <UpgradeInfoUI>().SetInfo(CurrentDevPA, keyValuePair.Value);
        }

        if (LocalUserInfo.Me.ClientCharacter.IsMainAbility(CurrentPA.Key))
        {
            m_mainButton.gameObject.SetActive(false);
            m_mainText.gameObject.SetActive(true);
        }
        else if (ShowingCharAbilities || !SceneInfo.Instance.CanSetMainAbility)
        {
            m_mainButton.gameObject.SetActive(false);
            m_mainText.gameObject.SetActive(false);
        }
        else
        {
            m_mainButton.gameObject.SetActive(true);
            m_mainText.gameObject.SetActive(false);
        }
    }
Ejemplo n.º 13
0
    IEnumerator RefreshRoutine(bool AbilitySwitch = false)
    {
        LastAmountOfSpells = SpellContainer.childCount;

        Clear();

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

        List <DevSpell> AvailableSpells = new List <DevSpell>();

        for (int i = 0; i < ability.Spells.Count; i++)
        {
            //if (ability.Spells[i].Level <= LocalUserInfo.Me.ClientCharacter.CurrentPrimaryAbility.LVL)
            //{
            AvailableSpells.Add(ability.Spells[i]);
            //}
        }

        if (AvailableSpells.Count > 0)
        {
            GameObject tempObj;
            bool       locked = false;

            for (int i = 0; i < AvailableSpells.Count - 1; i++)
            {
                locked = AvailableSpells[i].Level > LocalUserInfo.Me.ClientCharacter.CurrentPrimaryAbility.LVL;

                tempObj = ResourcesLoader.Instance.GetRecycledObject("SpellBox");
                tempObj.transform.SetParent(SpellContainer, false);
                tempObj.transform.position = tempObj.transform.parent.position;
                tempObj.GetComponent <SpellBoxUI>().Set(AvailableSpells[i], locked);
            }

            if (AbilitySwitch)
            {
                locked = AvailableSpells[AvailableSpells.Count - 1].Level > LocalUserInfo.Me.ClientCharacter.CurrentPrimaryAbility.LVL;


                tempObj = ResourcesLoader.Instance.GetRecycledObject("SpellBox");
                tempObj.transform.SetParent(SpellContainer, false);
                tempObj.transform.position = tempObj.transform.parent.position;
                tempObj.GetComponent <SpellBoxUI>().Set(AvailableSpells[AvailableSpells.Count - 1], locked);
            }
            else
            {
                if (LastAmountOfSpells < AvailableSpells.Count)
                {
                    locked = AvailableSpells[AvailableSpells.Count - 1].Level > LocalUserInfo.Me.ClientCharacter.CurrentPrimaryAbility.LVL;

                    tempObj = ResourcesLoader.Instance.GetRecycledObject("SpellBox");
                    tempObj.transform.SetParent(SpellContainer, false);
                    tempObj.transform.position = tempObj.transform.parent.position;
                    tempObj.GetComponent <SpellBoxUI>().Set(AvailableSpells[AvailableSpells.Count - 1], locked);
                    tempObj.GetComponent <SpellBoxUI>().Hide();

                    StartCoroutine(GainEffectRoutine(tempObj.transform));

                    yield return(new WaitForSeconds(0.5f));

                    tempObj.GetComponent <SpellBoxUI>().Show();
                    BurstParticles.transform.position = tempObj.transform.position;
                    BurstParticles.Play();
                }
            }
        }
    }
Ejemplo n.º 14
0
    private void HandleCommand(string cmd)
    {
        Content currentInfo = (Content)target;

        if (string.IsNullOrEmpty(cmd))
        {
            return;
        }

        if (WordNumber(0) == "item")
        {
            if (WordNumber(1) == "delete")
            {
                int tempIndex;
                if (int.TryParse(WordNumber(2), out tempIndex))
                {
                    Undo.RecordObject(target, "Remove Item");
                    currentInfo.Items.RemoveAt(tempIndex);
                    return;
                }
                else
                {
                    string tempWord = WordNumber(2);
                    for (int i = 0; i < currentInfo.Items.Count; i++)
                    {
                        if (currentInfo.Items[i].Key == tempWord)
                        {
                            Undo.RecordObject(target, "Remove Item");
                            currentInfo.Items.RemoveAt(i);
                            return;
                        }
                    }
                }
            }
            else if (WordNumber(1) == "modifyDrop")
            {
                Undo.RecordObject(target, "Times modifyDrop");
                for (int i = 0; i < currentInfo.Items.Count; i++)
                {
                    if (currentInfo.Items[i].DropChance < 0.5f)
                    {
                        currentInfo.Items[i].DropChance *= float.Parse(WordNumber(2));
                    }
                }
            }
            else if (WordNumber(1) == "balanceDropTargets")
            {
                Undo.RecordObject(target, "Times modifyDrop");
                for (int i = 0; i < currentInfo.Items.Count; i++)
                {
                    if (currentInfo.Items[i].DropChance < 0.5f && currentInfo.Items[i].AppearsAt.MinLvlMobs > 0 && currentInfo.Items[i].AppearsAt.MaxLvlMobs > 0)
                    {
                        currentInfo.Items[i].AppearsAt.MaxLvlMobs = currentInfo.Items[i].Stats.RequiresLVL + 2;
                        currentInfo.Items[i].AppearsAt.MinLvlMobs = currentInfo.Items[i].Stats.RequiresLVL - 2;
                    }
                }
            }
        }
        else if (WordNumber(0) == "monster")
        {
            if (WordNumber(1) == "clone")
            {
                Undo.RecordObject(target, "Clone Monster");
                currentInfo.Monsters.Add(currentInfo.GetMonster(WordNumber(2)).Clone());
                return;
            }
            if (WordNumber(1) == "delete")
            {
                int tempIndex;
                if (int.TryParse(WordNumber(2), out tempIndex))
                {
                    Undo.RecordObject(target, "Remove Monster");
                    currentInfo.Monsters.RemoveAt(tempIndex);
                    return;
                }
                else
                {
                    string tempWord = WordNumber(2);
                    for (int i = 0; i < currentInfo.Monsters.Count; i++)
                    {
                        if (currentInfo.Monsters[i].MonsterKey == tempWord)
                        {
                            Undo.RecordObject(target, "Remove Monster");
                            currentInfo.Monsters.RemoveAt(i);
                            return;
                        }
                    }
                }
            }
            else if (WordNumber(1) == "addLoot")
            {
                string tempWord = WordNumber(2);
                for (int i = 0; i < currentInfo.Monsters.Count; i++)
                {
                    if (currentInfo.Monsters[i].MonsterKey == tempWord)
                    {
                        Undo.RecordObject(target, "Add Monster Loot");
                        currentInfo.Monsters[i].PossibleLoot.Add(new LootInstance(WordNumber(3)));
                        return;
                    }
                }
            }
            else if (WordNumber(1) == "deleteLoot")
            {
                string monster = WordNumber(2);
                string item    = WordNumber(3);

                for (int i = 0; i < currentInfo.Monsters.Count; i++)
                {
                    if (currentInfo.Monsters[i].MonsterKey == monster)
                    {
                        Undo.RecordObject(target, "Delete Monster Loot");
                        for (int l = 0; l < currentInfo.Monsters[i].PossibleLoot.Count; l++)
                        {
                            if (currentInfo.Monsters[i].PossibleLoot[l].ItemKey == item)
                            {
                                currentInfo.Monsters[i].PossibleLoot.RemoveAt(l);
                                return;
                            }
                        }

                        return;
                    }
                }

                return;
            }
            else if (WordNumber(1) == "deleteLoot")
            {
                string tempWord = WordNumber(2);
                for (int i = 0; i < currentInfo.Monsters.Count; i++)
                {
                    if (currentInfo.Monsters[i].MonsterKey == tempWord)
                    {
                        for (int a = 0; a < currentInfo.Monsters[i].PossibleLoot.Count; a++)
                        {
                            if (currentInfo.Monsters[i].PossibleLoot[a].ItemKey == WordNumber(3))
                            {
                                Undo.RecordObject(target, "Remove Monster Loot");
                                currentInfo.Monsters[i].PossibleLoot.RemoveAt(a);
                                return;
                            }
                        }
                    }
                }
            }
            else if (WordNumber(1) == "addLootAll")
            {
                Undo.RecordObject(target, "Add All Monsters Loot");

                string tempWord = WordNumber(2);
                for (int i = 0; i < currentInfo.Monsters.Count; i++)
                {
                    currentInfo.Monsters[i].PossibleLoot.Add(new LootInstance(tempWord));
                }
            }
            else if (WordNumber(1) == "deleteLootAll")
            {
                Undo.RecordObject(target, "Delete All Monsters Loot");

                string tempWord = WordNumber(2);
                for (int i = 0; i < currentInfo.Monsters.Count; i++)
                {
                    for (int a = 0; a < currentInfo.Monsters[i].PossibleLoot.Count; a++)
                    {
                        if (currentInfo.Monsters[i].PossibleLoot[a].ItemKey == tempWord)
                        {
                            currentInfo.Monsters[i].PossibleLoot.RemoveAt(a);
                            break;
                        }
                    }
                }
            }
            else if (WordNumber(1) == "addLootMonsterLevel")
            {
                Undo.RecordObject(target, "Add Monsters Loot in monsters above level");

                string tempWord = WordNumber(2);

                int level;
                if (int.TryParse(WordNumber(3), out level))
                {
                    for (int i = 0; i < currentInfo.Monsters.Count; i++)
                    {
                        if (currentInfo.Monsters[i].MonsterLevel > level)
                        {
                            currentInfo.Monsters[i].PossibleLoot.Add(new LootInstance(tempWord));
                        }
                    }
                }
            }
            else if (WordNumber(1) == "deleteLootMonsterLevel")
            {
                Undo.RecordObject(target, "Delete Monsters Loot in monsters below level");

                string tempWord = WordNumber(2); //item

                int level;
                if (int.TryParse(WordNumber(3), out level))
                {
                    for (int i = 0; i < currentInfo.Monsters.Count; i++)
                    {
                        if (currentInfo.Monsters[i].MonsterLevel < level)
                        {
                            for (int a = 0; a < currentInfo.Monsters[i].PossibleLoot.Count; a++)
                            {
                                if (currentInfo.Monsters[i].PossibleLoot[a].ItemKey == tempWord)
                                {
                                    currentInfo.Monsters[i].PossibleLoot.RemoveAt(a);
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            else if (WordNumber(1) == "ClearLootDuplicates")
            {
                Undo.RecordObject(target, "Clear Monster Loot Duplicates");

                List <LootInstance> toDelete = new List <LootInstance>();
                bool containsFlag;

                for (int t = 0; t < currentInfo.Items.Count; t++)
                {
                    for (int i = 0; i < currentInfo.Monsters.Count; i++)
                    {
                        toDelete.Clear();
                        containsFlag = false;

                        for (int a = 0; a < currentInfo.Monsters[i].PossibleLoot.Count; a++)
                        {
                            if (currentInfo.Monsters[i].PossibleLoot[a].ItemKey == currentInfo.Items[t].Key)
                            {
                                if (!containsFlag)
                                {
                                    containsFlag = true;
                                }
                                else
                                {
                                    toDelete.Add(currentInfo.Monsters[i].PossibleLoot[a]);
                                }
                            }
                        }

                        for (int b = 0; b < toDelete.Count; b++)
                        {
                            currentInfo.Monsters[i].PossibleLoot.Remove(toDelete[b]);
                        }
                    }
                }
            }
            else if (WordNumber(1) == "cloneLoot")
            {
                Undo.RecordObject(target, "Clone loot from monster to monster");

                DevMonsterInfo monsterFrom = currentInfo.GetMonster(WordNumber(2));
                DevMonsterInfo monsterTo   = currentInfo.GetMonster(WordNumber(3));

                foreach (LootInstance loot in monsterFrom.PossibleLoot)
                {
                    monsterTo.PossibleLoot.Add(loot);
                }
            }
        }
        else if (WordNumber(0) == "pa")
        {
            if (WordNumber(1) == "clonePerks")
            {
                Undo.RecordObject(target, "Clone Perks");

                DevAbility paFrom = currentInfo.GetAbility(WordNumber(2));
                DevAbility paTo   = currentInfo.GetAbility(WordNumber(3));

                paTo.InitialPerks.Clear();
                paTo.InitialPerks.InsertRange(0, paFrom.InitialPerks);

                paTo.Perks.Clear();
                paTo.Perks.InsertRange(0, paFrom.Perks);

                return;
            }
        }
        else if (WordNumber(0) == "quest")
        {
            if (WordNumber(1) == "delete")
            {
                int tempIndex;
                if (int.TryParse(WordNumber(2), out tempIndex))
                {
                    Undo.RecordObject(target, "Remove Quest");
                    currentInfo.Quests.RemoveAt(tempIndex);
                    return;
                }
                else
                {
                    string tempWord = WordNumber(2);
                    for (int i = 0; i < currentInfo.Quests.Count; i++)
                    {
                        if (currentInfo.Quests[i].Key == tempWord)
                        {
                            Undo.RecordObject(target, "Remove Quest");
                            currentInfo.Quests.RemoveAt(i);
                            return;
                        }
                    }
                }
            }
        }
        else if (WordNumber(0) == "scenes")
        {
            if (WordNumber(1) == "save")
            {
                SceneSaver.Instance.resaveAllScenes();
            }
        }
    }