mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交无缝数据回滚
This commit is contained in:
@@ -23,11 +23,11 @@ namespace JNGame.Map.DotRecast
|
||||
|
||||
//智能体避障
|
||||
public DtCrowd Crowd { private set; get; }
|
||||
private Dictionary<long, DtCrowdAgent> agents;
|
||||
private Dictionary<ulong, DtCrowdAgent> agents;
|
||||
|
||||
public DotRecastRoot(MeshData data)
|
||||
{
|
||||
agents = new Dictionary<long, DtCrowdAgent>();
|
||||
agents = new Dictionary<ulong, DtCrowdAgent>();
|
||||
//初始化导航数据
|
||||
InitNavMesh(data);
|
||||
//初始化避障数据
|
||||
@@ -103,17 +103,19 @@ namespace JNGame.Map.DotRecast
|
||||
}
|
||||
|
||||
//添加避障
|
||||
public void AddAgent(long id,RcVec3f start)
|
||||
public void AddAgent(ulong id,RcVec3f start)
|
||||
{
|
||||
DelAgent(id);
|
||||
agents.Add(id,Crowd.AddAgent(start, GetAgentParams()));
|
||||
}
|
||||
public void AddAgent(long id,RcVec3f start,DtCrowdAgentParams agentParams)
|
||||
public void AddAgent(ulong id,RcVec3f start,DtCrowdAgentParams agentParams)
|
||||
{
|
||||
DelAgent(id);
|
||||
agents.Add(id,Crowd.AddAgent(start, agentParams));
|
||||
}
|
||||
|
||||
//添加避障
|
||||
public void DelAgent(long id)
|
||||
public void DelAgent(ulong id)
|
||||
{
|
||||
if (agents.ContainsKey(id))
|
||||
{
|
||||
@@ -123,7 +125,7 @@ namespace JNGame.Map.DotRecast
|
||||
}
|
||||
|
||||
//移动避障
|
||||
public void MoveAgent(long id,RcVec3f move)
|
||||
public void MoveAgent(ulong id,RcVec3f move)
|
||||
{
|
||||
|
||||
DtCrowdAgent agent = agents[id];
|
||||
@@ -133,14 +135,14 @@ namespace JNGame.Map.DotRecast
|
||||
}
|
||||
|
||||
//向量移动避障
|
||||
public void VectorMoveAgent(long id,RcVec3f vector)
|
||||
public void VectorMoveAgent(ulong id,RcVec3f vector)
|
||||
{
|
||||
DtCrowdAgent agent = agents[id];
|
||||
Crowd.RequestMoveVelocity(agent,vector);
|
||||
}
|
||||
|
||||
//获取避障
|
||||
public DtCrowdAgent GetAgent(long id)
|
||||
public DtCrowdAgent GetAgent(ulong id)
|
||||
{
|
||||
return agents[id];
|
||||
}
|
||||
|
Reference in New Issue
Block a user