void Awake() { if (Instance == null) { Instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } }
public override void OnInspectorGUI() { GameManagerInstance manager = (GameManagerInstance)target; DrawDefaultInspector(); if (GUILayout.Button("Kill player")) { manager.KillPlayer(); } if (GUILayout.Button("Toggle Selected Feature")) { manager.SetUnlockState(manager.UnlockID, !manager.GetUnlockState(manager.UnlockID)); } }
void OnPluginLoaded(Plugin name) { if (!name.Name.Equals("GrapeGameManager")) { return; } _Instance?.Destroy(); // Process after a delay to ensure plugin references have been wired up timer.Once(1.5f, () => { LoadConfigFile(); WriteConfig(); var _GamePluginMap = new Dictionary <string, Plugin>(); foreach (var gameConfig in _Config.GameInstanceMap.Values) { _GamePluginMap.Add(gameConfig.GameName, plugins.Find(gameConfig.GamePluginName)); } _Instance = new GameManagerInstance(_Config, _GamePluginMap); }); }