예제 #1
0
        /// <summary>
        /// Opens the scene with the specified name.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="name">The scene name.</param>
        /// <exception cref="ArgumentException">Could not find a scene with name '{0}'".With(name)</exception>
        public static void OpenScene(this IWorldContext context, string name)
        {
            var sceneType = Type.GetType(name) ?? context.GetType().Assembly.GetType(name);

            if (sceneType == null)
            {
                throw new ArgumentException($"Could not find a scene with name '{name}'");
            }

            var scene = Activator.CreateInstance(sceneType, context) as IScene;

            context.OpenScene(scene);
        }