private void Start() { attr = GetComponent <NpcAttribute>(); aiBase = GetComponent <AIBase>(); vcontroller = GetComponent <MoveController>().vcontroller; gameObject.AddComponent <DebugServerPos>(); }
private void NetworkMove(EntityInfo info) { if (aibase == null) { aibase = gameObject.GetComponent <AIBase>(); } if (aibase != null) { var aiState = aibase.GetAI().state; if (aiState != null && aiState.type == AIStateEnum.IDLE) { var curPos = transform.position; var tarPos = NetworkUtil.FloatPos(info.X, info.Y, info.Z); var vdir = tarPos - curPos; if (vdir.sqrMagnitude >= 2) { transform.position = tarPos; } } } }