private void StartDungeonMusic(OnGameLoaded data) { musicSpeaker.clip = dungeonMusic; isPlayerInDungeon = true; musicSpeaker.PlayDelayed(1); musicSpeaker.loop = true; }
private void LoadDataFromSave(OnGameLoaded eventData) { EventManager.Instance.TriggerEvent(new OnPauseEnd()); currentWorldLevel = eventData.saveData.worldLvl; playerName = eventData.saveData.playerName; gameEnded = false; SceneManager.LoadScene(startingScene); Enemy.numberOfEnemies = 0; EventManager.Instance.TriggerEvent(new OnNumberOfEnemiesChanged(0)); EventManager.Instance.TriggerEvent(new OnPlayerTeleportation(new Vector3(0, 11, 0))); }
public void LoadPlayerDataFromSave(OnGameLoaded data) { stats.ChangeStatBase(Stat.MaximumHealth, data.saveData.maximumHealth); stats.ChangeStatBase(Stat.Health, data.saveData.maximumHealth); stats.ChangeStatBase(Stat.HealthRegeneration, data.saveData.healthRegeneration); stats.ChangeStatBase(Stat.MaximumStamina, data.saveData.maximumStamina); stats.ChangeStatBase(Stat.Stamina, data.saveData.maximumStamina); stats.ChangeStatBase(Stat.StaminaRegeneration, data.saveData.staminaRegeneration); stats.ChangeStatBase(Stat.Speed, data.saveData.speed); stats.ChangeStatBase(Stat.AttackSpeed, data.saveData.attackSpeed); stats.ChangeStatBase(Stat.Experimence, data.saveData.experimence); stats.ChangeStatBase(Stat.Lvl, data.saveData.lvl); stats.ChangeStatBase(Stat.Gold, data.saveData.gold); stats.ChangeStatBase(Stat.RequiredExperimence, CalculateExperimenceRequired(data.saveData.lvl)); RefreshWholeGUI(); }
//----------------------------------------------------------------------------------------------- /// <summary> /// Do some visual setup to get the normalize the coordinate system, load default /// content, and then call out for any user-assigned work using the OnLoaded event. /// </summary> //----------------------------------------------------------------------------------------------- protected override void LoadContent() { Content = new EmbeddedContentManager(_graphics.GraphicsDevice) { RootDirectory = "Content" }; // Set up buffer size to be a portrait mode of at least 1x1.6 ratio _backBufferWidth = GraphicsDevice.PresentationParameters.BackBufferWidth; _backBufferHeight = GraphicsDevice.PresentationParameters.BackBufferHeight; if ((float)_backBufferHeight / _backBufferWidth < 1.6) { _backBufferWidth = (int)(_backBufferHeight / 1.6); _backBufferXOffset = (GraphicsDevice.PresentationParameters.BackBufferWidth - _backBufferWidth) / 2; } _spriteBatch = new SpriteBatch(GraphicsDevice); _utilityBlockTexture = Content.Load <Texture2D>("_utility_block"); _circleTexture = Content.Load <Texture2D>("_utility_circle"); _defaultFont = Content.Load <SpriteFont>("_utility_SegoeUI"); _fontsByName.Add("_utility_SegoeUI", _defaultFont); SelectFont(); // Widgets _widgetSpace = new VarmintWidgetSpace(this); _debugContext.ScreenSize = ScreenSize; _debugScreen = _widgetSpace.FindWidgetByName("_debug_screen_"); _debugScreen.BindingContext = _debugContext; _debugScreen.Prepare(null); _debugWidget = _debugScreen.Children.First(); _debugContentHolder = _debugScreen.FindWidgetByName("_debug_contentslot_"); SetScreen("_default_screen_", null); OnGameLoaded?.Invoke(); foreach (var sliceItem in _widgetSpace.NineSlices) { sliceItem.Prepare(null); if (sliceItem.Content == null || !_glyphsByName.ContainsKey(sliceItem.Content.ToString())) { throw new ApplicationException($"NineSlice item '{sliceItem.Name}' did not specify a valid glyph name ({sliceItem.Content}) in the Content property. "); } _slicedGlyphsByName[sliceItem.Name] = sliceItem.GetSlicedTexture(_glyphsByName[sliceItem.Content.ToString()]); } }
public void Load() { string path = m_gameSaving.GetSaveFilePath(); if (!File.Exists(path)) { Debug.LogWarning("File not found"); return; } StreamReader reader = new StreamReader(path); LoadSavedData(reader); reader.Close(); OnGameLoaded?.Invoke(); }
/// <summary> /// Instantiates the map and character. Listens to some events. /// Introduces an artifical wait of one second to simulate some loading, since these prefabs are /// already at hand and not being loaded from AssetBundles. /// </summary> /// <param name="operation"></param> /// <returns></returns> protected IEnumerator CRDummyLoad(GameOperation operation) { yield return(new WaitForSeconds(1.0f)); mapInstance = GameObject.Instantiate(mapPrefab); mapManipulator.mapPivot = mapInstance.transform; SetupTargets(); catInstance = GameObject.Instantiate(catPrefab); catInstance.transform.SetParent(mapInstance.transform); catInstance.transform.position = mapInstance.characterSpawnPoint.position; catInstance.transform.rotation = mapInstance.characterSpawnPoint.rotation; OnCatHealthChanged.AddListener(OnCatHealthChange); mapInstance.mapRaycastController.onRayCastHit.AddListener(catInstance.MoveTo); operation.isDone = true; state = State.loaded; OnGameLoaded.Invoke(); }
public async void SwitchGame(string path) { string packPath = Path.Combine(path, PACK_RELATIVE_DIR); if (!Directory.Exists(packPath)) { Debug.LogWarningFormat("Path \"{0}\" is not a valid Forgelight Game directory.", path); return; } try { ActiveGame = new ForgelightGame(Path.GetDirectoryName(path), packPath); await ActiveGame.LoadPacks(statusReporter); Task[] loadTasks = new Task[loadables.Count]; for (int i = 0; i < loadables.Count; i++) { IEditorLoadable editorLoadable = loadables[i]; loadTasks[i] = editorLoadable.LoadSystem(statusReporter); } foreach (Task task in loadTasks) { await task; } OnGameLoaded?.Invoke(); } catch (Exception e) { Debug.LogErrorFormat("An error occurred while loading Forgelight Game \"{0}\". {1}", path, e); throw; } }
private void GameLoaded(OnGameLoaded date) { gameRunning = true; }
private void OnGameLoaded(OnGameLoaded e) { ShowUnlockedDialog(); }
internal void GameLoaded() { OnGameLoaded?.Invoke(this, EventArgs.Empty); }
private void ActivatePlayer(OnGameLoaded eventData) { gameObject.SetActive(true); }