IEnumerator Start() { Time.fixedDeltaTime = Const.FixedDeltaTime; Configuration.ReadFromFileOrCreate("config.json"); if (gameObject.name != "Entity") { throw new ArgumentException("PlayMain is not binding in an Entity"); } Singleton = gameObject; DontDestroyOnLoad(gameObject); StrategyManager = new StrategyManager(); GlobalMatchInfo = MatchInfo.NewDefaultPreset(); // 绑定物体 ObjectManager = new ObjectManager(); ObjectManager.RebindObject(); ObjectManager.RebindMatchInfo(GlobalMatchInfo); Event.Register(Event.EventType0.PlaySceneExited, SceneExited); // 等待当前帧渲染完毕后暂停,确保还原后的场景显示到屏幕上 yield return(new WaitForEndOfFrame()); ObjectManager.Pause(); }