using System.Collections; using System.Collections.Generic; using UnityEngine; #if UNITY_EDITOR using UnityEditor; #endif public class DemonDungeonScriptable : ScriptableObject { [SerializeField] int treasureId; [SerializeField] List positions; public Vector3 GetPosition(int index) { if (index < positions.Count && index >= 0) { return positions[index]; } return Vector3.zero; } #if UNITY_EDITOR public void ApplyPosition(int index, Vector3 _position) { if (positions == null) { positions = new List(); } if (index >= positions.Count) { positions.Add(_position); } else { positions[index] = _position; } } #endif } #if UNITY_EDITOR public class DemonDungeonScriptableEditor : Editor { [MenuItem("策划工具/生成魔族法宝配置文件")] static void BuildConfig() { DemonDungeonScriptable config = CreateInstance(); string _path = StringUtility.Contact("Assets/ResourcesOut/Refdata/ScriptableObject/SoDemonDungeon/", "SoDemonDungeon_", ".asset"); AssetDatabase.CreateAsset(config, _path); AssetDatabase.Refresh(); ProjectWindowUtil.ShowCreatedAsset(config); } } #endif