using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ReplayHookPipe : ReplaySimpleObject
{
///
/// 回放克隆
///
///
public override void CloneObject(string json)
{
var jsonData = JsonUtility.FromJson(json);
var clonedObj = EntitiesManager.Instance.CreateObj(cloneBase.clonePrefab, jsonData.myTransform.getMyPosition(), transform, long.Parse(jsonData.objectName));
clonedObj.name = jsonData.objectName;//名字即ID
SetHookPipe(clonedObj, jsonData);
SetCloneGameObject(clonedObj, json);
if (clonedObj.GetComponent())
{
clonedObj.GetComponent().SetSelect(json);
}
if (clonedObj.GetComponent())
{
clonedObj.GetComponent().enabled = jsonData.dragable;
}
}
///
/// 设置基本属性
///
///
///
public void SetHookPipe(GameObject clonedObj, RecordWaterReceiver jsonData)
{
clonedObj.name = jsonData.objectName;
clonedObj.transform.localRotation = jsonData.myTransform.getMyRotation();
clonedObj.transform.localPosition = jsonData.myTransform.getMyPosition();
clonedObj.transform.localScale = jsonData.myTransform.getMyScale();
SelectedObjs.gameObjs.Add(clonedObj);
CloneGameObjInfo objMsg = clonedObj.GetComponent();
objMsg.gameObjType = jsonData.gameObjType;
objMsg.buildNum = jsonData.buildNum;
objMsg.floorNum = jsonData.floorNum;
objMsg.interlayerNum = jsonData.interlayerNum;
clonedObj.GetComponent().hasSupplier = jsonData.hasSupplier;
clonedObj.SetActive(jsonData.isActive);
clonedObj.GetComponent().ReplayTask(jsonData.task);
clonedObj.GetComponent().SetWaterScale(jsonData.waterScale);
}
}