本文整理匯總了C#中Cart.AttachTo方法的典型用法代碼示例。如果您正苦於以下問題:C# Cart.AttachTo方法的具體用法?C# Cart.AttachTo怎麽用?C# Cart.AttachTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Cart
的用法示例。
在下文中一共展示了Cart.AttachTo方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: FixedUpdate
void FixedUpdate()
{
//while(true){
// yield return new WaitForEndOfFrame();
var agent = this.GetComponent<NavMeshAgent>();
if (this.vehicle.roubado) {
roubado = true;
} else {
roubado = false;
}
//if(agent.hasPath && agent.remainingDistance < 2f){
if(Vector3.Distance(this.transform.position, Game.Instance.market.position) < 3f && cart == null){
//chegou no mercado
//Debug.Log("chegou no mercado");
var pos = this.transform.position + this.transform.forward;
var rot = this.transform.rotation;
cart = (Cart)Instantiate(Game.Instance.cartManager.cartPrefab, pos, rot);
cart.transform.SetParent(Game.Instance.cartManager.transform);
cart.AttachTo(this);
cart.stuff.gameObject.SetActive(true);
character.cart = true;
//this.GetComponent<NavMeshAgent>().radius = 1.5f;
//this.GetComponent<NavMeshAgent>().ResetPath();
cart.GetComponent<NavMeshObstacle>().enabled = false;
}else if(Vector3.Distance(this.transform.position, vehicle.transform.position) < 3f && cart != null){
//chegou no carro de volta
vehicle.ChangeToExit();
cart.DetachFrom();
cart.GetComponent<NavMeshObstacle>().enabled = true;
cart.stuff.gameObject.SetActive(false);
//Destroy(cart.gameObject);
Destroy(this.gameObject);
}
//yield return new WaitForEndOfFrame();
UpdateDestination();
//yield return new WaitForEndOfFrame();
//}
//yield return new WaitForEndOfFrame();
//}
}