Пример #1
0
 public Main()
 {
     if (I != null)
     {
         throw new InvalidOperationException("Only one instance of Main is allowed!");
     }
     I = this;
     AmbientTasks.BeginContext(ex => GlobalExceptionHandler(ex));
 }
Пример #2
0
 public LoadingRoom(GameMap map)
 {
     Name = "LoadingRoom for map " + map.Number;
     Map  = map;
     AddChild(ARVROrigin            = new ARVROrigin());
     ARVROrigin.AddChild(ARVRCamera = new FadeCamera()
     {
         Current = true,
     });
     ARVROrigin.AddChild(LeftController = new ARVRController()
     {
         ControllerId = 1,
     });
     ARVROrigin.AddChild(RightController = new ARVRController()
     {
         ControllerId = 2,
     });
     if (Assets.LoadingPic is ImageTexture pic && pic != null)
     {
         ARVRCamera.AddChild(new MeshInstance()
         {
             Mesh = new QuadMesh()
             {
                 Size = new Vector2(pic.GetWidth() * Assets.PixelWidth, pic.GetHeight() * Assets.PixelHeight),
             },
             MaterialOverride = new SpatialMaterial()
             {
                 AlbedoTexture            = pic,
                 FlagsUnshaded            = true,
                 FlagsDoNotReceiveShadows = true,
                 FlagsDisableAmbientLight = true,
                 FlagsTransparent         = false,
                 ParamsCullMode           = SpatialMaterial.CullMode.Back,
                 ParamsSpecularMode       = SpatialMaterial.SpecularMode.Disabled,
             },
             Transform = new Transform(Basis.Identity, Vector3.Forward * pic.GetWidth() * Assets.PixelWidth),
         });
         AmbientTasks.Add(Task.Run(Loading));
     }
 }
Пример #3
0
 public Command(Func <Task> asyncAction)
 {
     action = () => AmbientTasks.Add(asyncAction);
 }