using UnityEngine; using System.IO; namespace H2Engine { public class Bhv_MonsterData : MonoBehaviour { [HideInInspector] public int npcID; [HideInInspector] public byte ai; #if UNITY_EDITOR public void Save(BinaryWriter bw) { bw.Write(npcID); bw.Write(ai); 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 void Load(BinaryReader br) { npcID = br.ReadInt32(); ai = br.ReadByte(); float _x = br.ReadSingle(); float _y = br.ReadSingle(); float _z = br.ReadSingle(); transform.position = new Vector3(_x, _y, _z); name = "RefreshMonster_" + npcID; } public void Export(BinaryWriter bw) { Save(bw); } #endif } }