예제 #1
0
 public void ModifyWithPerk(Perk perk)
 {
     dmg             += perk.weapDmg;
     crit            += perk.weapCrit;
     critMul         += perk.weapCritMul;
     aoe             += perk.weapAOE;
     range           += perk.weapRange;
     cooldown        += perk.weapCooldown;
     clipSize        += perk.weapClipSize;
     ammoCap         += perk.weapAmmoCap;
     reloadDuration  += perk.weapReloadDuration;
     recoilMagnitude += perk.weapRecoilMagnitude;
 }
예제 #2
0
        private float DrawAddAbility(float startX, float startY, Perk perk)
        {
            startY += 45;

            int abilityIdx = perk.newAbilityID >= 0 ? TDSEditor.GetAbilityIndex(perk.newAbilityID) : 0;

            TDSEditorUtility.DrawSprite(new Rect(startX + spaceX + width - 40, startY + spaceY - 45, 40, 40), abilityIdx > 0 ? abilityDB.abilityList[abilityIdx - 1].icon : null);
            if (GUI.Button(new Rect(startX + spaceX, startY - 2, 40, height - 2), "Edit "))
            {
                AbilityEditorWindow.Init();
            }

            cont = new GUIContent("New Ability:", "New ability to be made available to player");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY - 5, width, height), cont, headerStyle);

            abilityIdx = EditorGUI.Popup(new Rect(startX + spaceX, startY, width, height), abilityIdx, abilityLabel);
            if (abilityIdx > 0)
            {
                perk.newAbilityID = abilityDB.abilityList[abilityIdx - 1].ID;
            }
            else
            {
                perk.newAbilityID = -1;
            }


            abilityIdx = perk.replaceAbilityID >= 0 ? TDSEditor.GetAbilityIndex(perk.replaceAbilityID) : 0;

            cont = new GUIContent("Replace Existing:", "If the new ability is to replace a existing player's ability\n\nIf no matching ability is found during runtime, the new ability will simply be added");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);

            abilityIdx = EditorGUI.Popup(new Rect(startX + spaceX, startY, width, height), abilityIdx, abilityLabel);
            if (abilityIdx > 0)
            {
                perk.replaceAbilityID = abilityDB.abilityList[abilityIdx - 1].ID;
            }
            else
            {
                perk.replaceAbilityID = -1;
            }

            return(startY);
        }
예제 #3
0
        int NewItem(int cloneID = -1)
        {
            Perk perk = null;

            if (cloneID == -1)
            {
                perk      = new Perk();
                perk.name = "New Perk";
            }
            else
            {
                perk = perkDB.perkList[selectID].Clone();
            }
            perk.ID = GenerateNewID(perkIDList);
            perkIDList.Add(perk.ID);

            perkDB.perkList.Add(perk);

            UpdateLabel_Perk();

            return(perkDB.perkList.Count - 1);
        }
예제 #4
0
        private float DrawPerkStats(float startX, float startY, Perk perk)
        {
            widthS = 50;

            string text = "Modifiers Setting " + (!foldStats ? "(show)" : "(hide)");

            foldStats = EditorGUI.Foldout(new Rect(startX, startY, width, height), foldStats, text, foldoutStyle);
            if (foldStats)
            {
                startX += 15;

                if (perk.type == _PerkType.ModifyGeneralStats)
                {
                    startY = DrawGeneralStats(startX, startY + 2, perk);
                }
                else if (perk.type == _PerkType.AddWeapon)
                {
                    startY = DrawAddWeapon(startX, startY, perk);
                }
                else if (perk.type == _PerkType.AddAbility)
                {
                    startY = DrawAddAbility(startX, startY, perk);
                }
                else if (perk.type == _PerkType.ModifyWeapon)
                {
                    startY = DrawModifyWeapon(startX, startY + 2, perk);
                }
                else if (perk.type == _PerkType.ModifyAbility)
                {
                    startY = DrawModifyAbility(startX, startY + 2, perk);
                }
                else if (perk.type == _PerkType.Custom)
                {
                    startY = DrawCustom(startX, startY + 2, perk);
                }
            }

            return(startY + spaceY);
        }
예제 #5
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            if (instance == null)
            {
                Awake();
            }

            Undo.RecordObject(instance, "UIPerkTabList");

            //serializedObject.Update();


            //~ cont=new GUIContent("Manual Setup:", "");
            //~ instance.manuallySetupItem=EditorGUILayout.Toggle(cont, instance.manuallySetupItem);

            EditorGUILayout.Space();

            //if(!instance.manuallySetup){

            showPerkList = EditorGUILayout.Foldout(showPerkList, "Show Perk List");
            if (showPerkList)
            {
                EditorGUILayout.HelpBox("Choose perk that will shows up in the UI", MessageType.Info);

                EditorGUILayout.BeginHorizontal();
                if (GUILayout.Button("EnableAll"))
                {
                    EnableAllPerk();
                }
                if (GUILayout.Button("DisableAll"))
                {
                    DisableAllPerk();
                }
                EditorGUILayout.EndHorizontal();

                for (int i = 0; i < perkDB.perkList.Count; i++)
                {
                    Perk perk = perkDB.perkList[i];

                    GUILayout.BeginHorizontal();

                    GUILayout.Box("", GUILayout.Width(40), GUILayout.Height(40));
                    Rect rect = GUILayoutUtility.GetLastRect();
                    TDSEditorUtility.DrawSprite(rect, perk.icon, perk.desp, false);

                    GUILayout.BeginVertical();
                    EditorGUILayout.Space();
                    GUILayout.Label(perk.name, GUILayout.ExpandWidth(false));

                    GUILayout.BeginHorizontal();

                    EditorGUI.BeginChangeCheck();
                    bool flag = instance.perkIDList.Contains(perk.ID) ? true : false;
                    EditorGUILayout.LabelField(new GUIContent(" - enabled: ", "check to enable the perk in this level"), GUILayout.Width(70));
                    flag = EditorGUILayout.Toggle(flag);

                    if (!Application.isPlaying && EditorGUI.EndChangeCheck())
                    {
                        if (!flag && !instance.perkIDList.Contains(perk.ID))
                        {
                            instance.perkIDList.Remove(perk.ID);
                        }
                        else if (flag)
                        {
                            instance.perkIDList.Add(perk.ID);
                        }
                    }

                    GUILayout.EndHorizontal();

                    GUILayout.EndVertical();

                    GUILayout.EndHorizontal();
                }
            }

            EditorGUILayout.Space();
            EditorGUILayout.Space();
            //}



            //serializedObject.ApplyModifiedProperties();

            //DefaultInspector();

            DrawDefaultInspector();

            if (GUI.changed)
            {
                EditorUtility.SetDirty(instance);
            }
        }
예제 #6
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            if (instance == null)
            {
                Awake();
            }

            GUI.changed = false;

            serializedObject.Update();


            EditorGUILayout.Space();
            cont = new GUIContent("Perk Currency:", "The amount of perk currency pocessed by the player unit.\nUsed to purchase perk");
            EditorGUILayout.PropertyField(serializedObject.FindProperty("perkCurrency"), cont);
            EditorGUILayout.Space();


            showPerkList = EditorGUILayout.Foldout(showPerkList, "Show Valid Perk List");
            if (showPerkList)
            {
                EditorGUILayout.BeginHorizontal();
                if (GUILayout.Button("EnableAll"))
                {
                    EnableAllPerkOnAll();
                }
                if (GUILayout.Button("DisableAll"))
                {
                    DisableAllPerkOnAll();
                }
                EditorGUILayout.EndHorizontal();

                for (int i = 0; i < perkDB.perkList.Count; i++)
                {
                    Perk perk = perkDB.perkList[i];

                    GUILayout.BeginHorizontal();

                    GUILayout.Box("", GUILayout.Width(40), GUILayout.Height(40));
                    Rect rect = GUILayoutUtility.GetLastRect();
                    TDSEditorUtility.DrawSprite(rect, perk.icon, perk.desp, false);

                    GUILayout.BeginVertical();

                    EditorGUILayout.Space();
                    GUILayout.Label(perk.name, GUILayout.ExpandWidth(false));


                    GUILayout.BeginHorizontal();

                    EditorGUI.showMixedValue = !UnavailableListSharesValue(perk.ID);

                    EditorGUI.BeginChangeCheck();
                    bool flag = !instance.unavailableIDList.Contains(perk.ID) ? true : false;
                    EditorGUILayout.LabelField(new GUIContent(" - enabled: ", "check to enable the perk in this level"), GUILayout.Width(70));
                    flag = EditorGUILayout.Toggle(flag);

                    if (!Application.isPlaying && EditorGUI.EndChangeCheck())
                    {
                        if (!flag)
                        {
                            RemoveIDFromAvaiList(perk.ID);
                        }
                        else
                        {
                            AddIDToAvaiList(perk.ID);
                        }
                    }

                    EditorGUI.showMixedValue = false;


                    EditorGUI.showMixedValue = !PurchasedListSharesValue(perk.ID);

                    if (!instance.unavailableIDList.Contains(perk.ID))
                    {
                        flag = instance.purchasedIDList.Contains(perk.ID);
                        EditorGUILayout.LabelField(new GUIContent(" - purchased: ", "check to set the perk as purchased right from the start"), GUILayout.Width(80));
                        flag = EditorGUILayout.Toggle(flag);

                        if (!Application.isPlaying)
                        {
                            if (!flag)
                            {
                                RemoveIDFromPurchasedList(perk.ID);
                            }
                            else
                            {
                                AddIDToPurchasedList(perk.ID);
                            }
                        }
                    }

                    EditorGUI.showMixedValue = false;

                    GUILayout.EndHorizontal();

                    GUILayout.EndVertical();

                    GUILayout.EndHorizontal();
                }
            }

            EditorGUILayout.Space();

            serializedObject.ApplyModifiedProperties();

            DefaultInspector();

            if (GUI.changed)
            {
                EditorUtility.SetDirty(instance);
            }
        }
예제 #7
0
        //public static string PurchasePerk(Perk perk, bool useCurrency=true){ return instance._PurchasePerk(perk, useCurrency); }
        public string PurchasePerk(Perk perk, bool useCurrency = true, bool saving = true)
        {
            string text = perk.Purchase(this, useCurrency);

            if (text != "")
            {
                Debug.Log(text);
                return(text);
            }

            for (int i = 0; i < perkList.Count; i++)
            {
                Perk perkTemp = perkList[i];
                if (perkTemp.purchased > 0 || perkTemp.prereq.Count == 0)
                {
                    continue;
                }
                perkTemp.prereq.Remove(perk.ID);
            }

            TDS.PerkPurchased(perk);

            if (player.SaveUponChange())
            {
                Save();
            }

            if (perk.type == _PerkType.ModifyGeneralStats)
            {
                hitPointCap += perk.hitPointCap;
                energyCap   += perk.energyCap;

                hitPointRegen += perk.hitPointRegen;
                energyRegen   += perk.energyRegen;

                player.GainHitPoint(perk.hitPoint);
                player.GainEnergy(perk.energy);

                moveSpeedMul += perk.moveSpeedMul;

                damageMul  += perk.dmgMul;
                critMul    += perk.critChanceMul;
                critMulMul += perk.CritMultiplierMul;

                expGainMul      += perk.expGainMul;
                creditGainMul   += perk.creditGainMul;
                scoreGainMul    += perk.scoreGainMul;
                hitPointGainMul += perk.hitPointGainMul;
                energyGainMul   += perk.energyGainMul;
            }
            else if (perk.type == _PerkType.AddWeapon && perk.newWeaponID >= 0)
            {
                Weapon newWeapon = WeaponDB.GetPrefab(perk.newWeaponID);

                if (newWeapon != null)
                {
                    if (perk.replaceExisting)
                    {
                        player.AddWeapon(newWeapon, true);
                    }
                    else if (perk.replaceWeaponID >= 0)
                    {
                        int replaceIndex = -1;
                        for (int i = 0; i < player.weaponList.Count; i++)
                        {
                            if (perk.replaceWeaponID == player.weaponList[i].ID)
                            {
                                replaceIndex = i;
                                break;
                            }
                        }

                        if (replaceIndex >= 0)
                        {
                            player.SwitchWeapon(replaceIndex);
                            player.AddWeapon(newWeapon, true);
                        }
                        else
                        {
                            player.AddWeapon(newWeapon);
                        }
                    }
                    else
                    {
                        player.AddWeapon(newWeapon);
                    }
                }

                for (int i = 0; i < perkList.Count; i++)
                {
                    if (perkList[i].purchased > 0 && perkList[i].type == _PerkType.ModifyWeapon)
                    {
                        if (perkList[i].appliedToAllWeapon || perkList[i].weaponIDList.Contains(perk.newWeaponID))
                        {
                            if (perkList[i].weapEffectID >= 0)
                            {
                                player.ChangeWeaponEffect(perk.newWeaponID, perkList[i].weapEffectID);
                            }
                            if (perkList[i].weapAbilityID >= 0)
                            {
                                player.ChangeWeaponAbility(perk.newWeaponID, perkList[i].weapAbilityID);
                            }
                        }
                    }
                }
            }
            else if (perk.type == _PerkType.AddAbility && perk.newAbilityID >= 0)
            {
                AbilityManager.AddAbility(perk.newAbilityID, perk.replaceAbilityID);

                for (int i = 0; i < perkList.Count; i++)
                {
                    if (perkList[i].purchased > 0 && perkList[i].type == _PerkType.ModifyAbility)
                    {
                        if (perkList[i].appliedToAllAbility || perkList[i].abilityIDList.Contains(perk.newAbilityID))
                        {
                            if (perkList[i].abEffectID >= 0)
                            {
                                player.ChangeAbilityEffect(perk.newAbilityID, perkList[i].abEffectID);
                            }
                        }
                    }
                }
            }
            else if (perk.type == _PerkType.ModifyWeapon)
            {
                if (perk.appliedToAllWeapon)
                {
                    weapStatG.ModifyWithPerk(perk);
                    if (perk.weapEffectID >= 0)
                    {
                        player.ChangeAllWeaponEffect(perk.weapEffectID);
                    }
                    if (perk.weapAbilityID >= 0)
                    {
                        player.ChangeAllWeaponAbility(perk.weapAbilityID);
                    }
                }
                else
                {
                    for (int i = 0; i < perk.weaponIDList.Count; i++)
                    {
                        WeaponStatMultiplier item = GetWeaponStatMul(perk.weaponIDList[i]);

                        if (item == null)
                        {
                            item          = new WeaponStatMultiplier();
                            item.prefabID = perk.weaponIDList[i];
                            weapStatList.Add(item);
                        }

                        item.ModifyWithPerk(perk);

                        if (perk.weapEffectID >= 0)
                        {
                            player.ChangeWeaponEffect(perk.weaponIDList[i], perk.weapEffectID);
                        }
                        if (perk.weapAbilityID >= 0)
                        {
                            player.ChangeWeaponAbility(perk.weaponIDList[i], perk.weapAbilityID);
                        }
                    }
                }
            }
            else if (perk.type == _PerkType.ModifyAbility)
            {
                if (perk.appliedToAllAbility)
                {
                    abilityStatG.ModifyWithPerk(perk);
                    if (perk.weapEffectID >= 0)
                    {
                        player.ChangeAllAbilityEffect(perk.weapEffectID);
                    }
                }
                else
                {
                    for (int i = 0; i < perk.abilityIDList.Count; i++)
                    {
                        AbilityStatMultiplier item = GetAbilityStatMul(perk.abilityIDList[i]);

                        if (item == null)
                        {
                            item          = new AbilityStatMultiplier();
                            item.prefabID = perk.abilityIDList[i];
                            abilityStatList.Add(item);
                        }

                        item.ModifyWithPerk(perk);

                        if (perk.abEffectID >= 0)
                        {
                            player.ChangeAbilityEffect(perk.abilityIDList[i], perk.abEffectID);
                        }
                    }
                }
            }
            else if (perk.type == _PerkType.Custom)
            {
                GameObject obj = (GameObject)Instantiate(perk.customObject);
                obj.name                    = perk.name + "_CustomObject";
                obj.transform.parent        = transform;
                obj.transform.localPosition = Vector3.zero;
                obj.transform.localRotation = Quaternion.identity;
            }

            return("");
        }
예제 #8
0
        public Perk Clone()
        {
            Perk perk = new Perk();

            perk.ID   = ID;
            perk.icon = icon;
            perk.name = name;
            perk.desp = desp;

            perk.type       = type;
            perk.repeatable = repeatable;
            perk.limit      = limit;

            perk.purchased = purchased;

            perk.cost         = cost;
            perk.minLevel     = minLevel;
            perk.minPerkPoint = minPerkPoint;
            perk.prereq       = new List <int>(prereq);


            //generic multiplier
            perk.hitPoint      = hitPoint;
            perk.hitPointCap   = hitPointCap;
            perk.hitPointRegen = hitPointRegen;

            perk.energy      = energy;
            perk.energyCap   = energyCap;
            perk.energyRegen = energyRegen;

            perk.moveSpeedMul = moveSpeedMul;

            perk.dmgMul            = dmgMul;
            perk.critChanceMul     = critChanceMul;
            perk.CritMultiplierMul = CritMultiplierMul;

            perk.expGainMul      = expGainMul;
            perk.creditGainMul   = creditGainMul;
            perk.scoreGainMul    = scoreGainMul;
            perk.hitPointGainMul = hitPointGainMul;
            perk.energyGainMul   = energyGainMul;

            //add new weapon
            perk.newWeaponID     = newWeaponID;
            perk.replaceExisting = replaceExisting;
            perk.replaceWeaponID = replaceWeaponID;

            //add new ability
            perk.newAbilityID     = newAbilityID;
            perk.replaceAbilityID = replaceAbilityID;


            //modify weapon
            perk.appliedToAllWeapon = appliedToAllWeapon;
            perk.weaponIDList       = new List <int>(weaponIDList);

            perk.weapDmg             = weapDmg;
            perk.weapCrit            = weapCrit;
            perk.weapCritMul         = weapCritMul;
            perk.weapAOE             = weapAOE;
            perk.weapRange           = weapRange;
            perk.weapCooldown        = weapCooldown;
            perk.weapClipSize        = weapClipSize;
            perk.weapAmmoCap         = weapAmmoCap;
            perk.weapReloadDuration  = weapReloadDuration;
            perk.weapRecoilMagnitude = weapRecoilMagnitude;
            perk.weapEffectID        = weapEffectID;
            perk.weapAbilityID       = weapAbilityID;


            //modify ability
            perk.appliedToAllAbility = appliedToAllAbility;
            perk.abilityIDList       = new List <int>(abilityIDList);

            perk.abCost     = abCost;
            perk.abCooldown = abCooldown;
            perk.abRange    = abRange;

            perk.abDmg      = abDmg;
            perk.abCrit     = abCrit;
            perk.abCritMul  = abCritMul;
            perk.abAOE      = abAOE;
            perk.abEffectID = abEffectID;


            //custom
            perk.customObject = customObject;

            return(perk);
        }
예제 #9
0
 void OnPerkPurchasedUp(Perk perk)
 {
     PlaySound(perkPurchasedClip);
 }
예제 #10
0
        private float DrawGeneralStats(float startX, float startY, Perk perk)
        {
            string stackText = "\nValue stacks with multiple perks";

            cont = new GUIContent("hitPoint:", "Player direct hitpoint gained\n0.1 being 10% increase in player's hitpoint capacity");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.hitPoint = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.hitPoint);

            cont = new GUIContent("hitPoint Cap:", "Player direct hitpoint capacity gained" + stackText);
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.hitPointCap = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.hitPointCap);

            cont = new GUIContent("hitPoint Regen:", "Player direct hitpoint regeneration rate gained" + stackText);
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.hitPointRegen = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.hitPointRegen);

            startY += 5;

            cont = new GUIContent("Energy:", "Player direct energy gained");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.energy = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.energy);

            cont = new GUIContent("Energy Cap:", "Player direct energy capacity gained" + stackText);
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.energyCap = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.energyCap);

            cont = new GUIContent("Energy Regen:", "Player direct energy regeneration rate gained" + stackText);
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.energyRegen = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.energyRegen);

            startY += 5;

            cont = new GUIContent("Speed Mul.:", "Player move speed multiplier\n0.1 being 10% increase in player's move speed" + stackText);
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.moveSpeedMul = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.moveSpeedMul);

            startY += 5;

            cont = new GUIContent("Damage Mul.:", "Player damage multiplier\n0.1 being 10% increase in player's damage output (weapon's value)" + stackText);
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.dmgMul = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.dmgMul);

            cont = new GUIContent("Crit Chance Mul.:", "Player critical chance multiplier\n0.1 being 10% increase in player's critical chance (weapon's value)" + stackText);
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.critChanceMul = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.critChanceMul);

            cont = new GUIContent("Crit Multiplier Mul.:", "Player critical-multiplier multiplier\n0.1 being 10% increase in player's critical-multiplier (weapon's value)" + stackText);
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.CritMultiplierMul = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.CritMultiplierMul);

            startY += 5;

            cont = new GUIContent("Exp Gain Mul.:", "Player experience gain multiplier\n0.1 being 10% increase in player's experience gain" + stackText);
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.expGainMul = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.expGainMul);

            cont = new GUIContent("Perk Cur. Gain Mul.:", "Player perk currency gain multiplier\n0.1 being 10% increase in player's perk currency gain" + stackText);
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.creditGainMul = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.creditGainMul);

            //cont=new GUIContent("Credit Gain Mul.:", "Player credit gain multiplier\n0.1 being 10% increase in player's credit gain"+stackText);
            //EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
            //perk.creditGainMul=EditorGUI.FloatField(new Rect(startX+spaceX, startY, widthS, height), perk.creditGainMul);

            cont = new GUIContent("Score Gain Mul.:", "Player score multiplier\n0.1 being 10% increase in player's score gain" + stackText);
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.scoreGainMul = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.scoreGainMul);

            cont = new GUIContent("HP Gain Mul.:", "Player hitpoint multiplier (from external source like collectible creep kill)\n0.1 being 10% increase in player's hitpoint gain" + stackText);
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.hitPointGainMul = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.hitPointGainMul);

            cont = new GUIContent("Energy Gain Mul.:", "Player energy gain multiplier (from external source like collectible creep kill)\n0.1 being 10% increase in player's energy gain" + stackText);
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.energyGainMul = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.energyGainMul);

            return(startY);
        }
예제 #11
0
        private float DrawModifyWeapon(float startX, float startY, Perk perk)
        {
            cont = new GUIContent("Apply To All:", "Check if the perk bonus applies to all player weapon (when applicable)");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.appliedToAllWeapon = EditorGUI.Toggle(new Rect(startX + spaceX, startY, widthS, height), perk.appliedToAllWeapon);

            if (!perk.appliedToAllWeapon)
            {
                cont = new GUIContent("Linked Weapons:", "The weapons that will gain the perk bonus");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);

                for (int i = 0; i < perk.weaponIDList.Count + 1; i++)
                {
                    int index = i < perk.weaponIDList.Count ? TDSEditor.GetWeaponIndex(perk.weaponIDList[i]) : 0;

                    if (i > 0)
                    {
                        startY += spaceY;
                    }
                    EditorGUI.LabelField(new Rect(startX + spaceX - 10, startY, width, height), "-");
                    index = EditorGUI.Popup(new Rect(startX + spaceX, startY, width, 15), index, weaponLabel);

                    if (index > 0)
                    {
                        int ID = weaponDB.weaponList[index - 1].ID;
                        if (!perk.weaponIDList.Contains(ID))
                        {
                            if (i < perk.weaponIDList.Count)
                            {
                                perk.weaponIDList[i] = ID;
                            }
                            else
                            {
                                perk.weaponIDList.Add(ID);
                            }
                        }
                    }
                    else if (i < perk.weaponIDList.Count)
                    {
                        perk.weaponIDList.RemoveAt(i); i -= 1;
                    }
                }
            }

            string stackText = "\nValue stacks with multiple perks";

            startY += 5;

            cont = new GUIContent("Damage:", "Weapon damage multiplier\n0.1 being 10% increase in weapon's damage" + stackText);
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.weapDmg = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.weapDmg);

            cont = new GUIContent("Crit Chance:", "Weapon critical chance multiplier\n0.1 being 10% increase in weapon's critical chance" + stackText);
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.weapCrit = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.weapCrit);

            cont = new GUIContent("Crit Multiplier:", "Weapon critical-multiplier multiplier\n0.1 being 10% increase in weapon's critical-multiplier" + stackText);
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.weapCritMul = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.weapCritMul);

            cont = new GUIContent("AOE:", "Weapon AOE radius multiplier\n0.1 being 10% increase in weapon's AOE radius" + stackText);
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.weapAOE = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.weapAOE);

            startY += 5;

            cont = new GUIContent("range:", "Weapon range multiplier\n0.1 being 10% increase in weapon's range" + stackText);
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.weapRange = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.weapRange);

            cont = new GUIContent("Cooldown:", "Weapon cooldown multiplier\n-0.1 being 10% reduction in weapon's cooldown" + stackText);
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.weapCooldown = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.weapCooldown);

            cont = new GUIContent("Clip Size:", "Weapon clip size multiplier\n0.1 being 10% increase in weapon's clip size" + stackText);
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.weapClipSize = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.weapClipSize);

            cont = new GUIContent("Ammo Cap:", "Weapon ammo cap multiplier\n0.1 being 10% increase in weapon's ammo cap" + stackText);
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.weapAmmoCap = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.weapAmmoCap);

            cont = new GUIContent("Reload:", "Weapon reload duration multiplier\n-0.1 being 10% reduction in weapon's reload duration" + stackText);
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.weapReloadDuration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.weapReloadDuration);

            cont = new GUIContent("Recoil:", "Weapon recoil multiplier\n-0.1 being 10% reduction in weapon's recoil" + stackText);
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.weapRecoilMagnitude = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.weapRecoilMagnitude);

            startY += 5;

            int effectIdx = perk.weapEffectID >= 0 ? TDSEditor.GetEffectIndex(perk.weapEffectID) : 0;

            cont = new GUIContent("New Effect:", "replace existing weapon attack effect with the specified effect");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);

            effectIdx = EditorGUI.Popup(new Rect(startX + spaceX, startY, width, height), effectIdx, effectLabel);
            if (effectIdx > 0)
            {
                perk.weapEffectID = effectDB.effectList[effectIdx - 1].ID;
            }
            else
            {
                perk.weapEffectID = -1;
            }

            startY += 5;

            int abIdx = perk.weapAbilityID >= 0 ? TDSEditor.GetAbilityIndex(perk.weapAbilityID) : 0;

            cont = new GUIContent("New Alt-Attack:", "replace existing weapon alternate attack with the specified ability");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);

            abIdx = EditorGUI.Popup(new Rect(startX + spaceX, startY, width, height), abIdx, effectLabel);
            if (abIdx > 0)
            {
                perk.weapAbilityID = abilityDB.abilityList[abIdx - 1].ID;
            }
            else
            {
                perk.weapAbilityID = -1;
            }

            return(startY);
        }
예제 #12
0
        private float DrawModifyAbility(float startX, float startY, Perk perk)
        {
            cont = new GUIContent("Apply To All:", "Check if the perk bonus applies to all player ability (when applicable)");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.appliedToAllAbility = EditorGUI.Toggle(new Rect(startX + spaceX, startY, widthS, height), perk.appliedToAllAbility);

            if (!perk.appliedToAllAbility)
            {
                cont = new GUIContent("Linked Abilities:", "The abilities that will gain the perk bonus");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);

                for (int i = 0; i < perk.abilityIDList.Count + 1; i++)
                {
                    int index = i < perk.abilityIDList.Count ? TDSEditor.GetAbilityIndex(perk.abilityIDList[i]) : 0;

                    if (i > 0)
                    {
                        startY += spaceY;
                    }
                    EditorGUI.LabelField(new Rect(startX + spaceX - 10, startY, width, height), "-");
                    index = EditorGUI.Popup(new Rect(startX + spaceX, startY, width, 15), index, abilityLabel);

                    if (index > 0)
                    {
                        int ID = abilityDB.abilityList[index - 1].ID;
                        if (!perk.abilityIDList.Contains(ID))
                        {
                            if (i < perk.abilityIDList.Count)
                            {
                                perk.abilityIDList[i] = ID;
                            }
                            else
                            {
                                perk.abilityIDList.Add(ID);
                            }
                        }
                    }
                    else if (i < perk.abilityIDList.Count)
                    {
                        perk.abilityIDList.RemoveAt(i); i -= 1;
                    }
                }
            }

            string stackText = "\nValue stacks with multiple perks";

            startY += 5;

            cont = new GUIContent("Cost:", "Ability energy cost multiplier.\n-0.1 being 10% reduction in ability's energy cost" + stackText);
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.abCost = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.abCost);

            cont = new GUIContent("Cooldown:", "Ability cooldown multiplier.\n-0.1 being 10% reduction in ability's cooldown" + stackText);
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.abCooldown = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.abCooldown);

            cont = new GUIContent("Range:", "Ability range multiplier.\n0.1 being 10% increase in ability's range" + stackText);
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.abRange = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.abRange);

            startY += 5;

            cont = new GUIContent("Damage:", "Ability damage multiplier\n0.1 being 10% increase in ability's damage" + stackText);
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.abDmg = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.abDmg);

            cont = new GUIContent("Crit Chance:", "Ability critical chance multiplier\n0.1 being 10% increase in ability's damage" + stackText);
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.abCrit = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.abCrit);

            cont = new GUIContent("Crit Multiplier:", "Ability critical-multiplier's multiplier\n0.1 being 10% increase in ability's critical multiplier" + stackText);
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.abCritMul = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.abCritMul);

            cont = new GUIContent("AOE:", "Ability AOE radius multiplier\n0.1 being 10% increase in ability's AOE Radius" + stackText);
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            perk.abAOE = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), perk.abAOE);

            startY += 5;

            int effectIdx = perk.abEffectID >= 0 ? TDSEditor.GetEffectIndex(perk.abEffectID) : 0;

            cont = new GUIContent("New Effect:", "replace existing ability effect with the specified effect");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);

            effectIdx = EditorGUI.Popup(new Rect(startX + spaceX, startY, width, height), effectIdx, effectLabel);
            if (effectIdx > 0)
            {
                perk.abEffectID = effectDB.effectList[effectIdx - 1].ID;
            }
            else
            {
                perk.abEffectID = -1;
            }

            return(startY);
        }
예제 #13
0
        private float DrawPerkGeneralSetting(float startX, float startY, Perk perk)
        {
            widthS = 50;

            string text = "General Setting " + (!foldGeneral ? "(show)" : "(hide)");

            foldGeneral = EditorGUI.Foldout(new Rect(startX, startY, width, height), foldGeneral, text, foldoutStyle);
            if (foldGeneral)
            {
                startX += 15;

                cont = new GUIContent("Repeatable:", "Check if the ability can be repeatably purchase. For perk that offer straight, one off bonus such as life and resource");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                perk.repeatable = EditorGUI.Toggle(new Rect(startX + spaceX, startY, widthS, height), perk.repeatable);

                cont = new GUIContent("Limit:", "The amount of time the perk can be repeatably purchase.\nany value <=0 means it's unlimited");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                if (perk.repeatable)
                {
                    perk.limit = EditorGUI.IntField(new Rect(startX + spaceX, startY, widthS, height), perk.limit);
                }
                else
                {
                    EditorGUI.LabelField(new Rect(startX + spaceX, startY, widthS, height), "-");
                }


                startY += 8;

                cont = new GUIContent("Prerequisite Perk:", "Perks that needs to be purchased before this perk is unlocked and become available");
                EditorGUI.LabelField(new Rect(startX, startY + spaceY, width, height), cont);

                for (int i = 0; i < perk.prereq.Count + 1; i++)
                {
                    int index = (i < perk.prereq.Count) ? TDSEditor.GetPerkIndex(perk.prereq[i]) : 0;
                    index = EditorGUI.Popup(new Rect(startX + spaceX, startY += spaceY, width, height), index, perkLabel);
                    if (index > 0)
                    {
                        int perkID = perkDB.perkList[index - 1].ID;
                        if (perkID != perk.ID && !perk.prereq.Contains(perkID))
                        {
                            if (i < perk.prereq.Count)
                            {
                                perk.prereq[i] = perkID;
                            }
                            else
                            {
                                perk.prereq.Add(perkID);
                            }
                        }
                    }
                    else if (i < perk.prereq.Count)
                    {
                        perk.prereq.RemoveAt(i); i -= 1;
                    }
                }

                startY += 5;

                cont = new GUIContent("Min level required:", "Minimum level to reach before the perk becoming available. (level are specified in GameControl of each scene)");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                perk.minLevel = EditorGUI.IntField(new Rect(startX + spaceX, startY, widthS, height), perk.minLevel);

                cont = new GUIContent("Min PerkPoint req:", "Minimum perk point to have before the perk becoming available");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                perk.minPerkPoint = EditorGUI.IntField(new Rect(startX + spaceX, startY, widthS, height), perk.minPerkPoint);

                startY += 5;

                cont = new GUIContent("Cost:", "The perk currency required to purchase the perk");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                perk.cost = EditorGUI.IntField(new Rect(startX + spaceX, startY, widthS, height), perk.cost);
            }

            return(startY + spaceY);
        }