public GameController(Config config) { InstanceLocator.RegisterInstance <GameController>(this); this._config = config; this.PlayerUs = new Player(this, Player.PlayerType_t.Us); if (this._config.gameType == GameType_t.MULTI_PLAYER) { this.PlayerOther = new Player(this, Player.PlayerType_t.Other); } if (this.GameType == GameType_t.SINGLE_PLAYER) { this.LoadGameSceneObjects(); } else { MultiPlayerManager.Instance.StartGameInRoom(); MultiPlayerManager.OnOtherPlayerLeftRoom += this.HandleOtherPlayerLeftRoom; // TODO: Hack: This is to give enough time for the other clients to load their game scene as well // Ideally we should be using messages / custom properties on room to do this CoroutineHelper.Instance.RunAfterDelay(1.0f, () => { this.LoadGameSceneObjects(); }); } }
public void StartInitialize() { InstanceLocator.RegisterInstance <AppConfig>(this); this.StartCoroutine(this.InitializeAsync(() => { this.IsFullyInitialized = true; })); }
// TODO: Change this to not be a MonoBehaviour; right now the only reason this is a MonoBehaviour is for this.StartCoroutine private void Start() { InstanceLocator.RegisterInstance <FpsMonitor>(this); if (this._numSamples <= 0) { this._numSamples = 1; } this.AverageFPS = 1; }
public override void StartInitialize() { Application.targetFrameRate = 30; AppSceneManager appSceneManager = new AppSceneManager(); InstanceLocator.RegisterInstance <AppSceneManager>(appSceneManager); this._isFullyInitialized = true; OnAppInitComplete.Invoke(); }
public void SetUp() { InstanceLocator.RegisterInstance <IModelFactory, ModelFactory>(); ModelFactory = InstanceLocator.GetInstance <IModelFactory>(); Repository = new MetaModelRepository(); InstanceLocator.RegisterInstance <IMetaModelRepository>(Repository); InstanceLocator.RegisterInstance <IEntityService, EntityService>(); Now = DateTime.Now; InitializeMetaModel(); }
public void StartInitialize() { InstanceLocator.RegisterInstance <MultiPlayerManager>(this); // Do NOT automatically sync scene as that causes weird effects // when playing across devices with drastically different processing speeds // PhotonNetwork.AutomaticallySyncScene = true; PhotonNetwork.GameVersion = kGameMultiPlayerVersion; PhotonNetwork.NickName = SystemInfo.operatingSystem; this.CheckAndConnectToPhotonNetwork(); }
public void StartInitialize() { InstanceLocator.RegisterInstance <IdentityManager>(this); string duid = SystemInfo.deviceUniqueIdentifier; if (string.IsNullOrEmpty(duid)) { DebugLog.LogErrorColor("Failed to get device unique identifier", LogColor.red); return; } MD5 md5hasher = MD5.Create(); byte[] duid_bytes = md5hasher.ComputeHash(Encoding.UTF8.GetBytes(SystemInfo.deviceUniqueIdentifier)); int userId = BitConverter.ToInt32(duid_bytes, 0); this._currentUser = new User(userId); this.IsFullyInitialized = true; }
// Required for IInstance public GameController() { InstanceLocator.RegisterInstance <GameController>(this); }
public void StartInitialize() { InstanceLocator.RegisterInstance <SceneLoader>(this); this.IsFullyInitialized = true; }
private void Awake() { InstanceLocator.RegisterInstance <LoadingScreenManager>(this); }