Esempio n. 1
0
        public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
        {
            cam.UpdateTransform(true);
            Submarine.CullEntities(cam);

            Stopwatch sw = new Stopwatch();

            sw.Start();

            DrawMap(graphics, spriteBatch, deltaTime);

            sw.Stop();
            GameMain.PerformanceCounter.AddElapsedTicks("DrawMap", sw.ElapsedTicks);
            sw.Restart();

            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, GameMain.ScissorTestEnable);

            if (Character.Controlled != null && cam != null)
            {
                Character.Controlled.DrawHUD(spriteBatch, cam);
            }

            if (GameMain.GameSession != null)
            {
                GameMain.GameSession.Draw(spriteBatch);
            }

            if (Character.Controlled == null && !GUI.DisableHUD)
            {
                for (int i = 0; i < Submarine.MainSubs.Length; i++)
                {
                    if (Submarine.MainSubs[i] == null)
                    {
                        continue;
                    }
                    if (Level.Loaded != null && Submarine.MainSubs[i].WorldPosition.Y < Level.MaxEntityDepth)
                    {
                        continue;
                    }

                    Color indicatorColor = i == 0 ? Color.LightBlue * 0.5f : Color.Red * 0.5f;
                    GUI.DrawIndicator(
                        spriteBatch, Submarine.MainSubs[i].WorldPosition, cam,
                        Math.Max(Submarine.MainSub.Borders.Width, Submarine.MainSub.Borders.Height),
                        GUI.SubmarineIcon, indicatorColor);
                }
            }

            GUI.Draw(cam, spriteBatch);

            spriteBatch.End();

            sw.Stop();
            GameMain.PerformanceCounter.AddElapsedTicks("DrawHUD", sw.ElapsedTicks);
            sw.Restart();
        }
Esempio n. 2
0
        public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
        {
            cam.UpdateTransform(true);
            Submarine.CullEntities(cam);

            DrawMap(graphics, spriteBatch);

            spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, GameMain.ScissorTestEnable);

            if (Character.Controlled != null && Character.Controlled.SelectedConstruction != null && Character.Controlled.CanInteractWith(Character.Controlled.SelectedConstruction))
            {
                Character.Controlled.SelectedConstruction.DrawHUD(spriteBatch, cam, Character.Controlled);
            }

            if (Character.Controlled != null && cam != null)
            {
                Character.Controlled.DrawHUD(spriteBatch, cam);
            }

            if (GameMain.GameSession != null)
            {
                GameMain.GameSession.Draw(spriteBatch);
            }

            if (Character.Controlled == null && !GUI.DisableHUD)
            {
                for (int i = 0; i < Submarine.MainSubs.Length; i++)
                {
                    if (Submarine.MainSubs[i] == null)
                    {
                        continue;
                    }
                    if (Level.Loaded != null && Submarine.MainSubs[i].WorldPosition.Y < Level.MaxEntityDepth)
                    {
                        continue;
                    }

                    Color indicatorColor = i == 0 ? Color.LightBlue * 0.5f : Color.Red * 0.5f;
                    DrawSubmarineIndicator(spriteBatch, Submarine.MainSubs[i], indicatorColor);
                }
            }

            GUI.Draw((float)deltaTime, spriteBatch, cam);

            spriteBatch.End();
        }
Esempio n. 3
0
        public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
        {
            cam.UpdateTransform(true);
            Submarine.CullEntities(cam);

            DrawMap(graphics, spriteBatch);

            spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, GameMain.ScissorTestEnable);

            if (Character.Spied != null && Character.Spied.SelectedConstruction != null && Character.Spied.CanInteractWith(Character.Spied.SelectedConstruction))
            {
                Character.Spied.SelectedConstruction.DrawHUD(spriteBatch, cam, Character.Spied);
            }
            else if (Character.Controlled != null && Character.Controlled.SelectedConstruction != null && Character.Controlled.CanInteractWith(Character.Controlled.SelectedConstruction))
            {
                Character.Controlled.SelectedConstruction.DrawHUD(spriteBatch, cam, Character.Controlled);
            }

            if (Character.Spied != null && cam != null)
            {
                Character.Spied.DrawHUD(spriteBatch, cam);
            }
            else if (Character.Controlled != null && cam != null)
            {
                Character.Controlled.DrawHUD(spriteBatch, cam);
            }

            if (GameMain.GameSession != null)
            {
                GameMain.GameSession.Draw(spriteBatch);
            }

            if (GameMain.NilMod.ShowObjectiveIndicatorsAsPlayer && !GUI.DisableHUD)
            {
                DrawIndicators(spriteBatch);
            }
            else if (Character.Controlled == null && !GUI.DisableHUD)
            {
                DrawIndicators(spriteBatch);
            }

            GUI.Draw((float)deltaTime, spriteBatch, cam);

            spriteBatch.End();
        }
Esempio n. 4
0
        public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
        {
            cam.UpdateTransform(true);
            Submarine.CullEntities(cam);

            foreach (Character c in Character.CharacterList)
            {
                c.AnimController.Limbs.ForEach(l => l.body.UpdateDrawPosition());
                bool wasVisible = c.IsVisible;
                c.DoVisibilityCheck(cam);
                if (c.IsVisible != wasVisible)
                {
                    c.AnimController.Limbs.ForEach(l =>
                    {
                        if (l.LightSource != null)
                        {
                            l.LightSource.Enabled = c.IsVisible;
                        }
                    });
                }
            }

            Stopwatch sw = new Stopwatch();

            sw.Start();

            DrawMap(graphics, spriteBatch, deltaTime);

            sw.Stop();
            GameMain.PerformanceCounter.AddElapsedTicks("DrawMap", sw.ElapsedTicks);
            sw.Restart();

            spriteBatch.Begin(SpriteSortMode.Deferred, null, GUI.SamplerState, null, GameMain.ScissorTestEnable);

            if (Character.Controlled != null && cam != null)
            {
                Character.Controlled.DrawHUD(spriteBatch, cam);
            }

            if (GameMain.GameSession != null)
            {
                GameMain.GameSession.Draw(spriteBatch);
            }

            if (Character.Controlled == null && !GUI.DisableHUD)
            {
                for (int i = 0; i < Submarine.MainSubs.Length; i++)
                {
                    if (Submarine.MainSubs[i] == null)
                    {
                        continue;
                    }
                    if (Level.Loaded != null && Submarine.MainSubs[i].WorldPosition.Y < Level.MaxEntityDepth)
                    {
                        continue;
                    }

                    Vector2 position = Submarine.MainSubs[i].SubBody != null ? Submarine.MainSubs[i].WorldPosition : Submarine.MainSubs[i].HiddenSubPosition;

                    Color indicatorColor = i == 0 ? Color.LightBlue * 0.5f : GUI.Style.Red * 0.5f;
                    GUI.DrawIndicator(
                        spriteBatch, position, cam,
                        Math.Max(Submarine.MainSub.Borders.Width, Submarine.MainSub.Borders.Height),
                        GUI.SubmarineIcon, indicatorColor);
                }
            }

            GUI.Draw(cam, spriteBatch);

            spriteBatch.End();

            sw.Stop();
            GameMain.PerformanceCounter.AddElapsedTicks("DrawHUD", sw.ElapsedTicks);
            sw.Restart();
        }