using System.Collections; using System.Collections.Generic; using UnityEngine; using Sirenix.OdinInspector; namespace KairoEngine.Core.ModuleSystem { [System.Serializable] public class GameModule { [SerializeField, HideInInspector] private string _name = "Empty Module Slot"; [InlineButton("ResetModule", "Reset")] [InlineButton("RemoveModule", "Remove")] [FoldoutGroup("@_name"), HideIf("@module == null")] public bool enableModule = true; [SerializeReference, InlineProperty, HideLabel, FoldoutGroup("@_name"), OnValueChanged("UpdateModuleName"), PropertySpace(SpaceBefore = 5, SpaceAfter = 5)] public IGameModule module; [HideInInspector] public bool isInitialized = false; [HideInInspector] public GameConfig gameConfig; private void UpdateModuleName() { if(module != null) _name = module.name; else _name = "Empty Module Slot"; } private void ResetModule() { module.Reset(); } [FoldoutGroup("@_name"), HideIf("@module != null"), Button("Remove Empty Module")] private void RemoveModule() { gameConfig.modules.Remove(this); } } }