/// <summary> /// 击飞效果; /// </summary> private void HitOut(CombatUnitController unit, CombatUnitController attacker, SkillEffectData effect) { if (unit != null) { unit.OnHitOut(attacker, (float)effect.Para1, (float)effect.Para2); } }
/// <summary> /// 立即治疗效果; /// </summary> private void ImmedHeal(CombatUnitController unit, CombatUnitController attacker, SkillEffectData effect) { if (unit != null) { unit.OnHeal(attacker, (int)effect.Para1, effect.HitEffect); } }
/// <summary> /// 添加Buff; /// </summary> private void AddBuff(CombatUnitController unit, CombatUnitController attacker, SkillEffectData effect) { if (unit != null) { unit.OnAddBuff(attacker, (int)effect.Para1); } }
private void ExecuteEffect(SkillEffectData effect, CombatUnitController unit, CombatUnitController attacker) { switch ((SkillEffectTypes)effect.Type) { case SkillEffectTypes.ImmedDamage: ImmedDamage(unit, attacker, effect); break; case SkillEffectTypes.ImmedHeal: ImmedHeal(unit, attacker, effect); break; case SkillEffectTypes.AddBuff: AddBuff(unit, attacker, effect); break; case SkillEffectTypes.Sneer: Sneer(unit, attacker); break; case SkillEffectTypes.HitDown: HitDown(unit, attacker, effect); break; case SkillEffectTypes.HitOut: HitOut(unit, attacker, effect); break; default: break; } }
/// <summary> /// 击中目标; /// </summary> public void HitTarget(GameObject target, int skillEffectIndex = -1) { if (m_SkillCaster == null || target == null) { return; } CombatUnitController attacker = m_SkillCaster.GetComponent <CombatUnitController>(); CombatUnitController unit = target.GetComponent <CombatUnitController>(); if (skillEffectIndex == -1) { for (int i = 0; i < EffectList.Count; i++) { SkillEffectData effect = EffectList[i]; ExecuteEffect(effect, unit, attacker); } } else { if (skillEffectIndex >= 0 && skillEffectIndex < EffectList.Count) { SkillEffectData effect = EffectList[skillEffectIndex]; ExecuteEffect(effect, unit, attacker); } } }
public static SkillEffectData EditSkillEffectData(SkillEffectData data) { EditorGUILayout.BeginHorizontal(); data.SkillEffect = EditAssetObject <SkillEffectSystem, SkillEffect, SkillEffectSystem.AssetObject>(SkillEffectSystem.Instance, data.SkillEffect); data.Multiple = EditorGUILayout.FloatField(data.Multiple); EditorGUILayout.EndHorizontal(); return(data); }
public void CreateNewSkill(string skillName, string description, int[] listIdSkillEffect, float timeUsed, float timeCooldown, int mpUsed, int levelSkill) { SkillEffectData[] listSkillEffect = new SkillEffectData[listIdSkillEffect.Length]; for (int i = 0; i < listIdSkillEffect.Length; i++) { listSkillEffect[i] = skillEffectManager.GetSkillEffect(listIdSkillEffect[i]); } skillManager.CreateNewSkill(skillName, description, listSkillEffect, timeUsed, timeCooldown, mpUsed, levelSkill); }
private void Attack(CharacterBattleData player, SkillEffectData skill) { lock (syncLock) { Console.SetCursorPosition(width / 2 - 20, cursorTop); Console.WriteLine("Player {0} get {1} damage\n", player.characterProperties.characterName, skill.effectValue); cursorTop = Console.CursorTop; } }
public SkillEffectData Clone() { SkillEffectData data = new SkillEffectData(); data.id = id; data.typeAction = typeAction; data.typeEffect = typeEffect; data.effectValue = effectValue; data.ratioSuccess = ratioSuccess; return(data); }
public bool canUseThisSkillOnThisType(Monster target) { for (int i = 0; i < totalEffectNum; ++i) { if (SkillEffectData.checkApplyTargetType(this, target, skillEffects[i].type) == false) { continue; } return(true); } return(false); }
public SkillEffectData Clone() { SkillEffectData data = new SkillEffectData(); data.id = id; data.typeAction = typeAction; data.typeEffect = typeEffect; data.levelSkillEffect = levelSkillEffect; data.effectValue = effectValue; data.timeExist = timeExist; data.ratioSuccess = ratioSuccess; data.timeDistance = timeDistance; data.ratioOutbreak = ratioOutbreak; return(data); }
public void LoadSkillData() { m_SkillDataDic = new Dictionary <int, SkillData>(); string textAsset = ResourcesManager.Instance.LoadConfigXML("SkillData").text; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(textAsset); XmlNode equipXN = xmlDoc.SelectSingleNode("SkillDatas"); XmlNodeList list = equipXN.ChildNodes; if (list != null && list.Count > 0) { foreach (XmlNode node in list) { XmlElement element = node as XmlElement; if (element.Name.Equals("SkillData")) { SkillData info = new SkillData(); info.ID = CommonHelper.Str2Int(element.GetAttribute("ID")); info.Name = element.GetAttribute("Name"); info.Desc = element.GetAttribute("Desc"); info.Icon = element.GetAttribute("Icon"); info.SkillType = (SkillTypes)CommonHelper.Str2Int(element.GetAttribute("SkillType")); info.CDTime = CommonHelper.Str2Float(element.GetAttribute("CDTime")); info.HitType = (SkillHitTypes)CommonHelper.Str2Int(element.GetAttribute("HitType")); info.AttackDist = CommonHelper.Str2Float(element.GetAttribute("AttackDist")); info.HitNum = CommonHelper.Str2Int(element.GetAttribute("HitNum")); info.HitSharpType = (SkillHitSharpTypes)CommonHelper.Str2Int(element.GetAttribute("HitSharpType")); info.AttackRadius = CommonHelper.Str2Float(element.GetAttribute("AttackRadius")); info.AttackAngle = CommonHelper.Str2Float(element.GetAttribute("AttackAngle")); info.BpNeed = CommonHelper.Str2Int(element.GetAttribute("BpNeed")); XmlNodeList data = element.ChildNodes; if (data == null || data.Count < 1) { continue; } foreach (XmlNode subNode in data) { XmlElement subElement = subNode as XmlElement; if (subElement.Name.Equals("SkillEffectData")) { SkillEffectData effectData = new SkillEffectData(); effectData.ID = CommonHelper.Str2Int(subElement.GetAttribute("ID")); effectData.Type = (SkillEffectTypes)CommonHelper.Str2Int(subElement.GetAttribute("Type")); effectData.HitEffect = CommonHelper.Str2IntList(subElement.GetAttribute("HitEffect")); effectData.Para1 = CommonHelper.Str2Float(subElement.GetAttribute("Para1")); effectData.Para2 = CommonHelper.Str2Float(subElement.GetAttribute("Para2")); effectData.Para3 = CommonHelper.Str2Float(subElement.GetAttribute("Para3")); effectData.Para4 = CommonHelper.Str2Float(subElement.GetAttribute("Para4")); info.EffectList.Add(effectData); } } if (!m_SkillDataDic.ContainsKey(info.ID)) { m_SkillDataDic.Add(info.ID, info); } } } } }
/// <summary> /// 立即伤害效果; /// </summary> private void ImmedDamage(CombatUnitController unit, CombatUnitController attacker, SkillEffectData effect) { if (unit != null) { unit.OnDamaged(attacker, effect.Para1, effect.Para2, effect.Para3, effect.HitEffect); } }
public virtual void setData(List <object> l, Dictionary <string, int> k) { id = (string)l[k["ID"]]; name = (string)l[k["NAME"]]; Util.parseObject(l[k["LEVEL"]], out baseLevel, true, 0); switch ((string)l[k["SKILLTYPE"]]) { case "ATTACK": skillType = Skill.Type.ATTACK; targetType = Skill.TargetType.ENEMY; checkMissChance = true; break; case "DEBUFF": skillType = Skill.Type.DEBUFF; targetType = Skill.TargetType.ENEMY; checkMissChance = true; break; case "BUFF": skillType = Skill.Type.BUFF; targetType = Skill.TargetType.ME; checkMissChance = false; break; case "HEAL": skillType = Skill.Type.HEAL; targetType = Skill.TargetType.ME; checkMissChance = false; break; } _ti.Clear(); _tiV.Clear(); parseSuccessChance(l[k["SUCCESS_CHANCE_1"]]); parseSuccessChance(l[k["SUCCESS_CHANCE_2"]]); parseSuccessChance(l[k["SUCCESS_CHANCE_3"]]); parseSuccessChance(l[k["SUCCESS_CHANCE_4"]]); parseSuccessChance(l[k["SUCCESS_CHANCE_5"]]); int len = _ti.Count; successChance = new int[len][]; successValueType = new GameValueType.Type[len]; for (int i = 0; i < len; ++i) { successChance[i] = _ti[i]; successValueType[i] = _tiV[i]; } _ti.Clear(); _tiV.Clear(); _temp = null; Util.parseObject(l[k["EXE_TYPE"]], out exeType, true, 0); exeData = AttackData.getAttackData(exeType, l[k["E_ATTR1"]], l[k["E_ATTR2"]], l[k["E_ATTR3"]], l[k["E_ATTR4"]], l[k["E_ATTR5"]], l[k["E_ATTR6"]], l[k["E_ATTR7"]]); Util.parseObject(l[k["TARGETING_TYPE"]], out targeting, true, 0); targetAttr = null; setTargetingChecker(l, k); skillEffects = new SkillEffectData[hasSkillEffect(l[k["EFFECT_1"]], l[k["EFFECT_2"]], l[k["EFFECT_3"]], l[k["EFFECT_4"]], l[k["EFFECT_5"]])]; totalEffectNum = skillEffects.Length; #if UNITY_EDITOR if (successChance.Length < totalEffectNum) { Debug.LogError(id + " successChance error "); } if (successValueType.Length < totalEffectNum) { Debug.LogError(id + " successValueType error "); } #endif for (int i = 0; i < totalEffectNum; ++i) { int startDelay = -1; switch (i) { case 0: skillEffects[i] = SkillEffectData.getSkillEffectData(Util.objectToInt(l[k["EFFECT_1"]]), l[k["E1_ATTR1"]], l[k["E1_ATTR2"]]); if (k.ContainsKey("E1_DEALY")) { Util.parseObject(l[k["E1_DEALY"]], out startDelay, -1); if (startDelay > 0) { skillEffects[i].startDelay = ((float)startDelay * 0.001f); } } break; case 1: skillEffects[i] = SkillEffectData.getSkillEffectData(Util.objectToInt(l[k["EFFECT_2"]]), l[k["E2_ATTR1"]], l[k["E2_ATTR2"]]); if (k.ContainsKey("E2_DEALY")) { Util.parseObject(l[k["E2_DEALY"]], out startDelay, -1); if (startDelay > 0) { skillEffects[i].startDelay = ((float)startDelay * 0.001f); } } break; case 2: skillEffects[i] = SkillEffectData.getSkillEffectData(Util.objectToInt(l[k["EFFECT_3"]]), l[k["E3_ATTR1"]], l[k["E3_ATTR2"]]); if (k.ContainsKey("E3_DEALY")) { Util.parseObject(l[k["E3_DEALY"]], out startDelay, -1); if (startDelay > 0) { skillEffects[i].startDelay = ((float)startDelay * 0.001f); } } break; case 3: skillEffects[i] = SkillEffectData.getSkillEffectData(Util.objectToInt(l[k["EFFECT_4"]]), l[k["E4_ATTR1"]], l[k["E4_ATTR2"]]); if (k.ContainsKey("E4_DEALY")) { Util.parseObject(l[k["E4_DEALY"]], out startDelay, -1); if (startDelay > 0) { skillEffects[i].startDelay = ((float)startDelay * 0.001f); } } break; case 4: skillEffects[i] = SkillEffectData.getSkillEffectData(Util.objectToInt(l[k["EFFECT_5"]]), l[k["E5_ATTR1"]], l[k["E5_ATTR2"]]); if (k.ContainsKey("E5_DEALY")) { Util.parseObject(l[k["E5_DEALY"]], out startDelay, -1); if (startDelay > 0) { skillEffects[i].startDelay = ((float)startDelay * 0.001f); } } break; } skillEffects[i].skillData = this; if (skillEffects[i].type == 29) { isChangeSideSkill = true; } } description = ((string)l[k["DESCRIPTION"]]).Replace("\\n", "\n");; }
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { foreach (string asset in importedAssets) { if (!filePath.Equals(asset)) { continue; } SkillEffectData data = (SkillEffectData)AssetDatabase.LoadAssetAtPath(exportPath, typeof(SkillEffectData)); if (data == null) { data = ScriptableObject.CreateInstance <SkillEffectData> (); AssetDatabase.CreateAsset((ScriptableObject)data, exportPath); data.hideFlags = HideFlags.NotEditable; } data.sheets.Clear(); using (FileStream stream = File.Open(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { IWorkbook book = null; if (Path.GetExtension(filePath) == ".xls") { book = new HSSFWorkbook(stream); } else { book = new XSSFWorkbook(stream); } foreach (string sheetName in sheetNames) { ISheet sheet = book.GetSheet(sheetName); if (sheet == null) { Debug.LogError("[QuestData] sheet not found:" + sheetName); continue; } SkillEffectData.Sheet s = new SkillEffectData.Sheet(); s.name = sheetName; for (int i = 1; i <= sheet.LastRowNum; i++) { IRow row = sheet.GetRow(i); ICell cell = null; SkillEffectData.Param p = new SkillEffectData.Param(); cell = row.GetCell(0); p.No = (int)(cell == null ? 0 : cell.NumericCellValue); cell = row.GetCell(1); p.Texture = (int)(cell == null ? 0 : cell.NumericCellValue); cell = row.GetCell(2); p.x = (int)(cell == null ? 0 : cell.NumericCellValue); cell = row.GetCell(3); p.y = (int)(cell == null ? 0 : cell.NumericCellValue); s.list.Add(p); } data.sheets.Add(s); } } ScriptableObject obj = AssetDatabase.LoadAssetAtPath(exportPath, typeof(ScriptableObject)) as ScriptableObject; EditorUtility.SetDirty(obj); } }