You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.4 KiB
41 lines
1.4 KiB
5 years ago
|
using AX.Network.Protocols;
|
||
|
using AX.Serialization;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.SceneManagement;
|
||
|
|
||
|
/// <summary>
|
||
|
/// 克隆车辆同步
|
||
|
/// </summary>
|
||
|
public class CLONE_CAR_SYNC : NetworkMessageBehaviour
|
||
|
{
|
||
|
public GameObject ClonePrefab;
|
||
|
public CloneObjType CloneType;
|
||
|
protected override void Execute(BinaryMessage message)
|
||
|
{
|
||
|
InputHistory.Instance.RegisterInputHistory(message);
|
||
|
|
||
|
var cloneData = message.Body.Deserialize<CloneSyncCarData>();
|
||
|
if (cloneData.CloneType == CloneType)
|
||
|
{
|
||
|
//克隆
|
||
|
GameObject cloneGO = EntitiesManager.Instance.CreateObj(ClonePrefab, cloneData.ClonePosition, transform, cloneData.CloneID);
|
||
|
//设置克隆数据
|
||
|
cloneGO.name = cloneData.CloneName;
|
||
|
CloneGameObjInfo info = cloneGO.GetComponent<CloneGameObjInfo>();
|
||
|
info.gameObjType = cloneData.CloneType;
|
||
|
info.UserID = cloneData.UserID;
|
||
|
info.buildNum = cloneData.BuildNum;
|
||
|
info.floorNum = cloneData.FloorNum;
|
||
|
info.interlayerNum = cloneData.InterLayerNum;
|
||
|
cloneGO.GetComponent<TruckMessage>().MyCarMessage = cloneData.CarMessage;
|
||
|
TheHeadName.GetInstance.CreateName(info.gameObjID,cloneGO.name, CloneType.ToString(), 20, Vector3.up * 5);
|
||
|
// 添加到报告
|
||
|
ReportDataMgr.AddTruckObj(cloneGO);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|