private void ClearAgent() { if (m_cAgentObj != null) { m_cAgentObj.Clear(); m_cAgentObj = null; } }
private static void SelectUnitFriend(AgentObject host, List <AgentObject> lstAgentObj) { var field = BattleScene.Instance.GetField(host.campId, AgentObjectType.Unit); for (int i = 0; i < field.lstFriend.Count; i++) { lstAgentObj.Add(field.lstFriend[i]); } }
public void End() { m_cSkillTree.Clear(); m_cBlackBoard.Clear(); m_cTarget = null; m_sTargetPosition = TSVector.zero; m_sTargetForward = TSVector.zero; m_bIsDo = false; }
private static void SelectRemoteEnemy(AgentObject host, List <AgentObject> lstAgentObj) { var field = BattleScene.Instance.GetField(host.campId, AgentObjectType.Remote); for (int i = 0; i < field.lstEnemy.Count; i++) { lstAgentObj.Add(field.lstEnemy[i]); } }
public Skill(AgentObject host, NEData neData) { Init(); m_cHost = host; m_cNEData = neData; m_cSkillData = m_cNEData.data as SkillData; m_cSkillTree = CreateNode(m_cNEData) as SkillTree; m_cSkillTree.Clear(); m_cBlackBoard = new SkillBlackBoard(this); m_bIsDo = false; m_sStartTime = -1000; }
public void Do(uint targetAgentId, AgentObjectType targetAgentType, TSVector position, TSVector forward) { if (!CanDo()) { return; } m_cTarget = AgentObject.GetAgentObject(targetAgentId, targetAgentType); m_sTargetPosition = position; m_sTargetForward = forward; m_bIsDo = true; m_sStartTime = FrameSyncSys.time; }
private static void SelectRemoteFriendOutSelf(AgentObject host, List <AgentObject> lstAgentObj) { var field = BattleScene.Instance.GetField(host.campId, AgentObjectType.Remote); for (int i = 0; i < field.lstFriend.Count; i++) { if (field.lstFriend[i] == host) { continue; } lstAgentObj.Add(field.lstFriend[i]); } }
public void Init(uint id, int configId, int campId, UnitType type, TSVector position, TSVector forward) { m_nId = id; m_nConfigId = configId; m_nCampId = campId; m_eUnitType = type; m_cAgentObj = new AgentUnit(this); m_bIsDie = false; m_sCurPosition = m_sLastPosition = position; m_sCurForward = m_sLastForward = forward; SetPosition(position); SetForward(forward); SubInit(); }
protected override void OnSelectChild(AgentObjectBlackBoard blackBoard, List <AgentObject> lst, ref List <SelectAgentObjInfo> result) { if (lst.Count == 0) { return; } AgentObject host = blackBoard.host; TSVector lastPosition = host.lastPosition; TSVector lastForward = host.lastForward; if (!string.IsNullOrEmpty(m_cLastPosToCurPosData.hangPoint)) { blackBoard.host.GetHangPoint(m_cLastPosToCurPosData.hangPoint, host.lastPosition, host.lastForward, out lastPosition, out lastForward); } TSVector curPosition = host.curPosition; TSVector curForward = host.curForward; if (!string.IsNullOrEmpty(m_cLastPosToCurPosData.hangPoint)) { blackBoard.host.GetHangPoint(m_cLastPosToCurPosData.hangPoint, host.curPosition, host.curForward, out curPosition, out curForward); } //检测lastPosition到curPosition这条之间碰撞到的代理 for (int i = 0; i < lst.Count; i++) { var agentObj = lst[i]; if (agentObj.gameCollider != null) { TSVector hitPoint; if (agentObj.gameCollider.CheckLine(lastPosition, curPosition - lastPosition, out hitPoint)) { SelectAgentObjInfo info = new SelectAgentObjInfo(); info.agentObj = agentObj; info.hitPoint = hitPoint; TSVector direct = agentObj.gameCollider.center - curPosition;; if (direct.IsZero()) { direct = curForward; } info.hitDirect = direct; result.Add(info); } } } }
public override BTActionResult OnRun(SkillBlackBoard blackBoard) { Skill skill = blackBoard.skill; AgentObject host = skill.host; TSVector bornPosition = host.curPosition; TSVector bornForward = host.curForward; if (!string.IsNullOrEmpty(m_cActionData.hangPoint)) { host.GetHangPoint(m_cActionData.hangPoint, out bornPosition, out bornForward); } TSVector targetForward = skill.targetForward; if (m_cActionData.useHangPoint) { targetForward = bornForward; } BattleScene.Instance.CreateRemote(m_cActionData.remoteId, skill.host.campId, bornPosition, targetForward, skill.targetAgentId, skill.targetAgentType, skill.targetPosition, targetForward); return(BTActionResult.Ready); }
public void Init(uint id, int configId, int campId, TSVector position, TSVector forward, uint targetAgentId, AgentObjectType targetAgentType, TSVector targetPosition, TSVector targetForward) { m_nId = id; m_nConfigId = configId; m_nCampId = campId; this.gameObject.name = "remote_" + m_nId + "_" + m_nConfigId; m_cRemoteTree = RemoteTreePool.Instance.GetRemoteTree(m_nConfigId); m_cRemoteData = m_cRemoteTree.data as RemoteData; m_cAgentObj = new AgentRemote(this); SetPosition(position); SetViewPosition(position); m_sLastPosition = position; SetForward(forward); SetViewForward(forward); m_sLastForward = forward; if (m_cBlackBoard == null) { m_cBlackBoard = new RemoteBlackBoard(this); } m_cTarget = AgentObject.GetAgentObject(targetAgentId, targetAgentType); m_sTargetPosition = targetPosition; m_sTargetForward = targetForward; m_cView = SceneEffectPool.Instance.CreateEffect(m_cRemoteData.remotePath, false, this.transform); m_cLerpView = gameObject.AddComponentOnce <LerpMoveView>(); m_cLerpView.Init(); m_cLerpView.StopMove(); m_cHangPoint = gameObject.AddComponentOnce <HangPoint>(); string remoteFullPath = PathTool.GetSceneEffectPath(m_cRemoteData.remotePath); m_cHangPoint.Init(remoteFullPath); //暂时不支持表现挂点(特效上挂特效) m_cHangPoint.InitHangView(null); m_cCollider = ObjectPool <GameCollider> .Instance.GetObject(); m_cCollider.Init(remoteFullPath); m_cCollider.Update(curPosition, curForward); }
public void Reset() { if (m_cView != null) { SceneEffectPool.Instance.DestroyEffectGO(m_cView); m_cView = null; } if (m_cCollider != null) { ObjectPool <GameCollider> .Instance.SaveObject(m_cCollider); m_cCollider = null; } m_cLerpView.StopMove(); m_cBlackBoard.Clear(); m_cHangPoint.Clear(); m_cTarget = null; RemoteTreePool.Instance.SaveRemoteTree(m_nConfigId, m_cRemoteTree); m_cRemoteData = null; m_cRemoteTree = null; ClearAgent(); }
public static AgentObject GetAgentObject(uint id, AgentObjectType agentType) { AgentObject agentObj = null; switch (agentType) { case AgentObjectType.Unit: Unit unit = BattleScene.Instance.GetUnit(id); if (unit != null) { agentObj = unit.agentObj; } break; case AgentObjectType.Remote: Remote remote = BattleScene.Instance.GetRemote(id); if (remote != null) { agentObj = remote.agentObj; } break; } return(agentObj); }
public SkillExecutor(AgentObject agentObject) { m_cAgentObject = agentObject; m_lstSkill = new List <Skill>(); m_lstCurSkill = new List <Skill>(); }
public int agentObjCount; //当前选择的代理数量 public void Reset() { agentObj = null; hitPoint = TSVector.zero; hitDirect = TSVector.forward; }
public void Clear() { End(); m_cHost = null; }
private static void SelectSelf(AgentObject host, List <AgentObject> lstAgentObj) { lstAgentObj.Add(host); }