| | |
| | | { |
| | | public class Bhv_MapTrigger : MonoBehaviour |
| | | { |
| | | public enum E_TriggerType |
| | | { |
| | | Trigger, |
| | | EnterStage |
| | | } |
| | | |
| | | [HideInInspector] |
| | | public int id; |
| | | [HideInInspector] |
| | | public E_TriggerType triggerType = E_TriggerType.Trigger; |
| | | [HideInInspector] |
| | | public Evt.E_EventType type = Evt.E_EventType.Enemy; |
| | | [HideInInspector] |
| | | public int prevID = -1; |
| | | [HideInInspector] |
| | | public BoxCollider boxCollider; |
| | | private bool showDetail = false; |
| | | private bool showEventList = false; |
| | | [HideInInspector] |
| | | public List<int> eventIDList = new List<int>(); |
| | | |
| | | #if UNITY_EDITOR |
| | | |
| | | [HideInInspector] |
| | | public BoxCollider boxCollider; |
| | | |
| | | private bool showDetail = false; |
| | | private bool showEventList = false; |
| | | |
| | | public void Save(BinaryWriter bw) |
| | | { |
| | | bw.Write(id); |
| | | bw.Write((byte)triggerType); |
| | | bw.Write((byte)type); |
| | | bw.Write(prevID); |
| | | bw.Write((float)System.Math.Round(transform.position.x, 2)); |
| | |
| | | public void Load(BinaryReader br) |
| | | { |
| | | id = br.ReadInt32(); |
| | | triggerType = (E_TriggerType)br.ReadByte(); |
| | | type = (Evt.E_EventType)br.ReadByte(); |
| | | prevID = br.ReadInt32(); |
| | | float _pX = br.ReadSingle(); |
| | |
| | | if (showDetail) |
| | | { |
| | | EditorGUILayout.BeginHorizontal(GUILayout.Height(22)); |
| | | EditorGUILayout.LabelField("前置触发器ID", guiSkin.customStyles[0], GUILayout.Height(22), GUILayout.Width(80)); |
| | | EditorGUILayout.LabelField("前置触发器", guiSkin.customStyles[0], GUILayout.Height(22), GUILayout.Width(80)); |
| | | prevID = EditorGUILayout.IntField(prevID, guiSkin.textField, GUILayout.Height(20)); |
| | | EditorGUILayout.LabelField("触发器类型", guiSkin.customStyles[0], GUILayout.Height(22), GUILayout.Width(80)); |
| | | triggerType = (E_TriggerType)EditorGUILayout.EnumPopup(triggerType, guiSkin.customStyles[1], GUILayout.Height(20), GUILayout.Width(100)); |
| | | EditorGUILayout.EndHorizontal(); |
| | | |
| | | EditorGUILayout.BeginVertical(guiSkin.customStyles[1]); |
| | | |
| | | EditorGUILayout.BeginHorizontal(GUILayout.Height(22)); |
| | | if (eventIDList.Count > 0) |
| | | { |
| | | showEventList = EditorGUILayout.Foldout(showEventList, " 触发事件列表", true, guiSkin.customStyles[3]); |
| | | } |
| | | else |
| | | { |
| | | EditorGUILayout.LabelField(" 触发事件列表:", guiSkin.customStyles[0], GUILayout.Height(22), GUILayout.Width(100)); |
| | | GUILayout.FlexibleSpace(); |
| | | } |
| | | if (GUILayout.Button("添加", guiSkin.button, GUILayout.Width(60), GUILayout.Height(22))) |
| | | { |
| | | eventIDList.Add(0); |
| | | showEventList = true; |
| | | } |
| | | EditorGUILayout.EndHorizontal(); |
| | | |
| | | if (showEventList) |
| | | { |
| | | for (int i = eventIDList.Count - 1; i >= 0; --i) |