Example #1
0
        /// <summary>
        /// Load beatmap from a file with background texture and music file into memory
        /// </summary>
        /// <param name="beatmapName">Name of the beatmap</param>
        /// <returns>Beatmap class</returns>

        /*private Beatmap LoadBeatmap(string beatmapName)
         * {
         *  // TODO: Remove this
         *  Beatmap beatmap;
         *
         *  // Load Beatmap
         *  BeatmapReader beatmapReader = new BeatmapReader(_beatmapProcessor.ProcessorSettings);
         *
         *  try
         *  {
         *      beatmap = beatmapReader.ReadBeatmap(_game.GraphicsDevice,
         *          beatmapName, "test");
         *  }
         *  catch (Exception e)
         *  {
         *      LogHelper.Log($"Error while reading beatmap: {e.Message}");
         *      // TODO: If there was an error while loading map, return to the song select menu and pop up a notification to user
         *      throw new Exception(e.Message);
         *  }
         *
         *  return beatmap;
         * }*/

        /// <summary>
        /// Add event handlers to all the hit objects from all the game systems if it should process hit objects
        /// </summary>
        private void InitializeAllHitObjects()
        {
            foreach (var hitObject in Beatmap.HitObjects)
            {
                foreach (var system in GameSystemManager.GetAllGameSystems())
                {
                    if (system is IGameSystemProcessHitObject)
                    {
                        hitObject.OnHit += (system as IGameSystemProcessHitObject).OnHitObjectHit;
                    }
                }
            }
        }