public Transform GetHangPoint(string name, TSVector curPosition, TSVector curForward, out TSVector position, out TSVector forward) { position = curPosition; forward = curForward; Transform transform = null; bool hasHangPoint = false; if (m_cHangPointItem != null) { var hangPointData = m_cHangPointItem.GetHangPointData(name); if (hangPointData != null) { hasHangPoint = true; FP nAngle = TSVector.Angle(TSVector.forward, curForward); if (curForward.x < 0) { nAngle = 360 - nAngle; } TSQuaternion sQuat = TSQuaternion.AngleAxis(nAngle, TSVector.up); position = curPosition + sQuat * hangPointData.position; forward = sQuat * hangPointData.forward; forward.Normalize(); } } if (m_cHangPointView != null) { transform = m_cHangPointView.GetHangPoint(name); hasHangPoint = true; } if (!hasHangPoint) { CLog.LogError("对象" + this.name + "找不到挂点名为:" + name + "的挂点信息"); } return(transform); }
public void ReqMoveForward(TSVector direction) { if (CanMove() && (TSVector.Angle(curForward, direction) > FP.EN1 || !m_cMove.isMoving)) { Frame_ReqMoveForward_Data data = new Frame_ReqMoveForward_Data(); data.unitId = id; data.forward = GameInTool.ToProtoVector2(direction); NetSys.Instance.SendMsg(NetChannelType.Game, (short)PacketOpcode.Frame_ReqMoveForward, data); } }
public void ReqSetForward(TSVector forward, bool immediately = true) { if (TSMath.Abs(TSVector.Angle(m_sCurForward, forward)) < FP.EN1) { return; } Frame_ReqSetForward_Data data = new Frame_ReqSetForward_Data(); data.unitId = id; data.forward = GameInTool.ToProtoVector2(forward); data.immediately = immediately; NetSys.Instance.SendMsg(NetChannelType.Game, (short)PacketOpcode.Frame_ReqSetForward, data); }
private void UpdateCollider2(Check2DCollider collider, TSVector curPosition, TSVector curForward, BaseGameColliderData colliderData) { FP nAngle = TSVector.Angle(TSVector.forward, curForward); if (curForward.x < 0) { nAngle = 360 - nAngle; } TSQuaternion sQuat = TSQuaternion.AngleAxis(nAngle, TSVector.up); TSVector center = curPosition + sQuat * colliderData.center; TSVector forward = sQuat * colliderData.forward; collider.center = new TSVector2(center.x, center.z); collider.forward = new TSVector2(forward.x, forward.z); }