IEnumerator WaitForOnlineServiceInit() { // wait for authenticating, // always wait 1 frame do { yield return(null); } while (!OnlineService.IsAuthenicated); OnSignIn?.Invoke(OnlineService); // authenticated, now load inventory OnlineService.Load(); // wait for load do { yield return(null); } while (!OnlineService.IsLoaded); // load data to inventory DataSystem.LoadInventory(CurrentPlayer.Inventory, OnlineService.LoadedData, out lastLoadedInventoryData); OnGameInit?.Invoke(this); }
private void InitGame() { _currentState = GameState.INIT; InitPlayer(); OnGameInit?.Invoke(); }
private void ShowGameStart(int level) { _currentTurn = Turn.Wait; OnGameInit?.Invoke(this, new GameDayArgs(level)); DOTween.Sequence().Wait(_levelStartDelay, () => { _currentTurn = Turn.Player; OnGameStart?.Invoke(this, null); }); }
void Start() { mainMenuBackground.SetActive(true); Background.CreateCutsceneBackground(Vector3.zero); if (OnlineService == null) { // load data to inventory from file DataSystem.LoadInventory(CurrentPlayer.Inventory, out lastLoadedInventoryData); // if there is no service, everything is initialized OnGameInit?.Invoke(this); } Shop.OnAmmoBuy += Shop_OnAmmoBuy; Shop.OnWeaponBuy += Shop_OnWeaponBuy; Shop.OnWeaponRepair += Shop_OnWeaponRepair; }