本文整理汇总了C#中RAIN.MoveTo方法的典型用法代码示例。如果您正苦于以下问题:C# RAIN.MoveTo方法的具体用法?C# RAIN.MoveTo怎么用?C# RAIN.MoveTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RAIN
的用法示例。
在下文中一共展示了RAIN.MoveTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public override RAIN.Action.Action.ActionResult Execute(RAIN.Core.Agent agent, float deltaTime)
{
//get position of passenger, if he has not moved to a random position yet (boolean flag)
//get the random destination from the action context, move him there
Vector3 pos = agent.Avatar.transform.position;
if (flag == false ){
no = agent.actionContext.GetContextItem<Vector3>("newpos");
flag =true;
}
agent.MoveTo(no, deltaTime);
//check if he has reached random destination; if so, move to closest door
if (Mathf.Abs((int) no.x - (int) pos.x) <=1 && Mathf.Abs((int) no.z - ((int) pos.z))<=1) {
script =(closestDoor) agent.Avatar.gameObject.GetComponent("closestDoor");
script.calculateDoor();
no = agent.actionContext.GetContextItem<Vector3>("door");
agent.MoveTo(no, deltaTime);
}
return RAIN.Action.Action.ActionResult.FAILURE;
}