public static void OpenDamageTable() { DamageArmorTableEditor.Init(); }
void EffectAttrConfigurator(UnitAbility uAB, int ID, int startX, int startY) { EffectAttr effectAttr = uAB.effectAttrs[ID]; if (GUI.Button(new Rect(startX, startY += 18, 70, 14), "Remove")) { uAB.effectAttrs.Remove(effectAttr); return; } int type = (int)effectAttr.type; cont = new GUIContent("Type:", "Type of the effect."); contList = new GUIContent[effectAttrTypeLabel.Length]; for (int i = 0; i < contList.Length; i++) { contList[i] = new GUIContent(effectAttrTypeLabel[i], effectAttrTypeTooltip[i]); } EditorGUI.LabelField(new Rect(startX, startY += 18, 200, 20), cont); type = EditorGUI.Popup(new Rect(startX + 40, startY, 80, 16), type, contList); effectAttr.type = (_EffectAttrType)type; if (effectAttr.type == _EffectAttrType.Teleport) { uAB.targetType = _AbilityTargetType.EmptyTile; uAB.requireTargetSelection = true; uAB.targetArea = _TargetArea.Default; uAB.aoeRange = 0; } else if (effectAttr.type == _EffectAttrType.SpawnUnit || effectAttr.type == _EffectAttrType.SpawnCollectible) { if (effectAttr.type == _EffectAttrType.SpawnUnit) { cont = new GUIContent("Unit To Spawn:", "The unit prefab to be used spawned"); EditorGUI.LabelField(new Rect(startX, startY += 18, 180, 20), cont); effectAttr.unit = (UnitTB)EditorGUI.ObjectField(new Rect(startX, startY += 18, 125, 17), effectAttr.unit, typeof(UnitTB), false); cont = new GUIContent("Duration:", "The effective duration in which the spawned unit will last\nSet to -ve value for the spawn to be permenant"); EditorGUI.LabelField(new Rect(startX, startY += 18, 200, 20), cont); effectAttr.duration = EditorGUI.IntField(new Rect(startX + 70, startY - 1, 50, 16), effectAttr.duration); if (effectAttr.duration == 0) { effectAttr.duration = -1; } } else if (effectAttr.type == _EffectAttrType.SpawnCollectible) { cont = new GUIContent("Collectible To Spawn:", "The collectible prefab to be used spawned"); EditorGUI.LabelField(new Rect(startX, startY += 18, 180, 20), cont); effectAttr.collectible = (CollectibleTB)EditorGUI.ObjectField(new Rect(startX, startY += 18, 125, 17), effectAttr.collectible, typeof(CollectibleTB), false); } uAB.targetType = _AbilityTargetType.EmptyTile; uAB.requireTargetSelection = true; uAB.targetArea = _TargetArea.Default; uAB.aoeRange = 0; } else if (effectAttr.type == _EffectAttrType.ChangeTargetFaction) { cont = new GUIContent("Chance:", "The chance of success. Take value from 0 to 1"); EditorGUI.LabelField(new Rect(startX, startY += 18, 200, 20), cont); effectAttr.value = EditorGUI.FloatField(new Rect(startX + 70, startY - 1, 50, 16), effectAttr.value); //~ cont=new GUIContent("Duration:", "The effective duration of the faction change"); //~ EditorGUI.LabelField(new Rect(startX, startY+=18, 200, 20), cont); //~ effectAttr.duration=EditorGUI.IntField(new Rect(startX+70, startY-1, 50, 16), effectAttr.duration); uAB.targetType = _AbilityTargetType.Hostile; uAB.requireTargetSelection = true; uAB.targetArea = _TargetArea.Default; uAB.aoeRange = 0; } else if (effectAttr.type == _EffectAttrType.HPDamage) { cont = new GUIContent("UseDefaultValue:", "Check to use the unit default attack damage value"); EditorGUI.LabelField(new Rect(startX, startY += 18, 200, 20), cont); effectAttr.useDefaultDamageValue = EditorGUI.Toggle(new Rect(startX + 107, startY - 1, 50, 16), effectAttr.useDefaultDamageValue); if (!effectAttr.useDefaultDamageValue) { cont = new GUIContent("ValueMin:", "Minimum value for the effect"); EditorGUI.LabelField(new Rect(startX, startY += 18, 200, 20), cont); effectAttr.value = EditorGUI.FloatField(new Rect(startX + 70, startY - 1, 50, 16), effectAttr.value); cont = new GUIContent("ValueMax:", "Maximum value for the effect"); EditorGUI.LabelField(new Rect(startX, startY += 18, 200, 20), cont); effectAttr.valueAlt = EditorGUI.FloatField(new Rect(startX + 70, startY - 1, 50, 16), effectAttr.valueAlt); } } else if (effectAttr.type == _EffectAttrType.HPGain || effectAttr.type == _EffectAttrType.APGain || effectAttr.type == _EffectAttrType.APDamage) { cont = new GUIContent("ValueMin:", "Minimum value for the effect"); EditorGUI.LabelField(new Rect(startX, startY += 18, 200, 20), cont); effectAttr.value = EditorGUI.FloatField(new Rect(startX + 70, startY - 1, 50, 16), effectAttr.value); effectAttr.value = Mathf.Min(effectAttr.value, effectAttr.valueAlt); cont = new GUIContent("ValueMax:", "Maximum value for the effect"); EditorGUI.LabelField(new Rect(startX, startY += 18, 200, 20), cont); effectAttr.valueAlt = EditorGUI.FloatField(new Rect(startX + 70, startY - 1, 50, 16), effectAttr.valueAlt); effectAttr.valueAlt = Mathf.Max(effectAttr.value, effectAttr.valueAlt); } else { cont = new GUIContent("Value:", "Value for the effect"); EditorGUI.LabelField(new Rect(startX, startY += 18, 200, 20), cont); effectAttr.value = EditorGUI.FloatField(new Rect(startX + 70, startY - 1, 50, 16), effectAttr.value); } //~ if(type==1){ //~ cont=new GUIContent("Range:", "Effective range of the ability in term of tile"); //~ EditorGUI.LabelField(new Rect(startX, startY+=18, 200, 20), "use Default Damage:"); //~ effect.useDefaultDamageValue=EditorGUI.Toggle(new Rect(startX+120, startY-1, 50, 16), effect.useDefaultDamageValue); //~ } //~ if(type!=2 || !effectAttr.useDefaultDamageValue){ //~ cont=new GUIContent("Range:", "Effective range of the ability in term of tile"); //~ EditorGUI.LabelField(new Rect(startX, startY+=18, 200, 20), "value:"); //~ effectAttr.value=EditorGUI.FloatField(new Rect(startX+70, startY-1, 50, 16), effectAttr.value); //~ } if (uAB.effectType == _EffectType.Debuff || uAB.effectType == _EffectType.Buff) { if (effectAttr.type != _EffectAttrType.SpawnUnit) { cont = new GUIContent("Duration:", "Effective duration of the effect in term of round"); EditorGUI.LabelField(new Rect(startX, startY += 18, 200, 20), cont); effectAttr.duration = EditorGUI.IntField(new Rect(startX + 70, startY - 1, 50, 16), effectAttr.duration); } } //~ int type=(int)effectAttr.type; //~ cont=new GUIContent("Type:", "Type of the effect"); //~ contList=new GUIContent[effectAttrTypeLabel.Length]; //~ for(int i=0; i<contList.Length; i++) contList[i]=new GUIContent(effectAttrTypeLabel[i], effectAttrTypeTooltip[i]); //~ EditorGUI.LabelField(new Rect(startX, startY+=18, 200, 20), cont); //~ type = EditorGUI.Popup(new Rect(startX+40, startY, 80, 16), type, contList); //~ effectAttr.type=(_EffectAttrType)type; if (effectAttr.type == _EffectAttrType.HPDamage) { if (damageList.Length > 0) { contList = new GUIContent[damageTooltipList.Length]; for (int i = 0; i < contList.Length; i++) { contList[i] = new GUIContent(damageList[i], damageTooltipList[i]); } cont = new GUIContent("Type:", "Damage type to be inflicted on target"); EditorGUI.LabelField(new Rect(startX, startY += 18, 200, 20), cont); effectAttr.damageType = EditorGUI.Popup(new Rect(startX + 40, startY, 80, 16), effectAttr.damageType, contList); } else { cont = new GUIContent("Type:", "No damage type has been created, use DamageArmorTableEditor to create one"); EditorGUI.LabelField(new Rect(startX, startY += 18, 200, 20), cont); if (GUI.Button(new Rect(startX + 40, startY, 80, 15), "OpenEditor")) { DamageArmorTableEditor.Init(); } } } }