using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ReplayWaterCannon : 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
SetWaterCannon(clonedObj, jsonData);
SetCloneGameObject(clonedObj, json);
if (clonedObj.GetComponent())
{
clonedObj.GetComponent().SetSelect(json);
}
if (clonedObj.GetComponent())
{
clonedObj.GetComponent().enabled = jsonData.dragable;
}
}
///
/// 设置基本属性
///
///
///
public void SetWaterCannon(GameObject clonedObj, RecordWaterCannon 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.transform.Find("Rotate").localEulerAngles = jsonData.rotateRotation;
clonedObj.transform.Find("Rotate/Head").localEulerAngles = jsonData.headRotation;
clonedObj.GetComponent().hasSupplier = jsonData.hasSupplier;
clonedObj.SetActive(jsonData.isActive);
clonedObj.GetComponent().ReplayTask(jsonData.task);
clonedObj.GetComponent().IsAutoSwing = jsonData.IsAutoSwing;
clonedObj.GetComponent().SetWaterScale(jsonData.waterScale);
}
}