using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CloneBlizzardCannon : CloneSingleObj
{
public override void Awake()
{
cloneObjType = CloneObjType.BlizzardCannon;
ResourcesName = "Prefab/Tool/BlizzardCannon";
Height = 1.38f;
base.Awake();
}
///
/// 添加初始状态记录
///
///
public override void AddRecordFrame(List list)
{
foreach (Transform child in transform)
{
var data = new RecordBlizzardCannon();
SetBlizzardCannonData(data, child);
string json = JsonUtility.ToJson(data);
var objectJson = new ObjectData();
objectJson.cloneObjType = cloneObjType;
objectJson.json = json;
list.Add(objectJson);
}
}
public void SetBlizzardCannonData(RecordBlizzardCannon data, Transform obj)
{
var msg = obj.GetComponent();
data.gameObjType = msg.gameObjType;
data.objectName = obj.gameObject.name;
data.hasSupplier = obj.GetComponent().hasSupplier;
if (obj.GetComponent())
{
data.dragable = obj.GetComponent().enabled;
}
data.buildNum = msg.buildNum;
data.floorNum = msg.floorNum;
data.interlayerNum = msg.interlayerNum;
data.myTransform.setMyPosition(obj.localPosition);
data.myTransform.setMyRotation(obj.localRotation);
data.myTransform.setMyScale(obj.localScale);
data.isActive = obj.gameObject.activeSelf;
data.headRotation = obj.Find("paokou").localEulerAngles;
data.waterScale = obj.GetComponent().GetWaterScale();
if (obj.GetComponent())
{
data.IsSelect = obj.GetComponent().selected;
}
data.task = obj.GetComponent().task;
}
///
/// 添加记录(克隆)
///
public override void AddRecordEventClone(Transform obj)
{
if (ReplaySetting.PlayStatus == PlayStatus.isEditor && RecordManager.Instance.recordStatus == RecordStatus.normal)
{
var eventData = new EventData();
eventData.time = RecordManager.Instance.RecordTimer;
eventData.cloneObjType = cloneObjType;
eventData.eventType = RecordEventType.Clone;
var data = new RecordBlizzardCannon();
SetBlizzardCannonData(data, obj);
string json = JsonUtility.ToJson(data);
eventData.json = json;
RecordManager.Instance.jsonData.eventDataList.Add(eventData);
}
}
}