Example #1
0
        public void Draw(BloomComponent bloom, bool isActive, bool isBloom)
        {
            switch (State)
            {
            case GameStates.loading:
                _spriteBatch.Begin();
                //DebugTextManager.DrawTextToScreenLeft(_spriteBatch, 3, "Loading Level");
                _spriteBatch.End();
                break;

            case GameStates.updating:

                // Sometimes there is a discrepency due to methods calling world update
                Camera.Pos = ConvertUnits.ToDisplayUnits(_shipManager.PlayerShip.Position);

                if (isBloom)
                {
                    _spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
                    _spriteBatch.Draw(bloom.screenTarget, Vector2.Zero, Color.White);

                    _spriteBatch.End();


                    _spriteBatch.Begin();

                    Debugging.DebugTextManager.DrawTextToScreenRight(_spriteBatch, 25, "Bullets: " + _projectileManager.GetProjectileCount());
                    Debugging.DebugTextManager.DrawTextToScreenRight(_spriteBatch, 26, "Structures: " + _structures.Count);
                    Debugging.DebugTextManager.DrawTextToScreenRight(_spriteBatch, 27, "Latency: " + (MainNetworkingManager.LastLatency * 1000) + "ms");
                    Debugging.DebugTextManager.DrawTextToScreenRight(_spriteBatch, 28, "NPCs: " + Debugging.SimulationManager.GetSimulatedShips().Count);
                    Debugging.DebugTextManager.DrawTextToScreenRight(_spriteBatch, 29, "Player Speed: " + LegacyStatics.playerShipManager.PlayerShip.LinearVelocity.Length());
                    Debugging.DebugTextManager.DrawTextToScreenRight(_spriteBatch, 30, "Player Location: " + LegacyStatics.playerShipManager.PlayerShip.Position.ToString());



                    Vector2 mousePoss = MousePosToSimUnits(_shipManager.PlayerShip, _spriteBatch);

                    //float shipToMousAngle = AIHelper.GetRotationToPosition(_shipManager.PlayerShip.Position, mousePoss, _shipManager.PlayerShip.Rotation) * 180 / (float)Math.PI;
                    float shipToMousAngle = AIHelper.GetAngleToPosition(_shipManager.PlayerShip.Position, mousePoss) * 180 / (float)Math.PI;
                    float shipAngle       = AIHelper.ClampRotation(_shipManager.PlayerShip.Rotation) * 180 / (float)Math.PI;
                    //AIHelper.TurnTowardPosition(ref mouseToShipAngle, .10f, mousePoss, _shipManager.PlayerShip.Position, .00001f, 10f);
                    float angleToRotate = AIHelper.GetRotationToPosition(_shipManager.PlayerShip.Position, mousePoss, _shipManager.PlayerShip.Rotation) * 180 / (float)Math.PI;

                    Debugging.DebugTextManager.DrawTextToScreenRight(_spriteBatch, 31, "Angle, Ship To Mouse: " + shipToMousAngle);
                    Debugging.DebugTextManager.DrawTextToScreenRight(_spriteBatch, 32, "Ship Angle, clamped: " + shipAngle);
                    Debugging.DebugTextManager.DrawTextToScreenRight(_spriteBatch, 33, "Angle to rotate: " + angleToRotate);
                    //Main.DebugTextManager.DrawTextToScreenRight(_spriteBatch, 26, "FPS: " + Main.DebugTextManager.getFPS());


                    _spriteBatch.End();
                }

                _UI.Draw(_spriteBatch);

                break;
            }
        }