public static AIBaseData GetActorCurTarget(Actor actor, string name = "") { AIBaseData tmpData = AIBaseData.CreateAIBaseData(AIBaseData.DataType.enBool); tmpData.SetBoolValue(actor.CurrentTargetIsDead); return(tmpData); }
public static AIBaseData GetActorHPPercent(Actor actor, string name = "") { AIBaseData tmpData = AIBaseData.CreateAIBaseData(); tmpData.SetFloatValue(actor.HP / actor.MaxHP); return(tmpData); }
public static AIBaseData GetActorTargetDis(Actor actor, string name = "") { AIBaseData tmpData = AIBaseData.CreateAIBaseData(); tmpData.SetFloatValue(ActorTargetManager.GetTargetDistance(actor.RealPos, actor.CurrentTarget.RealPos)); return(tmpData); }
public static AIBaseData GetActorIsInitAIDataList(Actor actor, string name = "") { AIBaseData tmpData = AIBaseData.CreateAIBaseData(AIBaseData.DataType.enBool); tmpData.SetBoolValue(actor.IsInitAIDataList); return(tmpData); }
// public void PushActorIDToList(int actorId) // { // mEnterActorIDList.Add(actorId); // } // // public void PopActorIDToList(int actorId) // { // mEnterActorIDList.Remove(actorId); // } public bool CheckAttackAction() { // if (Self.mEnterActorIDList.Count <= 0) // { // return false; // } AIBaseData curAttackCount = GetBaseData("AttackCount", AIBaseData.DataType.enInt); if (Self.mMaxAttackCount > 0) { if (curAttackCount.GetValue_Float() > Self.mMaxAttackCount) { return(false); } } AIBaseData preAttackTime = GetBaseData("PreAttackTime", AIBaseData.DataType.enTime); if (Time.time - preAttackTime.GetValue_Float() < Self.mMinAttackTime) { return(false); } Self.TrapActive = true; if (OnAttackAction()) { preAttackTime.ResetValue(); curAttackCount.SetValue(curAttackCount.GetValue_Float() + 1); } return(false); }
public static AIBaseData GetTrapIsAble(Actor actor, string name = "") { Trap tmpTrap = actor as Trap; AIBaseData tmpData = AIBaseData.CreateAIBaseData(AIBaseData.DataType.enBool); tmpData.SetBoolValue(tmpTrap.m_trapAble); return(tmpData); }
public static AIBaseData GetTrapState(Actor actor, string name = "") { Trap tmpTrap = actor as Trap; AIBaseData tmpData = AIBaseData.CreateAIBaseData(AIBaseData.DataType.enInt); tmpData.SetIntValue((int)tmpTrap.mTrapState); return(tmpData); }
public static AIBaseData GetTrapMaxAttackCount(Actor actor, string name = "") { Trap tmpTrap = actor as Trap; AIBaseData tmpData = AIBaseData.CreateAIBaseData(AIBaseData.DataType.enInt); tmpData.SetIntValue(tmpTrap.mMaxAttackCount); return(tmpData); }
public static AIBaseData GetTrapMinAttackTime(Actor actor, string name = "") { Trap tmpTrap = actor as Trap; AIBaseData tmpData = AIBaseData.CreateAIBaseData(); tmpData.SetFloatValue(tmpTrap.mMinAttackTime); return(tmpData); }
public static AIBaseData GetTrapIsActorTouch(Actor actor, string name = "") { Trap tmpTrap = actor as Trap; AIBaseData tmpData = AIBaseData.CreateAIBaseData(AIBaseData.DataType.enBool); tmpData.SetBoolValue(tmpTrap.mEnterActorIDList.Count > 0); return(tmpData); }
public AIBaseData GetBaseData(string valueName, AIBaseData.DataType valueType) { if (m_baseDataDic.ContainsKey(valueName)) { return(m_baseDataDic[valueName]); } else { AIBaseData tmpAIBaseData = AIBaseData.CreateAIBaseData(valueType); m_baseDataDic.Add(valueName, tmpAIBaseData); return(tmpAIBaseData); } }
public override bool CompareValue(CompareType comType, AIBaseData compData) { switch (comType) { case CompareType.enHigh: return(mDataIntValue > compData.mDataIntValue); case CompareType.enLow: return(mDataIntValue < compData.mDataIntValue); case CompareType.enEqual: return(mDataIntValue == compData.mDataIntValue); } return(false); }
public override void Deserialize(XmlNode xmlNode) { base.Deserialize(xmlNode); XmlElement xmlElement = xmlNode as XmlElement; mSourValueType = xmlElement.GetAttribute("SourValueType"); mSourValueName = xmlElement.GetAttribute("SourValueName"); m_funcGetSourValue = GetValueFunction(mSourValueType, mSourValueName); mTarValueType = xmlElement.GetAttribute("TarValueType"); mTarValueName = xmlElement.GetAttribute("TarValueName"); m_funcGetTarValue = GetValueFunction(mTarValueType, mTarValueName); mValueType = AIBaseData.ChangeStrToDataType(xmlElement.GetAttribute("ValueType")); mCompareType = AIBaseData.ChangeStrToCompareType(xmlElement.GetAttribute("CompareType")); mValue = AIBaseData.CreateAIBaseData(mValueType); mValue.SetValue(xmlElement.GetAttribute("Value")); }
public override void SetValue(SetType setType, AIBaseData val) { switch (setType) { case SetType.enAdd: base.SetIntValue(val.mDataIntValue + mDataIntValue); break; case SetType.enSub: base.SetIntValue(val.mDataIntValue - mDataIntValue); break; case SetType.enReset: base.ResetValue(); break; } }
public override bool Exec(Actor actor) { if (m_funcGetValue != null) { AIBaseData actorData = m_funcGetValue(actor, ""); mValue.SetValue(mSetType, actorData); m_funcSetValue(actor, mValue); } else { AIBaseData actorData = actor.SelfAI.GetBaseData(mValueName, mValueType); mValue.SetValue(mSetType, actorData); actorData.SetValue(mValue); } //FunctionalFuncBase.SetValue(actor, mObjType, mValueName, mValueType, mSetType, mValue); return(true); }
public override bool Exec(Actor actor) { bool tmpBool = false; AIBaseData sourData = null; AIBaseData tarData = null; if (m_funcGetSourValue != null) { sourData = m_funcGetSourValue(actor, ""); } if (m_funcGetTarValue != null) { tarData = m_funcGetTarValue(actor, ""); tmpBool = sourData.CompareValue(mCompareType, tarData); } else { tmpBool = sourData.CompareValue(mCompareType, mValue); } return(tmpBool); }
public static void SetActorIsInitAIDataList(Actor actor, AIBaseData val) { actor.IsInitAIDataList = val.GetValue_Bool(); }
public override void Deserialize(XmlNode xmlNode) { base.Deserialize(xmlNode); XmlElement xmlElement = xmlNode as XmlElement; mObjType = xmlElement.GetAttribute("ObjectType"); mValueName = xmlElement.GetAttribute("ValueName"); if (mObjType == "Actor") { switch (mValueName) { case "HP": m_funcGetValue = FunctionalFuncBase.GetActorHPValue; m_funcSetValue = FunctionalFuncBase.SetActorHPValue; break; case "IsInitAIDataList": m_funcGetValue = FunctionalFuncBase.GetActorIsInitAIDataList; m_funcSetValue = FunctionalFuncBase.SetActorIsInitAIDataList; break; case "TrapIsActive": m_funcGetValue = FunctionalFuncBase.GetTrapIsActive; m_funcSetValue = FunctionalFuncBase.SetTrapIsActive; break; case "TrapIsAble": m_funcGetValue = FunctionalFuncBase.GetTrapIsAble; m_funcSetValue = FunctionalFuncBase.SetTrapIsAble; break; case "TrapState": m_funcGetValue = FunctionalFuncBase.GetTrapState; m_funcSetValue = FunctionalFuncBase.SetTrapState; break; case "TrapMaxAttackCount": m_funcGetValue = FunctionalFuncBase.GetTrapMaxAttackCount; m_funcSetValue = FunctionalFuncBase.SetTrapMaxAttackCount; break; case "TrapMinAttackTime": m_funcGetValue = FunctionalFuncBase.GetTrapMinAttackTime; m_funcSetValue = FunctionalFuncBase.SetTrapMinAttackTime; break; default: break; } } else if (mObjType == "AI") { m_funcGetValue = null; m_funcSetValue = null; } mValueType = AIBaseData.ChangeStrToDataType(xmlElement.GetAttribute("ValueType")); mSetType = AIBaseData.ChangeStrToSetType(xmlElement.GetAttribute("SetType")); mValue = AIBaseData.CreateAIBaseData(mValueType); if (mSetType != AIBaseData.SetType.enReset) { mValue.SetValue(xmlElement.GetAttribute("Value")); } }
public override void SetValue(AIBaseData val) { base.SetIntValue(val.mDataIntValue); }
public override bool CompareValue(CompareType comType, AIBaseData compData) { return(mDataBoolValue == compData.mDataBoolValue); }
public static AIBaseData GetAIData(Actor actor, string valueName) { AIBaseData aiData = actor.SelfAI.GetBaseData(valueName); return(aiData); }
public override void SetValue(AIBaseData val) { base.SetBoolValue(val.mDataBoolValue); }
public static void SetTrapMinAttackTime(Actor actor, AIBaseData val) { Trap tmpTrap = actor as Trap; tmpTrap.mMinAttackTime = val.GetValue_Float(); }
//数值比较 public virtual bool CompareValue(CompareType comType, AIBaseData compData) { return(false); }
public static void SetTrapMaxAttackCount(Actor actor, AIBaseData val) { Trap tmpTrap = actor as Trap; tmpTrap.mMaxAttackCount = val.GetValue_Int(); }
//按照设置类型设值 public virtual void SetValue(SetType setType, AIBaseData val) { }
public static void SetTrapState(Actor actor, AIBaseData val) { Trap tmpTrap = actor as Trap; tmpTrap.SetTrapState((Trap.TrapState)val.GetValue_Int()); }
public static void SetTrapIsAble(Actor actor, AIBaseData val) { Trap tmpTrap = actor as Trap; tmpTrap.m_trapAble = val.GetValue_Bool(); }
//直接赋值 public virtual void SetValue(AIBaseData val) { }
public static void SetActorHPValue(Actor actor, AIBaseData value) { actor.HP = value.GetValue_Float(); }