public bool TryAddTarget(SkillData pSkillData, ActorObj pCaster, ActorObj pTarget, List <ActorObj> vTargetList, List <int> vExcludeList, Vector3 vSrcPos) { if (pSkillData == null || !pCaster || !pTarget) { return(false); } if (vExcludeList.Contains(pTarget.GetAvatarID())) { return(false); } //int nTarCheck = pSkillData->GetValue(MSV_AreaTarCheck); //if (nTarCheck > 0) //{ // SDConditionParamAvatar sParam; // sParam.ParamAvatar = pCaster; // if (!GSKillConditionCheckManager::Instance().Check(nTarCheck, pTarget, &sParam)) // return false; //} //if (pSkillData->IsAreaAddExclude()) //{ // vExcludeList.insert(pTarget.GetAvatarID()); //} return(true); }
public void AddThreat(ActorObj pAvatar, int nValue) { if (Owner == null || pAvatar == null) { return; } if (Owner == pAvatar) { return; } Threat pThreat = GetThreat(pAvatar.GetAvatarID(), true); if (pThreat == null) { return; } if (nValue >= 0 || pThreat.nThreat <= 0) { pThreat.nThreat += nValue; } pThreat.nThreat = Mathf.Max(-1, pThreat.nThreat); if (CompareThreat(pThreat)) { SetTarget(pThreat.nAvatarID, pThreat.nThreat); } //设置战斗状态 if (!Owner.IsFight()) { Owner.EnterCombat(); } }
protected void SetOwner(ActorObj actor) { foreach (ComponentBase component in m_ComponentsList) { component.SetOwner(actor); } }
public void RemoveByServerID(int nAvatarID, bool bForceRemove) { ActorObj act = GetActorByID(nAvatarID); if (act != null) { if (bForceRemove) { RemoveActor(act); } else { ActorObj actObj = act as ActorObj; if (null != actObj) { //XTODO 死亡移除 //if (actObj.CheckState((int) eState.State_Dead) == false) //{ // RemoveActor(act); //} //else //{ // RemoveActorWithDelay(nAvatarID, actObj.GetRemoveDelayTime()); //} } } } }
public void OnHurt(ActorObj pAvatar, int nValue) { if (Owner) { AddThreat(pAvatar, nValue); } }
public virtual bool Check(ActorObj obj, GCommonConditionParam param) { if (m_nCheckGroup != -1 && manager != null) { return(manager.Check(m_nCheckGroup, obj, param)); } return(false); }
public virtual void OnCheckFail(ActorObj obj, GCommonConditionParam param) { if (manager == null) { return; } manager.ErrorCode = m_nErrorCode; }
public override bool Check(ActorObj obj, GCommonConditionParam param) { List <ProjectileClient> projectileList = XWorldGameModule.GetGameManager <ProjectileManager>().GetProjectileByAvatarSkill(obj.ServerID, nSkillID); if (null == projectileList || 0 == projectileList.Count) { return(false); } return(true); }
// public string TableName{get;set;} // public string ConTableName{get;set;} public bool Check(int nGroupID, ActorObj obj, GCommonConditionParam param) { ErrorCode = 0; if (m_vConditionGroup == null || !m_vConditionGroup.ContainsKey(nGroupID)) { return(false); } return(m_vConditionGroup[nGroupID].Check(obj, param)); }
public void AddActor(ActorObj actor) { if (actor.AvatarID == -1) { return; } if (ActorDict.ContainsKey(actor.AvatarID)) { return; } ActorDict[actor.AvatarID] = actor; }
public override List <ActorObj> CalculationHit(SkillData skilldata, GTargetInfo targetInfo) { float minDis = skilldata.MSV_AreaParam1 / 10.0f; float maxDis = skilldata.MSV_AreaParam2 / 10.0f; float w = skilldata.MSV_AreaParam3 / 10.0f; Vector3 pos = skilldata.IsAreaUseTarPos() ? targetInfo.m_vTarPos : targetInfo.m_vSrcPos; Vector3 dir = targetInfo.m_vAimDir; Vector3 center = pos + dir * ((minDis + maxDis) / 2); SRect sRect = new SRect(center, maxDis - minDis, w); List <ActorObj> pActorList = ActorMgr.GetAllActor(); if (pActorList.Count <= 0) { return(null); } List <ActorObj> list = new List <ActorObj>(); foreach (ActorObj actor in pActorList) { if (actor == m_pLocalPlayer) { continue; } ActorObj obj = (ActorObj)actor; if (obj.CollisionCom == null) { continue; } for (int i = 0; i < obj.CollisionCom.GetShapeCount(); i++) { SShapeData shp = obj.CollisionCom.GetShape(i); if (shp != null) { SSphere sTarSphere = new SSphere(shp.Pos, shp.r); if (GCollider.RectCollideCheck(sRect, sTarSphere, dir)) { list.Add(actor); break; } } } } return(list); }
public void RemoveActor(ActorObj actor) { if (actor.AvatarID == -1) { return; } if (!ActorDict.ContainsKey(actor.AvatarID)) { return; } //XTODO 丢弃资源 //actor.UnloadRes(); if (!ActorDict.ContainsKey(actor.AvatarID)) { return; } ActorDict.Remove(actor.AvatarID); }
public ActorObj CreateAvatar(int avatarType) { ActorObj actor = null; AvatarType type = (AvatarType)avatarType; switch (type) { case AvatarType.NPC_Player: actor = new NPCPlayer(); break; case AvatarType.NPC_Enemy: actor = new NPCEnemy(); break; default: break; } return(actor); }
public void OnHeal(ActorObj pAvatar, int nValue) { if (!Owner) { return; } foreach (KeyValuePair <int, Threat> item in m_ThreatDict) { Threat pThreat = item.Value; if (pThreat == null) { continue; } //TODO 当人物管理完成后添加,当治疗时对当前攻击治疗目标的所有人产生仇恨 //ActorObj pTAvatar = Owner->GetSceneAvatar(pThreat.nAvatarID); //if (pTAvatar) //{ // pTAvatar->AddThreat(pAvatar, nValue, true); //} } }
public bool CheckRelation(ActorObj objA, ActorObj objB, TargetType type) { if (objA == null || objB == null) { return(false); } int cmpA = objA.GetCamp(); int cmpB = objB.GetCamp(); CreditLevelId cl = CreditLevelId.Credit_Friendly; if (cmpB <= 0) { cl = CreditLevelId.Credit_Friendly; } else { CreditType creditA = GetCreditType(cmpA); if (creditA != null) { cl = creditA.GetCredit(cmpB); } } if ((type & TargetType.ToEnemy) != 0 && IsEnemy(cl)) { return(true); } if ((type & TargetType.ToFriend) != 0 && IsFriend(cl)) { return(true); } if ((type & TargetType.ToNeutral) != 0 && IsNeutral(cl)) { return(true); } return(false); }
public override void Update(float fElapseTimes) { List <ActorObj> actorList = new List <ActorObj>(ActorDict.Values); for (int i = 0; i < actorList.Count; i++) { actorList[i].Tick(fElapseTimes); } foreach (var key in new List <int>(DelayRemoveList.Keys)) { DelayRemoveList[key] -= fElapseTimes; if (DelayRemoveList[key] <= 0.0f) { ActorObj actor = GetActorByID(key); if (actor != null) { RemoveActor(actor); DelayRemoveList.Remove(key); } } } }
public void OnTaunt(ActorObj pAvatar, int nValue) { if (!Owner) { return; } //受到嘲讽时,将第一名的加上去 Threat pThreat = GetThreat(pAvatar.GetAvatarID(), true); pThreat.nThreat += nValue; if (!CompareThreat(pThreat)) { int nMaxThreat = Mathf.Max(m_nTargetThreat, pThreat.nThreat); //嘲讽是否存在可能越界的情况 pThreat.nThreat += nMaxThreat; } if (pThreat != null) { SetTarget(pAvatar.GetAvatarID(), pThreat.nThreat); } }
public override List <ActorObj> CalculationHit(SkillData skilldata, GTargetInfo targetInfo) { ActorObj act = ActorMgr.GetByServerID(targetInfo.m_nTargetID) as ActorObj; if (act == null) { return(null); } float dis = Vector3.Distance(targetInfo.m_vSrcPos, act.GetPos()); if (dis > skilldata.MSV_Range) { return(null); } if (!GCollider.SingletonCollideCheck()) { return(null); } List <ActorObj> list = new List <ActorObj>(); list.Add(act); return(list); }
public bool Check(ActorObj obj, GCommonConditionParam param) { bool bSuccess = false; for (int i = 0; i < Count; ++i) { GCommonCondition condition = this[i]; if (condition == null) { continue; } bSuccess = condition.Check(obj, param); if (condition.m_nCmpType == GCommonConditionCmp.ConditionCmp_Not) { bSuccess = !bSuccess; } if (bSuccess) { if (condition.m_nLogicType == GCommonConditionType.ConditionCheck_OR) { break; } } else { if (condition.m_nLogicType == GCommonConditionType.ConditionCheck_AND) { condition.OnCheckFail(obj, param); break; } } } return(bSuccess); }
public virtual List <ActorObj> GetTargetList(SkillData pSkillData, ActorObj pCaster, GTargetInfo sTarInfo, List <int> vExcludeList) { return(null); }
public virtual void SetOwner(ActorObj logicObject) { this.Owner = logicObject; }
public SkillAreaLogic() { m_pLocalPlayer = XWorldGameModule.GetGameManager <ActorManager>().GetLocalPlayer(); }