本文整理汇总了C#中Agent.GetName方法的典型用法代码示例。如果您正苦于以下问题:C# Agent.GetName方法的具体用法?C# Agent.GetName怎么用?C# Agent.GetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Agent
的用法示例。
在下文中一共展示了Agent.GetName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Log
//action
public void Log(Agent pAgent, string btMsg, EActionResult actionResult, LogMode mode)
{
#if !BEHAVIAC_RELEASE
if (Config.IsLoggingOrSocketing)
{
//BEHAVIAC_PROFILE("LogManager.Instance.LogAction");
if (!System.Object.ReferenceEquals(pAgent, null) && pAgent.IsMasked())
{
if (!string.IsNullOrEmpty(btMsg))
{
string agentClassName = pAgent.GetClassTypeName();
agentClassName = agentClassName.Replace(".", "::");
string agentName = agentClassName;
agentName += "#";
agentName += pAgent.GetName();
string actionResultStr = "";
if (actionResult == EActionResult.EAR_success)
{
actionResultStr = "success";
}
else if (actionResult == EActionResult.EAR_failure)
{
actionResultStr = "failure";
}
else if (actionResult == EActionResult.EAR_all)
{
actionResultStr = "all";
}
else
{
//although actionResult can be EAR_none or EAR_all, but, as this is the real result of an action
//it can only be success or failure
//when it is EAR_none, it is for update
if (actionResult == behaviac.EActionResult.EAR_none && mode == behaviac.LogMode.ELM_tick)
{
actionResultStr = "running";
}
else
{
actionResultStr = "none";
}
}
if (mode == LogMode.ELM_continue)
{
//[continue]Ship.Ship_1 ships\suicide.xml.BehaviorTreeTask[0]:enter [all/success/failure] [1]
int count = Workspace.Instance.GetActionCount(btMsg);
Debug.Check(count > 0);
string buffer = string.Format("[continue]{0} {1} [{2}] [{3}]\n", agentName, btMsg, actionResultStr, count);
Output(pAgent, buffer);
}
else if (mode == LogMode.ELM_breaked)
{
//[breaked]Ship.Ship_1 ships\suicide.xml.BehaviorTreeTask[0]:enter [all/success/failure] [1]
int count = Workspace.Instance.GetActionCount(btMsg);
Debug.Check(count > 0);
string buffer = string.Format("[breaked]{0} {1} [{2}] [{3}]\n", agentName, btMsg, actionResultStr, count);
Output(pAgent, buffer);
}
else if (mode == LogMode.ELM_tick)
{
//[tick]Ship.Ship_1 ships\suicide.xml.BehaviorTreeTask[0]:enter [all/success/failure] [1]
//[tick]Ship.Ship_1 ships\suicide.xml.BehaviorTreeTask[0]:update [1]
//[tick]Ship.Ship_1 ships\suicide.xml.Selector[1]:enter [all/success/failure] [1]
//[tick]Ship.Ship_1 ships\suicide.xml.Selector[1]:update [1]
int count = Workspace.Instance.UpdateActionCount(btMsg);
string buffer = string.Format("[tick]{0} {1} [{2}] [{3}]\n", agentName, btMsg, actionResultStr, count);
Output(pAgent, buffer);
}
else if (mode == LogMode.ELM_jump)
{
string buffer = string.Format("[jump]{0} {1}\n", agentName, btMsg);
Output(pAgent, buffer);
}
else if (mode == LogMode.ELM_return)
{
string buffer = string.Format("[return]{0} {1}\n", agentName, btMsg);
Output(pAgent, buffer);
}
else
{
Debug.Check(false);
}
}
}
}
#endif
//.........这里部分代码省略.........
示例2: SetDataFromAgent
public void SetDataFromAgent(Agent agent)
{
// Determine whether we should always glitch
bool alwaysGlitch = agent.GetId().Equals("goederick");
// Set the label values
labelsSpawnValues[1] = agent.GetName();
labelsSpawnValues[3] = agent.GetCode();
labelsSpawnValues[5] = agent.GetBirthday();
labelsSpawnValues[7] = agent.GetStreet();
labelsSpawnValues[9] = agent.GetPostalCode();
labelsSpawnValues[11] = agent.GetSwimCert();
// Set the picture
pictureController.Prepare();
pictureController.LoadPicture(agent.GetId());
pictureController.alwaysGlitch = alwaysGlitch;
}
示例3: UpdateFSM
private EBTStatus UpdateFSM(Agent pAgent, EBTStatus childStatus)
{
Debug.Check(this.m_node != null);
Debug.Check(this.m_currentNodeId != -1);
#if !BEHAVIAC_RELEASE
int kMaxCount = 10;
Dictionary<int, int> state_update_count = new Dictionary<int,int>();
#endif//#if !BEHAVIAC_RELEASE
EBTStatus status = childStatus;
bool bLoop = true;
while (bLoop)
{
BehaviorTask currentState = this.GetChildById(this.m_currentNodeId);
currentState.exec(pAgent);
if (currentState is State.StateTask)
{
State.StateTask pStateTask = (State.StateTask)currentState;
if (pStateTask.IsEndState)
{
return EBTStatus.BT_SUCCESS;
}
}
int nextStateId = currentState.GetNextStateId();
if (nextStateId == -1)
{
//if not transitioned, don't go on next state, to exit
bLoop = false;
}
else
{
#if !BEHAVIAC_RELEASE
if (state_update_count.ContainsKey(this.m_currentNodeId))
{
state_update_count[this.m_currentNodeId]++;
}
else
{
state_update_count.Add(this.m_currentNodeId, 1);
}
if (state_update_count[this.m_currentNodeId] > kMaxCount)
{
string treeName = BehaviorTask.GetParentTreeName(pAgent, this.GetNode());
Debug.LogError(string.Format("{0} might be updating an FSM('{1}') endlessly, possibly a dead loop, please redesign it!\n", pAgent.GetName(), treeName));
Debug.Check(false);
}
#endif
//if transitioned, go on next state
this.m_currentNodeId = nextStateId;
}
}
return status;
}
示例4: LogPlanEnd
private void LogPlanEnd(Agent a, Task root)
{
#if !BEHAVIAC_RELEASE
if (Config.IsLoggingOrSocketing)
{
string agentClassName = a.GetClassTypeName();
string agentInstanceName = a.GetName();
agentClassName = agentClassName.Replace(".", "::");
agentInstanceName = agentInstanceName.Replace(".", "::");
string ni = BehaviorTask.GetTickInfo(a, root, null);
string buffer = string.Format("[plan_end]{0}#{1} {2}\n", agentClassName, agentInstanceName, ni);
LogManager.Instance.Log(buffer);
}
#endif
}
示例5: LogPlanBegin
private void LogPlanBegin(Agent a, Task root)
{
#if !BEHAVIAC_RELEASE
if (Config.IsLoggingOrSocketing)
{
string agentClassName = a.GetClassTypeName();
string agentInstanceName = a.GetName();
agentClassName = agentClassName.Replace(".", "::");
agentInstanceName = agentInstanceName.Replace(".", "::");
string ni = BehaviorTask.GetTickInfo(a, root, "plan");
int count = Workspace.Instance.GetActionCount(ni) + 1;
string buffer = string.Format("[plan_begin]{0}#{1} {2} {3}\n", agentClassName, agentInstanceName, ni, count);
LogManager.Instance.Log(buffer);
a.Variables.Log(a, true);
}
#endif
}
示例6: update
protected override EBTStatus update(Agent pAgent, EBTStatus childStatus)
{
ReferencedBehavior pNode = this.GetNode() as ReferencedBehavior;
Debug.Check(pNode != null);
#if !BEHAVIAC_RELEASE
pAgent.m_debug_count++;
if (pAgent.m_debug_count > 20)
{
Debug.LogWarning(string.Format("{0} might be in a recurrsive inter calling of trees\n", pAgent.GetName()));
Debug.Check(false);
}
#endif
EBTStatus result = this.m_subTree.exec(pAgent);
bool bTransitioned = State.UpdateTransitions(pAgent, pNode, pNode.m_transitions, ref this.m_nextStateId, result);
if (bTransitioned)
{
result = EBTStatus.BT_SUCCESS;
}
return result;
}
示例7: Log
//property
public static void Log(Agent pAgent, string typeName, string varName, string value)
{
#if !BEHAVIAC_RELEASE
if (Config.IsLoggingOrSocketing)
{
//BEHAVIAC_PROFILE("LogManager.LogVar");
if (!System.Object.ReferenceEquals(pAgent, null) && pAgent.IsMasked())
{
string agentClassName = pAgent.GetClassTypeName();
string agentInstanceName = pAgent.GetName();
agentClassName = agentClassName.Replace(".", "::");
agentInstanceName = agentInstanceName.Replace(".", "::");
//[property]WorldState.World WorldState.time.276854364
//[property]Ship.Ship_1 GameObject.HP.100
//[property]Ship.Ship_1 GameObject.age.0
//[property]Ship.Ship_1 GameObject.speed.0.000000
string buffer;
bool bIsPar = Utils.IsParVar(varName);
if (bIsPar)
{
string tn = typeName;
//filter out "signed "
tn.Replace("signed ", "");
buffer = string.Format("[property]{0}#{1} {2} {3}->{4}\n", agentClassName, agentInstanceName, tn, varName, value);
}
else
{
buffer = string.Format("[property]{0}#{1} {2}->{3}\n", agentClassName, agentInstanceName, varName, value);
}
Output(pAgent, buffer);
SocketUtils.SendText(buffer);
}
}
#endif
}