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.
52 lines
1.4 KiB
52 lines
1.4 KiB
5 years ago
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using AX.MessageSystem;
|
||
|
using System;
|
||
|
|
||
|
/// <summary>
|
||
|
/// 灾情库记录基类
|
||
|
/// </summary>
|
||
|
public abstract class DisasterLibraryRecord : MonoBehaviour {
|
||
|
|
||
|
public virtual void OnEnable()
|
||
|
{
|
||
|
MessageDispatcher.AddListener("DISASTER_LIBRARY_RECORD",DLRecord);
|
||
|
}
|
||
|
|
||
|
public virtual void OnDestroy()
|
||
|
{
|
||
|
MessageDispatcher.RemoveListener("DISASTER_LIBRARY_RECORD", DLRecord);
|
||
|
}
|
||
|
|
||
|
public abstract void DLRecord(IMessage obj);
|
||
|
|
||
|
/// <summary>
|
||
|
/// 记录灾情的基础信息
|
||
|
/// </summary>
|
||
|
/// <param name="disaster"></param>
|
||
|
public virtual void DisasterRecord(Disaster disaster)
|
||
|
{
|
||
|
disaster.Position = transform.position;
|
||
|
disaster.Rotation = transform.rotation;
|
||
|
disaster.Scale = transform.localScale;
|
||
|
|
||
|
var baseInfo = transform.GetComponent<BaseGameObjInfo>();
|
||
|
if (baseInfo)
|
||
|
{
|
||
|
disaster.GameObjID = baseInfo.gameObjID;
|
||
|
disaster.GameObjType = baseInfo.gameObjType;
|
||
|
disaster.UserID = baseInfo.UserID;
|
||
|
}
|
||
|
|
||
|
var info = transform.GetComponent<CloneGameObjInfo>();
|
||
|
if (info)
|
||
|
{
|
||
|
disaster.BuildNum = info.buildNum;
|
||
|
disaster.FloorNum = info.floorNum;
|
||
|
disaster.InterlayerNum = info.interlayerNum;
|
||
|
disaster.ShoworHidden = info.ShoworHidden;
|
||
|
}
|
||
|
}
|
||
|
}
|