贺州人民医院电子沙盘
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.

86 lines
3.7 KiB

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[Serializable]
public class SpreadFireCreatData //蔓延出来的火的创建
{
public long sourceId;
public string name;
public Vector3 position;//位置
public Vector3 eulerAngles;//旋转
public Vector3 scale;//缩放
public string buildNum;//楼号
public int floorNum;//层号
public int interlayerNum;//夹层号,0表示不是夹层,1表示第一个夹层
public int Layer;
}
[Serializable]
public class SpreadFireDestoryData//蔓延出来的火的删除
{
public long sourceId;
public string name;
}
public class SpreadFire : CloneGameObjInfo
{
public long SourceId;
public void AddRecordDataCreat(GameObject sourceObj)
{
SourceId = sourceObj.GetComponent<CloneGameObjInfo>().gameObjID;
GetComponent<CloneGameObjInfo>().buildNum = sourceObj.GetComponent<CloneGameObjInfo>().buildNum;//楼号
GetComponent<CloneGameObjInfo>().floorNum = sourceObj.GetComponent<CloneGameObjInfo>().floorNum;//层号
GetComponent<CloneGameObjInfo>().interlayerNum = sourceObj.GetComponent<CloneGameObjInfo>().interlayerNum;//夹层号,0表示不是夹层,1表示第一个夹层
GetComponent<CloneGameObjInfo>().Layer = sourceObj.GetComponent<CloneGameObjInfo>().Layer;
if (ReplaySetting.PlayStatus == PlayStatus.isEditor && RecordManager.Instance.recordStatus == RecordStatus.normal)
{
SpreadFireCreatData data = new SpreadFireCreatData();
data.name = gameObject.name;
data.sourceId = SourceId;
data.position = transform.localPosition;
data.eulerAngles = transform.localRotation.eulerAngles;
data.scale = transform.localScale;
data.buildNum = sourceObj.GetComponent<CloneGameObjInfo>().buildNum;//楼号
data.floorNum = sourceObj.GetComponent<CloneGameObjInfo>().floorNum;//层号
data.interlayerNum = sourceObj.GetComponent<CloneGameObjInfo>().interlayerNum;//夹层号,0表示不是夹层,1表示第一个夹层
data.Layer = sourceObj.GetComponent<CloneGameObjInfo>().Layer;
var eventData = new EventData();
eventData.time = RecordManager.Instance.RecordTimer;
eventData.cloneObjType = CloneObjType.None;
eventData.eventType = RecordEventType.SpreadFireCreat;
eventData.json = Newtonsoft.Json.JsonConvert.SerializeObject(data);
RecordManager.Instance.jsonData.eventDataList.Add(eventData);
}
//if (sourceObj.layer == LayerMask.NameToLayer("Hidden"))//蔓延出来的火如果主火隐藏
//{
// gameObject.layer = LayerMask.NameToLayer("Hidden");
// foreach (Transform child in transform)
// {
// child.gameObject.layer = LayerMask.NameToLayer("Hidden");
// }
//}
}
public void AddRecordDataDestroy()
{
if (ReplaySetting.PlayStatus == PlayStatus.isEditor && RecordManager.Instance.recordStatus == RecordStatus.normal)
{
SpreadFireDestoryData data = new SpreadFireDestoryData();
data.name = gameObject.name;
data.sourceId = SourceId;
var eventData = new EventData();
eventData.time = RecordManager.Instance.RecordTimer;
eventData.cloneObjType = CloneObjType.None;
eventData.eventType = RecordEventType.SpreadFireDestory;
eventData.json = Newtonsoft.Json.JsonConvert.SerializeObject(data);
RecordManager.Instance.jsonData.eventDataList.Add(eventData);
}
}
}