using UnityEngine;
|
using System.IO;
|
|
namespace H2Engine
|
{
|
public abstract class Bhv_Evt : MonoBehaviour
|
{
|
[HideInInspector]
|
public int id;
|
[HideInInspector]
|
public Evt.E_EventType type;
|
|
public virtual void Import(BinaryReader br)
|
{
|
type = (Evt.E_EventType)br.ReadByte();
|
id = br.ReadByte();
|
}
|
|
#if UNITY_EDITOR
|
|
[HideInInspector]
|
protected bool showDetail = false;
|
|
public abstract bool DrawUI(GUISkin guiSkin);
|
public virtual void Save(BinaryWriter bw)
|
{
|
bw.Write((byte)type);
|
bw.Write(id);
|
bw.Write((float)System.Math.Round(transform.position.x, 2));
|
bw.Write((float)System.Math.Round(transform.position.y, 2));
|
bw.Write((float)System.Math.Round(transform.position.z, 2));
|
}
|
|
public abstract void SaveJson(System.Text.StringBuilder stringBuilder);
|
public abstract void LoadJson(LitJson.JsonData json);
|
|
public virtual void Load(BinaryReader br)
|
{
|
id = br.ReadInt32();
|
float _x = br.ReadSingle();
|
float _y = br.ReadSingle();
|
float _z = br.ReadSingle();
|
transform.position = new Vector3(_x, _y, _z);
|
}
|
|
public virtual void Export(BinaryWriter bw)
|
{
|
bw.Write((byte)type);
|
bw.Write(id);
|
}
|
#endif
|
}
|
}
|