|
|
|
@ -32,8 +32,8 @@ public class ASSOCIATED_LINE_SYNC : NetworkMessageBehaviour
|
|
|
|
|
private GameObject parent; |
|
|
|
|
//private long gameObjId; |
|
|
|
|
//private GameObject startHitGameobj; |
|
|
|
|
// private GameObject endHitGameobj; |
|
|
|
|
// private Vector3 beginLinePoint; |
|
|
|
|
// private GameObject endHitGameobj; |
|
|
|
|
// private Vector3 beginLinePoint; |
|
|
|
|
private Vector3 startPoint; |
|
|
|
|
private Vector3 endPoint; |
|
|
|
|
public float Height = 0.2f; |
|
|
|
@ -52,12 +52,12 @@ public class ASSOCIATED_LINE_SYNC : NetworkMessageBehaviour
|
|
|
|
|
InputHistory.Instance.RegisterInputHistory(message); |
|
|
|
|
var info = message.Body.Deserialize<AssociatedLineSyncDate>(); |
|
|
|
|
var sender = info.SendUserID; |
|
|
|
|
// gameObjId = info.baseGameobjInfo.gameObjID; |
|
|
|
|
// gameObjId = info.baseGameobjInfo.gameObjID; |
|
|
|
|
if (InputManager.Instance) |
|
|
|
|
{ |
|
|
|
|
if (CurrentUserInfo.mySelf.Id != sender) |
|
|
|
|
{ |
|
|
|
|
if (info.startHitGameObjId!=0&&info.endHitGameObjId!=0) |
|
|
|
|
if (info.startHitGameObjId != 0 && info.endHitGameObjId != 0) |
|
|
|
|
{ |
|
|
|
|
Associatedline(info); |
|
|
|
|
} |
|
|
|
@ -67,7 +67,7 @@ public class ASSOCIATED_LINE_SYNC : NetworkMessageBehaviour
|
|
|
|
|
//{ |
|
|
|
|
// NetworkSyncHelper.AddSyncData(info); |
|
|
|
|
//} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//private void Resert() |
|
|
|
@ -84,8 +84,8 @@ public class ASSOCIATED_LINE_SYNC : NetworkMessageBehaviour
|
|
|
|
|
|
|
|
|
|
if (EntitiesManager.Instance.GetEntityByID(data.gameObjID) == null) |
|
|
|
|
{ |
|
|
|
|
parentgameobj = EntitiesManager.Instance.CreateObj(parent, transform.position,transform, data.gameObjID); |
|
|
|
|
|
|
|
|
|
parentgameobj = EntitiesManager.Instance.CreateObj(parent, transform.position, transform, data.gameObjID); |
|
|
|
|
|
|
|
|
|
startPoint = data.LineBeginPoint; |
|
|
|
|
} |
|
|
|
|
else//第三个点及以上,找到前两个点创建的对象,将末位点赋给起点 |
|
|
|
@ -93,7 +93,7 @@ public class ASSOCIATED_LINE_SYNC : NetworkMessageBehaviour
|
|
|
|
|
parentgameobj = EntitiesManager.Instance.GetEntityByID(data.gameObjID); |
|
|
|
|
startPoint = parentgameobj.GetComponent<ParentLinesMessage>().EndPoint; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
endPoint = data.hitpoint; |
|
|
|
|
float distance = Vector3.Distance(startPoint, endPoint);//计算两点的距离 |
|
|
|
|
Vector3 clonedObjPos = (startPoint + endPoint) / 2; |
|
|
|
@ -104,7 +104,7 @@ public class ASSOCIATED_LINE_SYNC : NetworkMessageBehaviour
|
|
|
|
|
|
|
|
|
|
line.name = "line"; |
|
|
|
|
line.transform.position = clonedObjPos; |
|
|
|
|
if((endPoint - startPoint)!=Vector3.zero) |
|
|
|
|
if ((endPoint - startPoint) != Vector3.zero) |
|
|
|
|
{ |
|
|
|
|
line.transform.forward = (-(endPoint - startPoint)).normalized;//改变线条的朝向 |
|
|
|
|
} |
|
|
|
@ -136,10 +136,12 @@ public class ASSOCIATED_LINE_SYNC : NetworkMessageBehaviour
|
|
|
|
|
//startPoint = endPoint; |
|
|
|
|
} |
|
|
|
|
//同步管线连接到物体上的处理 |
|
|
|
|
void ConnectObj(GameObject startobj,GameObject endobj,GameObject hose) |
|
|
|
|
void ConnectObj(GameObject startobj, GameObject endobj, GameObject hose) |
|
|
|
|
{ |
|
|
|
|
if (startobj.GetComponent<FireManControl>()||startobj.GetComponent<TruckMessage>()||startobj.GetComponent<WaterConnonController>() |
|
|
|
|
|| endobj.GetComponent<FireManControl>() || endobj.GetComponent<TruckMessage>() || endobj.GetComponent<WaterConnonController>()) |
|
|
|
|
if (startobj.GetComponent<FireManControl>() || startobj.GetComponent<TruckMessage>() || startobj.GetComponent<WaterConnonController>() |
|
|
|
|
|| startobj.GetComponent<FireRobotController>() |
|
|
|
|
|| endobj.GetComponent<FireManControl>() || endobj.GetComponent<TruckMessage>() || endobj.GetComponent<WaterConnonController>() |
|
|
|
|
|| endobj.GetComponent<FireRobotController>()) |
|
|
|
|
{ |
|
|
|
|
HoseConnectOrDelectData data = new HoseConnectOrDelectData(); |
|
|
|
|
data.StartId = startobj.GetComponent<BaseGameObjInfo>().gameObjID; |
|
|
|
|