public static NavgateWidget create(EntityDynamicActor agent) { NavgateWidget widget = agent.CacheObj.GetComponent <NavgateWidget>(); if (widget == null) { widget = agent.CacheObj.AddComponent <NavgateWidget>(); } widget.agent = agent; widget.target = agent.CacheTrans.position; return(widget); }
public override void onStart() { animator = this.GetComponent <Animator>(); CC = this.GetComponent <CharacterController>(); if (CC == null) { CC = this.CacheObj.AddComponent <CharacterController>(); } if (CC != null && this.info != null) { CC.height = this.info.NameHeight; CC.center = new Vector3(0, this.info.NameHeight / 2, 0); CC.radius = 0.3f;//配置表没配 } navWidget = NavgateWidget.create(this); }