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.
53 lines
2.0 KiB
53 lines
2.0 KiB
3 years ago
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public class CloneFireBase : CloneSingleObj
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 添加初始状态记录
|
||
|
/// </summary>
|
||
|
/// <param name="list"></param>
|
||
|
//public override void AddRecordFrame(List<ObjectData> list)
|
||
|
//{
|
||
|
// base.AddRecordFrame(list);
|
||
|
// if (transform.childCount > 0)
|
||
|
// foreach (Transform item in transform)
|
||
|
// {
|
||
|
// if (item.GetComponent<FireSpreadCtrl>())
|
||
|
// {
|
||
|
// FireSpreadData data = item.GetComponent<FireSpreadCtrl>().GetSpreadData();
|
||
|
// ObjectData objdata = new ObjectData();
|
||
|
// objdata.cloneObjType = CloneObjType.SpreadFire;
|
||
|
// objdata.json = JsonUtility.ToJson(data);
|
||
|
// list.Add(objdata);
|
||
|
// }
|
||
|
// }
|
||
|
//}
|
||
|
public override void AddRecordFrame(List<ObjectData> list)
|
||
|
{
|
||
|
foreach (Transform child in transform)
|
||
|
{
|
||
|
var data = child.GetComponent<FireSpreadCtrl>().GetSpreadData();
|
||
|
data.rsw = child.GetComponent<FireControl>().MyData.rsw; //记录火焰温度
|
||
|
data.pos = child.GetComponent<FireControl>().MyData.pos; //记录热辐射
|
||
|
data.temperature = child.GetComponent<FireControl>().MyData.temperature; //记录火焰温度
|
||
|
data.radiation = child.GetComponent<FireControl>().MyData.radiation; //记录热辐射
|
||
|
SetBaseData(data, child);
|
||
|
string json = JsonUtility.ToJson(data);
|
||
|
var objectJson = new ObjectData();
|
||
|
objectJson.cloneObjType = cloneObjType;
|
||
|
objectJson.json = json;
|
||
|
list.Add(objectJson);
|
||
|
}
|
||
|
}
|
||
|
public override void SetCloneGameObject(GameObject obj)
|
||
|
{
|
||
|
obj.AddComponent<ObjSelectCtrl>();
|
||
|
obj.AddComponent<ObjDrag>();
|
||
|
obj.AddComponent<ObjDelete>();
|
||
|
if (!obj.GetComponent<FireRoate>())
|
||
|
obj.AddComponent<ObjRotate>();
|
||
|
}
|
||
|
}
|