protected void DrawAttackStats(string propertyName, bool showAOE = true, bool showPhysics = true, string label = "Attack Stats") { string lbSp = " - "; SerializedProperty aStatsP = serializedObject.FindProperty(propertyName); EditorGUILayout.LabelField(label, headerStyle); srlPpt = aStatsP.FindPropertyRelative("damageType"); EditorGUI.showMixedValue = srlPpt.hasMultipleDifferentValues; EditorGUI.BeginChangeCheck(); cont = new GUIContent(lbSp + "Damage Type:", "The damage type of the unit\nDamage type can be configured in Damage Armor Table Editor"); contL = new GUIContent[damageTypeLabel.Length]; for (int i = 0; i < contL.Length; i++) { contL[i] = new GUIContent(damageTypeLabel[i], ""); } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(cont, GUILayout.MaxWidth(labelWidth)); int armorType = EditorGUILayout.Popup(srlPpt.intValue, contL, GUILayout.MaxWidth(fieldWidthL)); EditorGUILayout.EndHorizontal(); if (EditorGUI.EndChangeCheck()) { srlPpt.intValue = armorType; } EditorGUI.showMixedValue = false; EditorGUILayout.BeginHorizontal(); cont = new GUIContent(lbSp + "Damage(Min/Max):", "Damage value done to the target's hit-point."); EditorGUILayout.LabelField(cont, GUILayout.MaxWidth(labelWidth)); EditorGUILayout.PropertyField(aStatsP.FindPropertyRelative("damageMin"), contN, GUILayout.MaxWidth(fieldWidth)); EditorGUILayout.PropertyField(aStatsP.FindPropertyRelative("damageMax"), contN, GUILayout.MaxWidth(fieldWidth)); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); if (showAOE) { cont = new GUIContent(lbSp + "AOE Radius:", "Area of effect radius of the attack. Any hostile unit within the area is affected by the attack"); PropertyField(aStatsP.FindPropertyRelative("aoeRadius"), cont); cont = new GUIContent(lbSp + "Diminishing AOE:", "Check if damage value diminished the further away the target is from the center of the aoe"); if (aStatsP.FindPropertyRelative("aoeRadius").floatValue > 0) { PropertyField(aStatsP.FindPropertyRelative("dimishingAOE"), cont); } else { InvalidField(cont); } } EditorGUILayout.Space(); cont = new GUIContent(lbSp + "Critical Chance:", "The chance of the attack to score a critical. Takes value from 0-1 with 0.3 being 30% to score a critical"); PropertyField(aStatsP.FindPropertyRelative("critChance"), cont); cont = new GUIContent(lbSp + "Critical Multiplier:", "The multiplier to be applied to damage if the attack scores a critical.\n - 1.5 for 150% of normal damage, 2 for 200% and so on"); if (aStatsP.FindPropertyRelative("critChance").floatValue > 0) { PropertyField(aStatsP.FindPropertyRelative("critMultiplier"), cont); } else { InvalidField(cont); } EditorGUILayout.Space(); if (showPhysics) { cont = new GUIContent(lbSp + "Impact Force:", "If the attack will applies a knock back force to the target\nOnly applies if the attack is a direct hit from a shoot object"); EditorGUI.BeginChangeCheck(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(cont, GUILayout.MaxWidth(labelWidth)); float impactForce = EditorGUILayout.FloatField(aStatsP.FindPropertyRelative("impactForce").floatValue, GUILayout.MaxWidth(fieldWidth)); if (EditorGUI.EndChangeCheck()) { aStatsP.FindPropertyRelative("impactForce").floatValue = impactForce; } EditorGUILayout.EndHorizontal(); cont = new GUIContent(lbSp + "Explosion Radius:", "The radius in which all unit is affected by explosion force"); PropertyField(aStatsP.FindPropertyRelative("explosionRadius"), cont); cont = new GUIContent(lbSp + "Explosion Force:", "The force of the explosion which pushes all affect unit away from the impact point"); if (aStatsP.FindPropertyRelative("explosionRadius").floatValue > 0) { PropertyField(aStatsP.FindPropertyRelative("explosionForce"), cont); } else { InvalidField(cont); } } EditorGUILayout.Space(); srlPpt = aStatsP.FindPropertyRelative("effectID"); EditorGUI.showMixedValue = srlPpt.hasMultipleDifferentValues; int effectIdx = srlPpt.intValue >= 0 ? TDSEditor.GetEffectIndex(srlPpt.intValue) : 0; //if(!srlPpt.hasMultipleDifferentValues) //TDSEditorUtility.DrawSprite(new Rect(startX+spaceX+width-40, startY+spaceY-45, 40, 40), effectIdx>0 ? effectDB.effectList[effectIdx-1].icon : null); //if(GUI.Button(new Rect(startX+spaceX, startY-2, 40, height-2), "Edit")) EffectEditorWindow.Init(); EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); cont = new GUIContent(lbSp + "Attack Effect:", "Special effect that applies with each hit (optional)"); EditorGUILayout.LabelField(cont, GUILayout.MaxWidth(labelWidth)); effectIdx = EditorGUILayout.Popup(effectIdx, effectLabel, GUILayout.MaxWidth(fieldWidthL)); if (EditorGUI.EndChangeCheck()) { if (effectIdx > 0) { srlPpt.intValue = effectDB.effectList[effectIdx - 1].ID; } else { srlPpt.intValue = -1; } } EditorGUI.showMixedValue = false; EditorGUILayout.EndHorizontal(); }
void DrawFullEditor() { serializedObject.Update(); cont = new GUIContent("Name:", "The collectible name to be displayed in game"); PropertyFieldL(serializedObject.FindProperty("collectibleName"), cont); cont = new GUIContent("Icon:", "The collectible icon to be displayed in game and editor, must be a sprite"); PropertyFieldL(serializedObject.FindProperty("icon"), cont); EditorGUILayout.Space(); srlPpt = serializedObject.FindProperty("type"); EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = srlPpt.hasMultipleDifferentValues; cont = new GUIContent("Collectible Type:", "What does the specific collectible do when it's triggered"); EditorGUILayout.LabelField(cont, GUILayout.MaxWidth(labelWidth)); contL = new GUIContent[collectTypeLabel.Length]; for (int i = 0; i < contL.Length; i++) { contL[i] = new GUIContent(collectTypeLabel[i], collectTypeTooltip[i]); } int type = EditorGUILayout.Popup(srlPpt.enumValueIndex, contL, GUILayout.MaxWidth(fieldWidthL)); if (EditorGUI.EndChangeCheck()) { srlPpt.enumValueIndex = type; } EditorGUI.showMixedValue = false; EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); if (instance.type == _CollectType.Ability) { EditorGUILayout.LabelField("Trigger Ability", headerStyle); srlPpt = serializedObject.FindProperty("abilityID"); int abID = TDSEditor.GetAbilityIndex(srlPpt.intValue); EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = srlPpt.hasMultipleDifferentValues; cont = new GUIContent(" - Trigger Ability:", "The ability to activate when triggered"); EditorGUILayout.LabelField(cont, GUILayout.MaxWidth(labelWidth)); contL = new GUIContent[abilityLabel.Length]; for (int i = 0; i < contL.Length; i++) { contL[i] = new GUIContent(abilityLabel[i]); } abID = EditorGUILayout.Popup(abID, contL, GUILayout.MaxWidth(fieldWidthL)); if (EditorGUI.EndChangeCheck()) { srlPpt.intValue = abID - 1; } EditorGUI.showMixedValue = false; EditorGUILayout.EndHorizontal(); } else { EditorGUILayout.LabelField("Instant Gain", headerStyle); srlPpt = serializedObject.FindProperty("life"); EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = srlPpt.hasMultipleDifferentValues; cont = new GUIContent("Life:", "The amount of respawn gained by the player"); EditorGUILayout.LabelField(cont, GUILayout.MaxWidth(labelWidth)); int life = EditorGUILayout.IntField(srlPpt.intValue, GUILayout.MaxWidth(fieldWidth)); if (EditorGUI.EndChangeCheck()) { srlPpt.intValue = life; } EditorGUI.showMixedValue = false; EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); cont = new GUIContent("HitPoint:", "The amount of hit-point gained by the player"); PropertyField(serializedObject.FindProperty("hitPoint"), cont); cont = new GUIContent("Energy:", "The amount of energy gained by the player"); PropertyField(serializedObject.FindProperty("energy"), cont); EditorGUILayout.Space(); cont = new GUIContent("Score:", "The amount of points gained by the player"); PropertyField(serializedObject.FindProperty("score"), cont); EditorGUILayout.Space(); cont = new GUIContent("Ammo:", "The amount of ammo gained by the player. If set as -1, the ammo count will be refilled to full"); PropertyField(serializedObject.FindProperty("ammo"), cont); cont = new GUIContent("Weapon:", "The weapon in which the ammo gain of the collectible is intended for."); if (serializedObject.FindProperty("ammo").intValue != 0) { weaponLabel[0] = "All Weapons"; srlPpt = serializedObject.FindProperty("ammoID"); int weaponIdx = TDSEditor.GetWeaponIndex(srlPpt.intValue); //Weapon weapon=weaponIdx>0 ? weaponDB.weaponList[weaponIdx-1] : null ; //if(weapon!=null) // TDSEditorUtility.DrawSprite(new Rect(startX+spaceX+width-40, startY+spaceY-45, 40, 40), weapon!=null ? weapon.icon : null); EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = srlPpt.hasMultipleDifferentValues; EditorGUILayout.LabelField(cont, GUILayout.MaxWidth(labelWidth)); weaponIdx = EditorGUILayout.Popup(weaponIdx, weaponLabel, GUILayout.MaxWidth(fieldWidthL)); if (EditorGUI.EndChangeCheck()) { if (weaponIdx > 0) { srlPpt.intValue = weaponDB.weaponList[weaponIdx - 1].ID; } else { srlPpt.intValue = -1; } } EditorGUI.showMixedValue = false; EditorGUILayout.EndHorizontal(); weaponLabel[0] = "Unassigned"; } else { InvalidField(cont); } EditorGUILayout.Space(); cont = new GUIContent("Experience:", "The amount of experience gained by the player"); PropertyField(serializedObject.FindProperty("exp"), cont); cont = new GUIContent("Perk Currency:", "The amount of perk currency gained by the player"); PropertyField(serializedObject.FindProperty("perkCurrency"), cont); EditorGUILayout.Space(); srlPpt = serializedObject.FindProperty("effectID"); int effectIdx = srlPpt.intValue >= 0 ? TDSEditor.GetEffectIndex(srlPpt.intValue) : 0; EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = srlPpt.hasMultipleDifferentValues; cont = new GUIContent("Triggered Effect:", "Special effect that applies on target when triggered (optional)"); EditorGUILayout.LabelField(cont, GUILayout.MaxWidth(labelWidth)); effectIdx = EditorGUILayout.Popup(effectIdx, effectLabel, GUILayout.MaxWidth(fieldWidthL)); if (EditorGUI.EndChangeCheck()) { if (effectIdx > 0) { srlPpt.intValue = effectDB.effectList[effectIdx - 1].ID; } else { srlPpt.intValue = -1; } } EditorGUI.showMixedValue = false; EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); srlPpt = serializedObject.FindProperty("gainWeapon"); cont = new GUIContent("Gain Weapon:", "Weapon gained by player upon triggered (optional)"); PropertyField(srlPpt, cont); bool gainWeapon = srlPpt.boolValue; if (gainWeapon) { srlPpt = serializedObject.FindProperty("weaponType"); int wType = TDSEditor.GetWeaponIndex(srlPpt.enumValueIndex); EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = srlPpt.hasMultipleDifferentValues; cont = new GUIContent(" - GainWeaponType:", "What the new weapon is for"); EditorGUILayout.LabelField(cont, GUILayout.MaxWidth(labelWidth)); contL = new GUIContent[weaponTypeLabel.Length]; for (int i = 0; i < contL.Length; i++) { contL[i] = new GUIContent(weaponTypeLabel[i], weaponTypeTooltip[i]); } wType = EditorGUILayout.Popup(wType, contL, GUILayout.MaxWidth(fieldWidthL)); if (EditorGUI.EndChangeCheck()) { srlPpt.enumValueIndex = wType; } EditorGUI.showMixedValue = false; EditorGUILayout.EndHorizontal(); cont = new GUIContent(" - Duration:", "The duration of the temporary weapon. Set to -1 for not time limit (limit by weapon ammo instead)"); if (srlPpt.enumValueIndex == (int)Collectible._WeaponType.Temporary) { PropertyField(serializedObject.FindProperty("tempWeapDuration"), cont); } else { InvalidField(cont); } cont = new GUIContent(" - Random Weapon:", "Check if player will get random weapon out of a few potential candidates"); PropertyField(serializedObject.FindProperty("randomWeapon"), cont); bool randWeapon = serializedObject.FindProperty("randomWeapon").boolValue; if (randWeapon) { SerializedProperty enableAllWP = serializedObject.FindProperty("enableAllWeapon"); EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = enableAllWP.hasMultipleDifferentValues; cont = new GUIContent(" - EnableAllWeapon:", "Check if all weapon in the database are to be added to the random pool"); EditorGUILayout.LabelField(cont, GUILayout.MaxWidth(labelWidth)); bool en = EditorGUILayout.Toggle(enableAllWP.boolValue, GUILayout.MaxWidth(fieldWidthS + 25)); if (EditorGUI.EndChangeCheck()) { enableAllWP.boolValue = en; if (en) { showWeaponList = true; } } //~ PropertyField(serializedObject.FindProperty("enableAllWeapon"), cont); GUIStyle notSelectedStyle = new GUIStyle("Label"); notSelectedStyle.normal.textColor = new Color(.2f, .2f, .2f, 1); SpaceH(22); bool enableAllWeapon = serializedObject.FindProperty("enableAllWeapon").boolValue; if (enableAllWeapon) { showWeaponList = EditorGUILayout.Foldout(showWeaponList, "Show list"); } EditorGUILayout.EndHorizontal(); if (enableAllWeapon && showWeaponList) { srlPpt = serializedObject.FindProperty("weaponList"); if (!serializedObject.isEditingMultipleObjects) { int enabledCount = 0; for (int i = 0; i < weaponDB.weaponList.Count; i++) { Weapon weapon = weaponDB.weaponList[i]; bool enabled = false; for (int n = 0; n < srlPpt.arraySize; n++) { SerializedProperty elePpt = srlPpt.GetArrayElementAtIndex(n); if (elePpt.objectReferenceValue == (UnityEngine.Object)weapon) { enabled = true; break; } } bool enabledCached = enabled; EditorGUILayout.BeginHorizontal(); cont = new GUIContent(" - " + weapon.weaponName, weapon.desp); if (enabled) { EditorGUILayout.LabelField(cont, GUILayout.MaxWidth(labelWidth + 50)); } else { EditorGUILayout.LabelField(cont, notSelectedStyle, GUILayout.MaxWidth(labelWidth + 50)); } enabled = EditorGUILayout.Toggle(enabled); EditorGUILayout.EndHorizontal(); //TDSEditorUtility.DrawSprite(new Rect(startX+20, startY+=spaceY, 30, 30), weapon.icon, weapon.desp); //~ cont=new GUIContent(weapon.weaponName, weapon.desp); //~ EditorGUI.LabelField(new Rect(startX+65, startY+15, width, height), cont); //~ enabled=EditorGUI.Toggle(new Rect(startX+spaceX+width-15, startY+15, width, height), enabled); //~ startY+=14; if (enabled != enabledCached) { if (enabled) { srlPpt.InsertArrayElementAtIndex(enabledCount); SerializedProperty elePpt = srlPpt.GetArrayElementAtIndex(enabledCount); elePpt.objectReferenceValue = weapon; } else { srlPpt.DeleteArrayElementAtIndex(enabledCount); } } if (enabled) { enabledCount += 1; } } } else { EditorGUILayout.LabelField(" - Cannot edit multiple instance"); } } } else { srlPpt = serializedObject.FindProperty("weaponList"); while (srlPpt.arraySize > 1) { srlPpt.DeleteArrayElementAtIndex(srlPpt.arraySize - 1); } while (srlPpt.arraySize <= 0) { srlPpt.InsertArrayElementAtIndex(0); } SerializedProperty elePpt = srlPpt.GetArrayElementAtIndex(0); int weapIdx = elePpt.objectReferenceValue != null?TDSEditor.GetWeaponIndex(((Weapon)elePpt.objectReferenceValue).ID) : 0; EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = srlPpt.hasMultipleDifferentValues; cont = new GUIContent(" - Gain Weapon:", "Weapon gained by player upon triggered (optional)"); EditorGUILayout.LabelField(cont, GUILayout.MaxWidth(labelWidth)); weapIdx = EditorGUILayout.Popup(weapIdx, weaponLabel, GUILayout.MaxWidth(fieldWidthL)); if (EditorGUI.EndChangeCheck()) { if (weapIdx > 0) { elePpt.objectReferenceValue = weaponDB.weaponList[weapIdx - 1]; } else { elePpt.objectReferenceValue = null; } } EditorGUI.showMixedValue = false; EditorGUILayout.EndHorizontal(); //~ if(cItem.weaponList.Count!=1) cItem.weaponList=new List<Weapon>{ null }; //~ int weaponIdx1=cItem.weaponList[0]!=null ? TDSEditor.GetWeaponIndex(cItem.weaponList[0].ID) : 0; //~ //if(cItem.weaponList[0]!=null) //~ // TDSEditorUtility.DrawSprite(new Rect(startX+spaceX+width-40, startY+spaceY-41, 40, 40), cItem.weaponList[0].icon); //~ cont=new GUIContent("Gain Weapon:", "Weapon gained by player upon triggered (optional)"); //~ EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont); //~ weaponIdx1=EditorGUI.Popup(new Rect(startX+spaceX, startY, width, height), weaponIdx1, weaponLabel); //~ if(weaponIdx1>0) cItem.weaponList[0]=weaponDB.weaponList[weaponIdx1-1]; //~ else cItem.weaponList[0]=null; } } } EditorGUILayout.Space(); EditorGUILayout.LabelField("Miscellaneous", headerStyle); srlPpt = serializedObject.FindProperty("triggerEffectObj"); EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = srlPpt.hasMultipleDifferentValues; cont = new GUIContent("Triggered Effect Obj:", "The object to be spawned when the collectible is triggered (optional)"); EditorGUILayout.LabelField(cont, GUILayout.MaxWidth(labelWidth)); GameObject sObj = (GameObject)EditorGUILayout.ObjectField(srlPpt.objectReferenceValue, typeof(GameObject), false, GUILayout.MaxWidth(fieldWidthL)); if (EditorGUI.EndChangeCheck()) { srlPpt.objectReferenceValue = sObj; } EditorGUI.showMixedValue = false; EditorGUILayout.EndHorizontal(); cont = new GUIContent("AutoDestroy Effect:", "Check if the effect object needs to be removed from the game"); if (srlPpt.objectReferenceValue != null) { PropertyField(serializedObject.FindProperty("autoDestroyEffectObj"), cont); } else { InvalidField(cont); } cont = new GUIContent(" - Duration:", "The delay in seconds before the effect object is destroyed"); if (srlPpt.objectReferenceValue != null && serializedObject.FindProperty("autoDestroyEffectObj").boolValue) { PropertyField(serializedObject.FindProperty("effectObjActiveDuration"), cont); } else { InvalidField(cont); } EditorGUILayout.Space(); cont = new GUIContent("Triggered SFX:", "Audio clip to play when the collectible is triggered (optional)"); PropertyFieldL(serializedObject.FindProperty("triggerSFX"), cont); EditorGUILayout.Space(); cont = new GUIContent("Self Destruct:", "Check if the item is to self-destruct if not collected in a set time frame"); srlPpt = serializedObject.FindProperty("selfDestruct"); PropertyField(srlPpt, cont); //~ EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); //~ EditorGUI.showMixedValue=srlPpt.hasMultipleDifferentValues; //~ cont=new GUIContent("Self Destruct:", "Check if the item is to self-destruct if not collected in a set time frame"); //~ EditorGUILayout.LabelField(cont); //~ bool flag=EditorGUILayout.Toggle(srlPpt.boolValue); //~ if(EditorGUI.EndChangeCheck()) srlPpt.boolValue=flag; //~ EditorGUI.showMixedValue=false; EditorGUILayout.EndHorizontal(); //~ cont=new GUIContent("Active Duration:", "How long the item will stay active before it self destruct"); //~ if(srlPpt.boolValue) PropertyField(serializedObject.FindProperty("selfDestructDuration"), cont); //~ else InvalidField(cont); EditorGUILayout.Space(); cont = new GUIContent("BlinkBeforeDestruct:", "Blink to give player warning before the object self-destruct"); if (srlPpt.boolValue) { PropertyField(serializedObject.FindProperty("blinkBeforeDestroy"), cont); } else { InvalidField(cont); } cont = new GUIContent("Blink Duration:", "The long the item is gong to blink for"); if (srlPpt.boolValue && serializedObject.FindProperty("blinkBeforeDestroy").boolValue) { PropertyField(serializedObject.FindProperty("blinkDuration"), cont); } else { InvalidField(cont); } cont = new GUIContent("Blink Object: ", "The mesh object to blink (The system will deactivate/activate the blink object for blinking. we only need to deactivate the child object and contain the mesh, not the whole item)"); if (srlPpt.boolValue && serializedObject.FindProperty("blinkBeforeDestroy").boolValue) { if (serializedObject.isEditingMultipleObjects) { EditorGUILayout.LabelField(cont, new GUIContent("Cannot edit multiple instance")); } else { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(cont, GUILayout.MaxWidth(labelWidth)); int objID = GetObjectIDFromHList(instance.GetBlinkObjT(), objHList); objID = EditorGUILayout.Popup(objID, objHLabelList, GUILayout.MaxWidth(fieldWidthL)); instance.blinkObj = (objHList[objID] == null) ? null : objHList[objID]; EditorGUILayout.EndHorizontal(); } } else { InvalidField(cont); } serializedObject.ApplyModifiedProperties(); }
Vector2 DrawCollectibleConfigurator(float startX, float startY, Collectible cItem) { //float cachedX=startX; //float cachedY=startY; TDSEditorUtility.DrawSprite(new Rect(startX, startY, 60, 60), cItem.icon); startX += 65; float offsetY = TDSEditor.IsPrefab(cItem.gameObject) ? 5 : 0; cont = new GUIContent("Name:", "The collectible name to be displayed in game"); EditorGUI.LabelField(new Rect(startX, startY += offsetY, width, height), cont); cItem.collectibleName = EditorGUI.TextField(new Rect(startX + spaceX - 65, startY, width - 5, height), cItem.collectibleName); cont = new GUIContent("Icon:", "The collectible icon to be displayed in game, must be a sprite"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); cItem.icon = (Sprite)EditorGUI.ObjectField(new Rect(startX + spaceX - 65, startY, width - 5, height), cItem.icon, typeof(Sprite), false); cont = new GUIContent("Prefab:", "The prefab object of the unit\nClick this to highlight it in the ProjectTab"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); EditorGUI.ObjectField(new Rect(startX + spaceX - 65, startY, width - 5, height), cItem.gameObject, typeof(GameObject), false); startX -= 65; startY += spaceY; //cachedY=startY; int type = (int)cItem.type; cont = new GUIContent("Target Type:", "The target which the collectible affects when triggered"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); contL = new GUIContent[collectTypeLabel.Length]; for (int i = 0; i < contL.Length; i++) { contL[i] = new GUIContent(collectTypeLabel[i], collectTypeTooltip[i]); } type = EditorGUI.Popup(new Rect(startX + spaceX, startY, width, 15), new GUIContent(""), type, contL); cItem.type = (_CollectType)type; startY += 10; if (cItem.type == _CollectType.Ability) { int abID = (int)cItem.abilityID; cont = new GUIContent(" - Trigger Ability:", "The ability to activate when triggered"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); contL = new GUIContent[abilityLabel.Length]; for (int i = 0; i < contL.Length; i++) { contL[i] = new GUIContent(abilityLabel[i]); } abID = EditorGUI.Popup(new Rect(startX + spaceX, startY, width, 15), new GUIContent(""), abID, contL); cItem.abilityID = abID; } else if (cItem.type == _CollectType.Self) { EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), "Instant Gain", headerStyle); cont = new GUIContent("Life:", "The amount of respawn gained by the player"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); cItem.life = EditorGUI.IntField(new Rect(startX + spaceX, startY, 40, height), cItem.life); startY += 10; cont = new GUIContent("HitPoint:", "The amount of hit-point gained by the player"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); cItem.hitPoint = EditorGUI.FloatField(new Rect(startX + spaceX, startY, 40, height), cItem.hitPoint); cont = new GUIContent("Energy:", "The amount of energy gained by the player"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); cItem.energy = EditorGUI.FloatField(new Rect(startX + spaceX, startY, 40, height), cItem.energy); startY += 10; //cont=new GUIContent("Credits:", "The amount of credist gained by the player"); //EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont); //cItem.credit=EditorGUI.IntField(new Rect(startX+spaceX, startY, 40, height), cItem.credit); cont = new GUIContent("Score:", "The amount of points gained by the player"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); cItem.score = EditorGUI.IntField(new Rect(startX + spaceX, startY, 40, height), cItem.score); startY += 10; cont = new GUIContent("Ammo:", "The amount of ammo gained by the player. If set as -1, the ammo count will be refilled to full"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); cItem.ammo = EditorGUI.IntField(new Rect(startX + spaceX, startY, 40, height), cItem.ammo); if (cItem.ammo != 0) { startY += 5; weaponLabel[0] = "All Weapons"; int weaponIdx = TDSEditor.GetWeaponIndex(cItem.ammoID); Weapon weapon = weaponIdx > 0 ? weaponDB.weaponList[weaponIdx - 1] : null; if (weapon != null) { TDSEditorUtility.DrawSprite(new Rect(startX + spaceX + width - 40, startY + spaceY - 45, 40, 40), weapon != null ? weapon.icon : null); } cont = new GUIContent(" - Weapon:", "The weapon in which the ammo gain of the collectible is intended for."); EditorGUI.LabelField(new Rect(startX, startY += spaceY - 5, width, height), cont); weaponIdx = EditorGUI.Popup(new Rect(startX + spaceX, startY, width, height), weaponIdx, weaponLabel); if (weaponIdx > 0) { cItem.ammoID = weaponDB.weaponList[weaponIdx - 1].ID; } else { cItem.ammoID = -1; } weaponLabel[0] = "Unassigned"; } else { cont = new GUIContent("Weapon:", "The weapon in which the ammo gain of the collectible is intended for."); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); EditorGUI.LabelField(new Rect(startX + spaceX, startY, width, height), "-"); } startY += 10; cont = new GUIContent("Experience:", "The amount of experience gained by the player."); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); cItem.exp = EditorGUI.IntField(new Rect(startX + spaceX, startY, 40, height), cItem.exp); cont = new GUIContent("Perk Currency:", "The amount of perk currency gained by the player."); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); cItem.perkCurrency = EditorGUI.IntField(new Rect(startX + spaceX, startY, 40, height), cItem.perkCurrency); startY += 55; //int effectIdx=cItem.effect==null ? 0 : TDSEditor.GetEffectIndex(cItem.effect.ID); //if(effectIdx==0) cItem.effect=null; int effectIdx = cItem.effectID >= 0 ? TDSEditor.GetEffectIndex(cItem.effectID) : 0; TDSEditorUtility.DrawSprite(new Rect(startX + spaceX + width - 40, startY + spaceY - 45, 40, 40), effectIdx > 0 ? effectDB.effectList[effectIdx - 1].icon : null); if (GUI.Button(new Rect(startX + spaceX, startY - 2, 40, height - 2), "Edit ")) { EffectEditorWindow.Init(); } cont = new GUIContent("Triggered Effect:", "Special effect that applies on target when triggered (optional)"); EditorGUI.LabelField(new Rect(startX, startY += spaceY - 5, width, height), cont, headerStyle); effectIdx = EditorGUI.Popup(new Rect(startX + spaceX, startY, width, height), effectIdx, effectLabel); if (effectIdx > 0) { cItem.effectID = effectDB.effectList[effectIdx - 1].ID; } else { cItem.effectID = -1; } //if(effectIdx>0) cItem.effect=effectDB.effectList[effectIdx-1]; //else cItem.effect=null; startY += 10; cont = new GUIContent("Gain Weapon:", "Weapon gained by player upon triggered (optional)"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont, headerStyle); cItem.gainWeapon = EditorGUI.Toggle(new Rect(startX + spaceX, startY, 30, height), cItem.gainWeapon); if (cItem.gainWeapon) { type = (int)cItem.weaponType; cont = new GUIContent(" - GainWeaponType:", "What the new weapon is for"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); contL = new GUIContent[weaponTypeLabel.Length]; for (int i = 0; i < contL.Length; i++) { contL[i] = new GUIContent(weaponTypeLabel[i], weaponTypeTooltip[i]); } type = EditorGUI.Popup(new Rect(startX + spaceX, startY, width, 15), new GUIContent(""), type, contL); cItem.weaponType = (Collectible._WeaponType)type; cont = new GUIContent(" - Duration:", "The duration of the temporary weapon. Set to -1 for not time limit (limit by weapon ammo instead)"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); if (cItem.weaponType == Collectible._WeaponType.Temporary) { cItem.tempWeapDuration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, 40, height), cItem.tempWeapDuration); } else { EditorGUI.LabelField(new Rect(startX + spaceX, startY, 40, height), "-"); } cont = new GUIContent(" - Random Weapon:", "Check if player will get random weapon out of a few potential candidates"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); cItem.randomWeapon = EditorGUI.Toggle(new Rect(startX + spaceX, startY, 30, height), cItem.randomWeapon); if (cItem.randomWeapon) { cont = new GUIContent(" - EnableAllWeapon:", "Check if all weapon in the database are to be added to the random pool"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); cItem.enableAllWeapon = EditorGUI.Toggle(new Rect(startX + spaceX, startY, 30, height), cItem.enableAllWeapon); if (!cItem.enableAllWeapon) { int enabledCount = 0; for (int i = 0; i < weaponDB.weaponList.Count; i++) { Weapon weapon = weaponDB.weaponList[i]; bool enabled = cItem.weaponList.Contains(weapon); bool enabledCached = enabled; TDSEditorUtility.DrawSprite(new Rect(startX + 20, startY += spaceY, 30, 30), weapon.icon, weapon.desp); cont = new GUIContent(weapon.weaponName, weapon.desp); EditorGUI.LabelField(new Rect(startX + 65, startY + 15, width, height), cont); enabled = EditorGUI.Toggle(new Rect(startX + spaceX + width - 15, startY + 15, width, height), enabled); startY += 14; if (enabled != enabledCached) { if (enabled) { cItem.weaponList.Insert(enabledCount, weapon); } else { cItem.weaponList.Remove(weapon); } } if (enabled) { enabledCount += 1; } } } } else { if (cItem.weaponList.Count != 1) { cItem.weaponList = new List <Weapon> { null } } ; int weaponIdx1 = cItem.weaponList[0] != null?TDSEditor.GetWeaponIndex(cItem.weaponList[0].ID) : 0; if (cItem.weaponList[0] != null) { TDSEditorUtility.DrawSprite(new Rect(startX + spaceX + width - 40, startY + spaceY - 41, 40, 40), cItem.weaponList[0].icon); } cont = new GUIContent(" - Weapon Gained:", "Weapon gained by player upon triggered (optional)"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); weaponIdx1 = EditorGUI.Popup(new Rect(startX + spaceX, startY, width, height), weaponIdx1, weaponLabel); if (weaponIdx1 > 0) { cItem.weaponList[0] = weaponDB.weaponList[weaponIdx1 - 1]; } else { cItem.weaponList[0] = null; } } } } else { //if(cItem.type==_CollectType.AOEHostile){ //cont=new GUIContent("AOE Range:", ""); //EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont); //cItem.aoeRange=EditorGUI.FloatField(new Rect(startX+spaceX, startY, 40, height), cItem.aoeRange); //} Vector2 v2 = DrawAttackStats1(startX, startY + spaceY, cItem.aStats, cItem.type == _CollectType.AOEHostile, cItem.type == _CollectType.AOEHostile); startY = v2.y; } startY += 20; EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), "Miscellaneous", headerStyle); cont = new GUIContent("Triggered Effect Obj:", "The object to be spawned when the collectible is triggered (optional)"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); cItem.triggerEffectObj = (GameObject)EditorGUI.ObjectField(new Rect(startX + spaceX, startY, width, height), cItem.triggerEffectObj, typeof(GameObject), false); cont = new GUIContent("AutoDestroy Effect:", "Check if the effect object needs to be removed from the game"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); if (cItem.triggerEffectObj != null) { cItem.autoDestroyEffectObj = EditorGUI.Toggle(new Rect(startX + spaceX, startY, 40, height), cItem.autoDestroyEffectObj); if (cItem.autoDestroyEffectObj) { cont = new GUIContent(" - Duration:", "The delay in seconds before the effect object is destroyed"); EditorGUI.LabelField(new Rect(startX + spaceX + 15, startY, width, height), cont); cItem.effectObjActiveDuration = EditorGUI.FloatField(new Rect(startX + spaceX + width - 58, startY, 40, height), cItem.effectObjActiveDuration); } } else { EditorGUI.LabelField(new Rect(startX + spaceX, startY, 40, height), "-"); } startY += 5; cont = new GUIContent("Triggered SFX:", "Audio clip to play when the collectible is triggered (optional)"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); cItem.triggerSFX = (AudioClip)EditorGUI.ObjectField(new Rect(startX + spaceX, startY, width, height), cItem.triggerSFX, typeof(AudioClip), false); startY += 10; cont = new GUIContent("Self Destruct:", "Check if the item is to self-destruct if not collected in a set time frame"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); cItem.selfDestruct = EditorGUI.Toggle(new Rect(startX + spaceX, startY, 40, height), cItem.selfDestruct); cont = new GUIContent("Active Duration:", "How long the item will stay active before it self destruct"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); if (cItem.selfDestruct) { cItem.selfDestructDuration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, 40, height), cItem.selfDestructDuration); } else { EditorGUI.LabelField(new Rect(startX + spaceX, startY, 40, height), "-"); } startY += 5; cont = new GUIContent("BlinkBeforeDestruct:", "Blink to give player warning before the object self-destruct"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); if (cItem.selfDestruct) { cItem.blinkBeforeDestroy = EditorGUI.Toggle(new Rect(startX + spaceX, startY, 40, height), cItem.blinkBeforeDestroy); } else { EditorGUI.LabelField(new Rect(startX + spaceX, startY, 40, height), "-"); } cont = new GUIContent("Blink Duration:", "The long the item is gong to blink for"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); if (cItem.selfDestruct && cItem.blinkBeforeDestroy) { cItem.blinkDuration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, 40, height), cItem.blinkDuration); } else { EditorGUI.LabelField(new Rect(startX + spaceX, startY, 40, height), "-"); } int objID = cItem.blinkObj == null ? 0 : GetObjectIDFromHList(cItem.blinkObj.transform, objHList); cont = new GUIContent("Blink Object: ", "The mesh object to blink (The system will deactivate/activate the blink object for blinking. we only need to deactivate the child object and contain the mesh, not the whole item)"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); if (cItem.selfDestruct && cItem.blinkBeforeDestroy) { objID = EditorGUI.Popup(new Rect(startX + spaceX, startY, width, height), objID, objHLabelList); cItem.blinkObj = (objHList[objID] == null) ? null : objHList[objID]; } else { EditorGUI.LabelField(new Rect(startX + spaceX, startY, 40, height), "-"); } startY += 15; GUIStyle style = new GUIStyle("TextArea"); style.wordWrap = true; cont = new GUIContent("Item description (to be used in runtime): ", ""); EditorGUI.LabelField(new Rect(startX, startY += spaceY, 400, 20), cont); cItem.desp = EditorGUI.TextArea(new Rect(startX, startY + spaceY - 3, 270, 150), cItem.desp, style); return(new Vector2(startX, startY + 200)); }
//not in used, wip /* * protected Vector2 DrawAttackStats(string propertyName, float startX, float startY, SerializedObject aStats, bool showAOE=true, bool showPhysics=true, string label="Attack Stats"){ * * EditorGUI.LabelField(new Rect(startX, startY, width+50, height), label, headerStyle); startY+=spaceY; * * string pf="attackStats."; * //SerializedProperty spas= aStats.FindProperty("attackStats"); * SerializedProperty spas= aStats.FindProperty(propertyName); * string lbSp=" - "; * * cont=new GUIContent(lbSp+"Damage Type:", "The damage type of the unit\nDamage type can be configured in Damage Armor Table Editor"); * EditorGUI.LabelField(new Rect(startX, startY, width, height), cont); * if(damageTypeLabel.Length>0){ * srlPpt=spas.FindPropertyRelative("damageType"); * EditorGUI.showMixedValue=srlPpt.hasMultipleDifferentValues; * //Debug.Log(srlPpt.intValue+" "+srlPpt.hasMultipleDifferentValues); * EditorGUI.BeginChangeCheck(); * int value=EditorGUI.Popup(new Rect(startX+spaceX, startY, width, height), srlPpt.intValue, damageTypeLabel); * if(EditorGUI.EndChangeCheck()) srlPpt.intValue=value; * EditorGUI.showMixedValue=false; * * //aStats.damageType=EditorGUI.Popup(new Rect(startX+spaceX, startY, width, height), aStats.damageType, damageTypeLabel); * } * else{ * if(GUI.Button(new Rect(startX+spaceX, startY, 83, height-2), "Add Type")) DamageTableEditorWindow.Init(); * } * * cont=new GUIContent(lbSp+"Damage (Min/Max):", "Damage value done to the target's hit-point."); * EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont); * EditorGUI.PropertyField(new Rect(startX+spaceX, startY, 40, height), aStats.FindProperty(pf+"damageMin"), contN); * EditorGUI.PropertyField(new Rect(startX+spaceX+42, startY, 40, height), aStats.FindProperty(pf+"damageMax"), contN); * * startY+=10; * * if(showAOE){ * cont=new GUIContent(lbSp+"AOE Radius:", "Area of effect radius of the attack. Any hostile unit within the area is affected by the attack"); * EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont); * EditorGUI.PropertyField(new Rect(startX+spaceX, startY, 40, height), aStats.FindProperty(pf+"aoeRadius"), contN); * * cont=new GUIContent(lbSp+"Diminishing AOE22:", "Check if damage value diminished the further away the target is from the center of the aoe"); * EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont); * if(aStats.FindProperty(pf+"aoeRadius").floatValue>0) * EditorGUI.PropertyField(new Rect(startX+spaceX, startY, 40, height), aStats.FindProperty(pf+"diminishingAOE")); * else EditorGUI.LabelField(new Rect(startX+spaceX, startY, 40, height), "-"); * * startY+=10; * } * * cont=new GUIContent(lbSp+"Critical Chance:", "The chance of the attack to score a critical. Takes value from 0-1 with 0.3 being 30% to score a critical"); * EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont); * EditorGUI.PropertyField(new Rect(startX+spaceX, startY, 40, height), aStats.FindProperty(pf+"critChance"), contN); * * cont=new GUIContent(lbSp+"Critical Multiplier:", "The multiplier to be applied to damage if the attack scores a critical.\n - 1.5 for 150% of normal damage, 2 for 200% and so on"); * EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont); * EditorGUI.PropertyField(new Rect(startX+spaceX, startY, 40, height), aStats.FindProperty(pf+"critChance"), contN); * if(aStats.FindProperty(pf+"critChance").floatValue>0) * EditorGUI.PropertyField(new Rect(startX+spaceX, startY, 40, height), aStats.FindProperty(pf+"critMultiplier"), contN); * else EditorGUI.LabelField(new Rect(startX+spaceX, startY, 40, height), "-"); * * startY+=10; * * if(showPhysics){ * cont=new GUIContent(lbSp+"Impact Force:", "If the attack will applies a knock back force to the target\nOnly applies if the attack is a direct hit from a shoot object"); * EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont); * EditorGUI.PropertyField(new Rect(startX+spaceX, startY, 40, height), aStats.FindProperty(pf+"impactForce"), contN); * * cont=new GUIContent(lbSp+"Explosion Radius:", "The radius in which all unit is affected by explosion force"); * EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont); * EditorGUI.PropertyField(new Rect(startX+spaceX, startY, 40, height), aStats.FindProperty(pf+"explosionRadius"), contN); * * cont=new GUIContent(lbSp+"Explosion Force:", "The force of the explosion which pushes all affect unit away from the impact point"); * EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont); * if(aStats.FindProperty(pf+"explosionRadius").floatValue>0) * EditorGUI.PropertyField(new Rect(startX+spaceX, startY, 40, height), aStats.FindProperty(pf+"explosionRadius"), contN); * else EditorGUI.LabelField(new Rect(startX+spaceX, startY, 40, height), "-"); * } * * startY+=30; * * srlPpt=aStats.FindProperty(pf+"effectID"); * EditorGUI.showMixedValue=srlPpt.hasMultipleDifferentValues; * int effectIdx=srlPpt.intValue>=0 ? TDSEditor.GetEffectIndex(srlPpt.intValue) : 0 ; * * if(!srlPpt.hasMultipleDifferentValues) * TDSEditorUtility.DrawSprite(new Rect(startX+spaceX+width-40, startY+spaceY-45, 40, 40), effectIdx>0 ? effectDB.effectList[effectIdx-1].icon : null); * if(GUI.Button(new Rect(startX+spaceX, startY-2, 40, height-2), "Edit")) EffectEditorWindow.Init(); * * cont=new GUIContent(lbSp+"Attack Effect:", "Special effect that applies with each hit (optional)"); * EditorGUI.LabelField(new Rect(startX, startY+=spaceY-5, width, height), cont); * * EditorGUI.BeginChangeCheck(); * effectIdx=EditorGUI.Popup(new Rect(startX+spaceX, startY, width, height), effectIdx, effectLabel); * if(EditorGUI.EndChangeCheck()){ * if(effectIdx>0) srlPpt.intValue=effectDB.effectList[effectIdx-1].ID; * else srlPpt.intValue=-1; * } * EditorGUI.showMixedValue=false; * * return new Vector2(startX, startY); * } */ protected Vector2 DrawAttackStats1(float startX, float startY, AttackStats aStats, bool showAOE = true, bool showPhysics = true, string label = "Attack Stats") { EditorGUI.LabelField(new Rect(startX, startY, width + 50, height), label, headerStyle); startY += spaceY; string lbSp = " - "; cont = new GUIContent(lbSp + "Damage Type:", "The damage type of the unit\nDamage type can be configured in Damage Armor Table Editor"); EditorGUI.LabelField(new Rect(startX, startY, width, height), cont); if (damageTypeLabel.Length > 0) { aStats.damageType = EditorGUI.Popup(new Rect(startX + spaceX, startY, width, height), aStats.damageType, damageTypeLabel); } else { if (GUI.Button(new Rect(startX + spaceX, startY, 83, height - 2), "Add Type")) { DamageTableEditorWindow.Init(); } } cont = new GUIContent(lbSp + "Damage (Min/Max):", "Damage value done to the target's hit-point."); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); aStats.damageMin = EditorGUI.FloatField(new Rect(startX + spaceX, startY, 40, height), aStats.damageMin); aStats.damageMax = EditorGUI.FloatField(new Rect(startX + spaceX + 42, startY, 40, height), aStats.damageMax); startY += 10; if (showAOE) { cont = new GUIContent(lbSp + "AOE Radius:", "Area of effect radius of the attack. Any hostile unit within the area is affected by the attack"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); aStats.aoeRadius = EditorGUI.FloatField(new Rect(startX + spaceX, startY, 40, height), aStats.aoeRadius); //used in pre-version1.2, dimishingAOE is wrongly spelt //cont=new GUIContent(lbSp+"Diminishing AOE:", "Check if damage value diminished the further away the target is from the center of the aoe"); //EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont); //if(aStats.aoeRadius>0) aStats.dimishingAOE=EditorGUI.Toggle(new Rect(startX+spaceX, startY, 40, height), aStats.dimishingAOE); //else EditorGUI.LabelField(new Rect(startX+spaceX, startY, 40, height), "-"); cont = new GUIContent(lbSp + "Diminishing AOE:", "Check if damage value diminished the further away the target is from the center of the aoe"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); if (aStats.aoeRadius > 0) { aStats.diminishingAOE = EditorGUI.Toggle(new Rect(startX + spaceX, startY, 40, height), aStats.diminishingAOE); } else { EditorGUI.LabelField(new Rect(startX + spaceX, startY, 40, height), "-"); } startY += 10; } cont = new GUIContent(lbSp + "Critical Chance:", "The chance of the attack to score a critical. Takes value from 0-1 with 0.3 being 30% to score a critical"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); aStats.critChance = EditorGUI.FloatField(new Rect(startX + spaceX, startY, 40, height), aStats.critChance); cont = new GUIContent(lbSp + "Critical Multiplier:", "The multiplier to be applied to damage if the attack scores a critical.\n - 1.5 for 150% of normal damage, 2 for 200% and so on"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); if (aStats.critChance > 0) { aStats.critMultiplier = EditorGUI.FloatField(new Rect(startX + spaceX, startY, 40, height), aStats.critMultiplier); } else { EditorGUI.LabelField(new Rect(startX + spaceX, startY, 40, height), "-"); } startY += 10; if (showPhysics) { cont = new GUIContent(lbSp + "Impact Force:", "If the attack will applies a knock back force to the target\nOnly applies if the attack is a direct hit from a shoot object"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); aStats.impactForce = EditorGUI.FloatField(new Rect(startX + spaceX, startY, 40, height), aStats.impactForce); cont = new GUIContent(lbSp + "Explosion Radius:", "The radius in which all unit is affected by explosion force"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); aStats.explosionRadius = EditorGUI.FloatField(new Rect(startX + spaceX, startY, 40, height), aStats.explosionRadius); cont = new GUIContent(lbSp + "Explosion Force:", "The force of the explosion which pushes all affect unit away from the impact point"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); if (aStats.explosionRadius > 0) { aStats.explosionForce = EditorGUI.FloatField(new Rect(startX + spaceX, startY, 40, height), aStats.explosionForce); } else { EditorGUI.LabelField(new Rect(startX + spaceX, startY, 40, height), "-"); } } startY += 30; int effectIdx = aStats.effectID >= 0 ? TDSEditor.GetEffectIndex(aStats.effectID) : 0; TDSEditorUtility.DrawSprite(new Rect(startX + spaceX + width - 40, startY + spaceY - 45, 40, 40), effectIdx > 0 ? effectDB.effectList[effectIdx - 1].icon : null); if (GUI.Button(new Rect(startX + spaceX, startY - 2, 40, height - 2), "Edit")) { EffectEditorWindow.Init(); } cont = new GUIContent(lbSp + "Attack Effect:", "Special effect that applies with each hit (optional)"); EditorGUI.LabelField(new Rect(startX, startY += spaceY - 5, width, height), cont); effectIdx = EditorGUI.Popup(new Rect(startX + spaceX, startY, width, height), effectIdx, effectLabel); if (effectIdx > 0) { aStats.effectID = effectDB.effectList[effectIdx - 1].ID; } else { aStats.effectID = -1; } return(new Vector2(startX, startY)); }
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); }
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); }