Пример #1
0
 public void Awake()
 {
     if (mmc.TryGetComponent <MasterDRPController>(out MasterDRPController tmrp))
     {
         mrp = tmrp;
     }
     else
     {
         throw new Exception("No Matser DRP controller found on this scene's Master Misc Controller. @DRPTrigger.cs Awake()");
     }
 }
Пример #2
0
        private void Start()
        {
            #region general loading

            gameplayManager         = new GameplayManager();
            ApplicationQuitRequest += OnApplicationRequestQuit;

            #endregion

            #region scene initialization

            EnvironmentController.environmentSoundType = EnvironmentController.SoundType.closed;
            AudioHandler.Init();

            #endregion

            #region load and handle control scheme

            if ((int)SaveManager.Load(SaveManager.DataType.dint, "LGO").data == 0) // game has never been launched, 1 = launched
            {
                Debug.Log("Game is launching for the first time. Assigning default settings...");
                SaveManager.AddData("LGO", 1);
                InputHandler.AssignDefaults();
                InputHandler.Save();
            }

            InputHandler.Status status = InputHandler.Load();
            if (status == InputHandler.Status.ok)
            {
                Debug.Log("Found control scheme.");
            }
            else if (status == InputHandler.Status.notfound)
            {
                Debug.LogWarning("Control scheme not found, falling back to defaults...");
                InputHandler.AssignDefaults();
            }
            else if (status == InputHandler.Status.noparse)
            {
                Debug.LogWarning("Control scheme could not be parsed correctly, falling back to defaults...");
                InputHandler.AssignDefaults();
            }

            #endregion

            #region Discord Rich Presence and Multiplayer controller

            MasterDRPController tdrp;
            if (useDRP)
            {
                if (TryGetComponent <MasterDRPController>(out tdrp))
                {
                    masterDRPController = tdrp;
                }
                else
                {
                    masterDRPController = gameObject.AddComponent <MasterDRPController>();
                }
                masterDRPController.Initialize(new Discord.Activity
                {
                    State   = initialState,
                    Details = initialDetail
                });
            }

            #endregion
        }