示例#1
0
        bool CanDoUpdates()
        {
            if (Browser == null)
            {
                return(false);
            }

            if (DashboardOverlay == null && InGameOverlay == null)
            {
                return(false); // We can go no further.
            }
            //This prevents Draw() from failing on get of bitmap when attachment is delayed for controllers
            if (InGameOverlay != null && !InGameOverlay.AttachmentSuccess)
            {
                return(false);
            }

            if (DashboardOverlay != null && DashboardOverlay.IsVisible())
            {
                return(true);
            }

            if (InGameOverlay != null && InGameOverlay.IsVisible())
            {
                return(true);
            }

            return(false);
        }
示例#2
0
        public virtual void Draw()
        {
            if (!CanDoUpdates())
            {
                return;
            }

            PreDrawCallback?.Invoke(this, new EventArgs());

            UpdateTexture();

            if (DashboardOverlay != null && DashboardOverlay.IsVisible())
            {
                DashboardOverlay.SetTexture(ref _textureData);
                DashboardOverlay.Show();
            }

            if (InGameOverlay != null && InGameOverlay.IsVisible())
            {
                InGameOverlay.SetTexture(ref _textureData);
                InGameOverlay.Show();
            }

            PostDrawCallback?.Invoke(this, new EventArgs());
        }
示例#3
0
        public void UpdateInputSettings()
        {
            if (DashboardOverlay != null)
            {
                DashboardOverlay.ToggleInput(true);
            }

            if (InGameOverlay != null)
            {
                InGameOverlay.ToggleInput(EnableNonDashboardInput);
            }
        }
示例#4
0
 static void OnLevelFinishedLoading(Scene scene, LoadSceneMode mode)
 {
     if (scene.name != "MainMenu")
     {
         inGameOverlay = GameObject.FindGameObjectWithTag("InGameOverlay").GetComponent <InGameOverlay>();
         StopGameTimer();
         ResetGameScoreAndTimer();
         StartGameTimer();
         isShowingDeathScreen = false;
     }
     isSwitchingLevel = false;
 }
 //#################################
 // Constructor
 //#################################
 public DemoTutorialScreen()
 {
     voice = false;
     explosionParticles = new ShipExplosionSettings();
     TransitionOnTime   = TimeSpan.FromSeconds(1.5);
     TransitionOffTime  = TimeSpan.FromSeconds(0.5);
     //actual gameplay objects
     _station        = new Station(new Vector3(0, _stationHeight, 0), 0);
     _planet         = new Planet(new Vector3(-1000, -2000, -1000), 0);
     _sphere         = new Sphere(new Vector3(0, _stationHeight / 2, 0), 0);
     _droneFleet     = new DroneBuilder();
     movementAllowed = false;
     Global.Money    = 1000;
     _sphereAlpha    = 0.1f;
     //UI + Frame + BG
     _ui             = new InGameOverlay(_station);
     _back           = new Background();
     _frame          = new Frame();
     dustParticles   = new DustParticleSystem();
     tutorialDialog  = new Dialog(0, 0, 80, 400, 8, false, true);
     captainDialog   = new Dialog(0, 0, 160, 400, 8, false, true);
     captain         = new UIItem();
     borderParticles = new BorderParticleSettings();
     _asteroidField  = new AsteroidBuilder(40);
     TutorialText.Add(TutorialText.Count, "Do you want to skip the tutorial? (Y/N)\n\nYour mission will begin immediately if \nyou choose to skip.");
     TutorialText.Add(TutorialText.Count, "This is your drone!\nPress [Space] to continue!");
     TutorialText.Add(TutorialText.Count, "You can go back with (Back)!\nTry it!");
     TutorialText.Add(TutorialText.Count, "You have to defend the station against\nwaves of enemys!");
     TutorialText.Add(TutorialText.Count, "The alien threat is deploying multiple\nclasses of fighters and bombers.");
     TutorialText.Add(TutorialText.Count, "The Fighters attack your drone and try\nto distract you while the bombers\ndestroy your station.");
     TutorialText.Add(TutorialText.Count, "If your station dies, the mission is\nover. So you need to keep your drone\nand our station alive.");
     TutorialText.Add(TutorialText.Count, "The red bar is your dronehull \nand the blue bar is your shield!");
     TutorialText.Add(TutorialText.Count, "The green bar is the stationhull.\nThe white bar is the stationshield!");
     TutorialText.Add(TutorialText.Count, "The armor icon shows your\ncurrent amount of armor!\nArmor reduces incoming damage.");
     TutorialText.Add(TutorialText.Count, "The Number next to the rocket icon\nis the amount of your BIG rockets.\nUse them wisely.");
     TutorialText.Add(TutorialText.Count, "Your score is your combat rating!\nShooting stuff increases\nyour score!");
     TutorialText.Add(TutorialText.Count, "Fragments are the common\ncurrency on this station.");
     TutorialText.Add(TutorialText.Count, "You can buy upgrades in the station\nshop in exchange for fragments.");
     TutorialText.Add(TutorialText.Count, "Press B to open the shop and\nnavigate through it with the arrow keys.");
     TutorialText.Add(TutorialText.Count, "But beware! \nYou need to be near the station \nto open the shop.");
     TutorialText.Add(TutorialText.Count, "W ] fly up\nA ] fly left\nS ] fly down\nD ] fly right");
     TutorialText.Add(TutorialText.Count, "Left mouse button\n] Shoots your laser\nRight mouse button\n] Shoots your missile\n");
     TutorialText.Add(TutorialText.Count, "If you search for close enemys, watch\nat the red dot on your Drone.");
     TutorialText.Add(TutorialText.Count, "I also heard of incoming asteroids.\nThe comets with the blue trail\noffer a nice income.");
     TutorialText.Add(TutorialText.Count, "Before you start, visit the shop\nand buy something with that loaned\nmoney we gave you!");
     TutorialText.Add(TutorialText.Count, "I'll now give you your controls back!\nBut stay in radio range.");
     TutorialText.Add(TutorialText.Count, "Press (X) to start your mission!");
     TutorialText.TryGetValue(0, out tutorialMessage);
 }
示例#6
0
        public virtual void Update()
        {
            if (!_isRendering)
            {
                return;
            }

            PreUpdateCallback?.Invoke(this, new EventArgs());

            // Mouse inputs are for dashboards only right now.

            if (InGameOverlay != null)
            {
                while (InGameOverlay.PollEvent(ref eventData))
                {
                    EVREventType type = (EVREventType)eventData.eventType;

                    HandleEvent(type, eventData);
                }
            }

            if (DashboardOverlay != null)
            {
                while (DashboardOverlay.PollEvent(ref eventData))
                {
                    EVREventType type = (EVREventType)eventData.eventType;

                    HandleEvent(type, eventData);
                }
            }

            if ((!EnableNonDashboardInput || InGameOverlay == null) && DashboardOverlay != null && !DashboardOverlay.IsVisible())
            {
                if (_wasVisible)
                {
                    _wasVisible = false;
                    HandleMouseLeaveEvent();
                }
                return;
            }

            _wasVisible = true;

            PostUpdateCallback?.Invoke(this, new EventArgs());
        }
示例#7
0
        public virtual void Draw()
        {
            if (!CanDoUpdates())
            {
                return;
            }

            PreDrawCallback?.Invoke(this, new EventArgs());

            var newbitmap = _browser.ScreenshotAsync().Result;

            if (newbitmap != null)
            {
                if (_bitmap != null)
                {
                    _bitmap.Dispose();
                }
                _bitmap           = newbitmap;
                _browserDidUpdate = true;
            }
            UpdateTexture();

            if (_bitmap != null)
            {
                if (DashboardOverlay != null && DashboardOverlay.IsVisible())
                {
                    DashboardOverlay.SetTexture(ref _textureData);
                    DashboardOverlay.Show();
                }

                if (InGameOverlay != null && InGameOverlay.IsVisible())
                {
                    InGameOverlay.SetTexture(ref _textureData);
                    InGameOverlay.Show();
                }
            }

            PostDrawCallback?.Invoke(this, new EventArgs());
        }
        //#################################
        // Constructor
        //#################################
        public DemoGameplayScreen()
        {
            TransitionOnTime  = TimeSpan.FromSeconds(1.5);
            TransitionOffTime = TimeSpan.FromSeconds(0.5);

            //actual gameplay objects
            _station       = new Station(new Vector3(0, _stationHeight, 0), 0);
            _sphere        = new Sphere(new Vector3(0, _stationHeight / 2, 0), 0);
            _asteroidField = new AsteroidBuilder(40);
            _droneFleet    = new DroneBuilder();

            _sphereAlpha = 0.1f;
            _waveBuilder = new DemoWaveBuilder(4000, 4);
            _boidBuilder = new DemoBoidBuilder(0, 1);
            Global.Money = 0;
            //UI + Frame + BG
            _ui    = new InGameOverlay(_station);
            _back  = new Background();
            _frame = new Frame();
            Global.HighScorePoints = 0;
            Global.Money           = 0;
            Global.DroneDmg        = 10;
            Global.NumberOfRockets = 1;
            _input       = new InputState();
            _planet      = new Planet(new Vector3(-1000, -2000, -1000), 0);
            _soundEngine = new ISpaceSoundEngine(SoundOutputDriver.AutoDetect, SoundEngineOptionFlag.LoadPlugins | SoundEngineOptionFlag.MultiThreaded | SoundEngineOptionFlag.MuteIfNotFocused | SoundEngineOptionFlag.Use3DBuffers);

            // Construct Particles
            borderParticles    = new BorderParticleSettings();
            dustParticles      = new DustParticleSystem();
            hitmarkerParticles = new HitMarkerParticleSystem();

            captainDialog        = new Dialog(0, 0, 320, 400, 8, false, true);
            captain              = new UIItem();
            deadTime             = 17000;
            voice                = false;
            Global.SpeakerVolume = 2;
        }
 void Start()
 {
     inGameOverlay = new InGameOverlay();
     inGameOverlay.nearReticleAngle = 15f;//degrees
     StartCoroutine(Spawner());
 }