本文整理汇总了C#中IAgentData.GetTaskData方法的典型用法代码示例。如果您正苦于以下问题:C# IAgentData.GetTaskData方法的具体用法?C# IAgentData.GetTaskData怎么用?C# IAgentData.GetTaskData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAgentData
的用法示例。
在下文中一共展示了IAgentData.GetTaskData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
/// <summary>
/// Per frame update.
/// </summary>
/// <param name="agentData"> Agent data. </param>
/// <returns> Execution status after this update. </returns>
public override ExecutionStatus Update(IAgentData agentData)
{
Data data = agentData.GetTaskData<Data>();
if (data.Status == ExecutionStatus.Running)
{
// Update.
data.Status = this.UpdateChild(agentData);
}
else
{
// Restart if still possible.
IDecisionData decisionData = null;
++agentData.CurrentDeciderLevel;
float decisionValue = this.Task.Decide(agentData, ref decisionData);
--agentData.CurrentDeciderLevel;
if (decisionValue > 0.0f)
{
data.Status = this.ActivateChild(agentData, decisionData);
if (data.Status == ExecutionStatus.Running)
{
data.Status = this.UpdateChild(agentData);
}
}
else
{
data.Status = ExecutionStatus.Failed;
}
}
return ExecutionStatus.Running;
}
示例2: Deactivate
/// <summary>
/// Deactivation.
/// </summary>
/// <param name="agentData"> Agent data. </param>
public override void Deactivate(IAgentData agentData)
{
Data data = agentData.GetTaskData<Data>();
// Deactivate child if running.
if (data.Status == ExecutionStatus.Running)
{
this.DeactivateChild(agentData);
}
agentData.CurrentTaskData = null;
}
示例3: Deactivate
/// <summary>
/// Deactivation.
/// </summary>
/// <param name="agentData"> Agent data. </param>
public override void Deactivate(IAgentData agentData)
{
Data data = agentData.GetTaskData<Data>();
// Setup blackboard.
Setup(agentData, data);
// Deactivate child.
this.DeactivateChild(agentData);
// Tear down.
TearDown(agentData, data);
}
示例4: Update
/// <summary>
/// Per frame update.
/// </summary>
/// <param name="agentData"> Agent data. </param>
/// <returns> Execution status after this update. </returns>
public override ExecutionStatus Update(IAgentData agentData)
{
Data data = agentData.GetTaskData<Data>();
// Setup blackboard.
Setup(agentData, data);
ExecutionStatus result = base.Update(agentData);
if (result != ExecutionStatus.Running)
{
// Tear down.
TearDown(agentData, data);
}
return result;
}