Пример #1
0
        /// <inheritdoc />
        public virtual ICourse LoadCourse()
        {
            if (string.IsNullOrEmpty(RuntimeConfigurator.GetSelectedTrainingCourse()))
            {
                throw new ArgumentException("A training course is not selected in the [TRAINING_CONFIGURATION] game object.");
            }

            string pathToFile = Path.Combine(Application.streamingAssetsPath, RuntimeConfigurator.GetSelectedTrainingCourse()).Replace('/', Path.DirectorySeparatorChar);

            if (File.Exists(pathToFile) == false)
            {
                throw new ArgumentException("The file or the path to the file could not be found.", pathToFile);
            }

            string serialized = File.ReadAllText(pathToFile);

            return(JsonTrainingSerializer.Deserialize(serialized));
        }