//获得技能id public int GetSkillID(ENSkillDistanceType distanceType, ENSkillLevelType levelType = ENSkillLevelType.enNone) { int skillID = 0; List <int> skillIDList = new List <int>(); foreach (var item in Self.SkillBag) { if (distanceType != ENSkillDistanceType.enNone && item.SkillTableInfo.SkillDistanceType != (int)distanceType) { continue; } if (levelType != ENSkillLevelType.enNone && item.SkillTableInfo.SkillLevelType != (int)levelType) { continue; } if (!item.IsCanFire(Self)) { continue; } skillIDList.Add(item.SkillTableInfo.ID); } if (skillIDList.Count != 0) { skillID = skillIDList[UnityEngine.Random.Range(0, skillIDList.Count)]; } return(skillID); }
public override void Deserialize(XmlNode xmlNode) { base.Deserialize(xmlNode); XmlElement xmlElement = xmlNode as XmlElement; mSkillDistanceType = FunctionalFuncBase.ChangeStrToSkillDistanceType(xmlElement.GetAttribute("DistanceType")); mSkillLevelType = FunctionalFuncBase.ChangeStrToSkillLevelType(xmlElement.GetAttribute("LevelType")); }
/* * public static bool CompareValue(string compareType, AIBaseData valueSour, string valueType, string valueTar) * { * switch (valueType) * { * case "Float": * case "Time": * return CompareValue_Float(compareType, valueSour.GetValue_Float(), float.Parse(valueTar)); * case "Bool": * return valueSour.GetValue_Bool() == (valueTar == "True" ? true : false); * } * return false; * } * public static bool CompareValue_Float(string compareType, float valueSour, float valueTar) * { * switch (compareType) * { * case "ValueLow": * return valueSour < valueTar; * case "ValueHigh": * return valueSour > valueTar; * case "Equal": * return valueSour == valueTar; * } * return false; * } * public static float OperateValue(string optType, float valueSour, float valueTar) * { * switch (optType) * { * case "Add": * return valueSour + valueTar; * case "Sub": * return valueSour - valueTar; * default: * return -1; * } * } * public static void SetValue(Actor actor, string objType, string valueName, string valueType, string setType, string value) * { * switch (objType) * { * case "Actor": * SetActorValue(actor, valueName, valueType, setType, value); * break; * case "AI": * SetAIValue(actor, valueName, valueType, setType, value); * break; * default: * break; * } * } * public static void SetActorValue(Actor actor, string valueName, string valueType, string setType, string value) * { * AIBaseData actorValue = GetActorValue(actor, valueName, valueType); * switch (setType) * { * case "Add": * case "Sub": * SetActorValue(actor, valueName, OperateValue(setType, actorValue.GetValue_Float(), float.Parse(value)).ToString()); * break; * case "None": * SetActorValue(actor, valueName, value); * break; * default: * break; * } * } * * public static void SetActorValue(Actor actor, string valueName, string value) * { * if (actor.Type == ActorType.enNPCTrap) * { * SetActorValue(actor as Trap, valueName, value); * } * else * { * switch (valueName) * { * case "HP": * if (actor.MaxHP <= int.Parse(value)) * { * actor.MaxHP = int.Parse(value); * } * actor.HP = int.Parse(value); * break; * default: * break; * } * } * * } * public static void SetActorValue(Trap actor, string valueName, string value) * { * switch (valueName) * { * case "TrapIsActive": * actor.m_trapActivate = value == "True" ? true : false; * break; * case "TrapIsAble": * actor.m_trapAble = value == "True" ? true : false; * break; * case "TrapMaxAttackCount": * actor.mMaxAttackCount = int.Parse(value); * break; * case "TrapMinAttackTime": * actor.mMinAttackTime = float.Parse(value); * break; * default: * break; * } * } * * public static void SetActorValue(Actor actor, string valueName, float value) * { * if (actor.Type == ActorType.enNPCTrap) * { * SetActorValue(actor as Trap, valueName, value); * } * switch (valueName) * { * case "HP": * actor.MaxHP = (int)value; * actor.HP = (int)value; * break; * default: * break; * } * } * public static void SetActorValue(Trap actor, string valueName, float value) * { * switch (valueName) * { * case "TrapMaxAttackCount": * actor.mMaxAttackCount = (int)value; * break; * case "TrapMinAttackTime": * actor.mMinAttackTime = value; * break; * default: * break; * } * } * public static void SetAIValue(Actor actor, string valueName, string valueType, string setType, string value) * { * AIBaseData curBaseData = actor.SelfAI.GetBaseData(valueName, valueType); * switch (setType) * { * case "Add": * curBaseData.SetValue(curBaseData.GetValue_Float() + float.Parse(value)); * break; * case "Sub": * curBaseData.SetValue(curBaseData.GetValue_Float() - float.Parse(value)); * break; * case "Reset": * curBaseData.ResetValue(); * break; * case "None": * curBaseData.SetValue(valueType, value); * break; * default: * break; * } * } * * public static AIBaseData GetValue(Actor actor, string objType, string valueName, string valueType) * { * switch (objType) * { * case "Actor": * return GetActorValue(actor, valueName, valueType); * case "AI": * return GetAIValue(actor, valueName, valueType); * } * return null; * } * public static AIBaseData GetActorValue(Actor actor, string valueName, string valueType = "Float") * { * AIBaseData tmpAiBaseData = new AIBaseData(valueName, valueType); * switch (valueName) * { * case "HPValue": * tmpAiBaseData.SetValue(actor.HP); * break; * case "HPPercent": * tmpAiBaseData.SetValue(actor.HP / actor.MaxHP); * break; * case "TargetDistance": * tmpAiBaseData.SetValue(ActorTargetManager.GetTargetDistance(actor.RealPos, actor.CurrentTarget.RealPos)); * break; * case "CurTarget": * tmpAiBaseData.SetValue(actor.CurrentTargetIsDead); * break; * } * return tmpAiBaseData; * } * public static AIBaseData GetActorValue(Trap actor, string valueName, string valueType = "Float") * { * AIBaseData tmpAiBaseData = new AIBaseData(valueName, valueType); * switch (valueName) * { * case "TrapIsActive": * tmpAiBaseData.SetValue(actor.m_trapActivate); * break; * case "TrapIsAble": * tmpAiBaseData.SetValue(actor.m_trapAble); * break; * case "TrapMaxAttackCount": * tmpAiBaseData.SetValue(actor.mMaxAttackCount); * break; * case "TrapMinAttackTime": * tmpAiBaseData.SetValue(actor.mMinAttackTime); * break; * case "IsActorTouch": * tmpAiBaseData.SetValue(actor.mEnterActorIDList.Count > 0); * break; * } * return tmpAiBaseData; * } * public static AIBaseData GetAIValue(Actor actor, string valueName, string valueType) * { * AIBaseData tmpBaseData = null; * switch (valueName) * { * case "IsInitBaseData": * tmpBaseData = new AIBaseData(valueName, valueType); * tmpBaseData.SetValue(actor.SelfAI.mIsInitBaseData); * break; * case "BattleStartTime": * tmpBaseData = new AIBaseData(valueName, valueType); * tmpBaseData.SetValue(Time.time - actor.SelfAI.m_baseDataDic[valueType].GetValue_Float()); * break; * default: * tmpBaseData = actor.SelfAI.GetBaseData(valueName,valueType); * break; * } * return tmpBaseData; * } * public static AIBaseData GetAIValue(Actor actor, string valueName, ValueType valueType) * { * AIBaseData tmpBaseData = null; * * return tmpBaseData; * } */ public static ENSkillDistanceType ChangeStrToSkillDistanceType(string distanceType) { ENSkillDistanceType tmpDistanceType = ENSkillDistanceType.enNone; switch (distanceType) { case "Far": tmpDistanceType = ENSkillDistanceType.enFar; break; case "Near": tmpDistanceType = ENSkillDistanceType.enNear; break; case "Middle": tmpDistanceType = ENSkillDistanceType.enMiddle; break; default: break; } return(tmpDistanceType); }
public static int GetSkillID(Actor actor, ENSkillDistanceType disType, ENSkillLevelType levelType) { int skillId = ((AINpcBoss)actor.SelfAI).GetSkillID(disType, levelType); return(skillId); }