using Microsoft.Xna.Framework;
using MonoGame.FourEngine;
using System.Configuration;

namespace Raycast.Win32
{
    public class Configuration
    {
        public static float MouseSensitivity = 2f;

        public static float AutoAimAmount = 0.1f;

        public static float SpawnChance = 0.003f;

        public static readonly Point Size = new Point(700, 500);

        public static void Apply(IFourEngineGame game)
        {
            if (float.TryParse(ConfigurationManager.AppSettings[nameof(MouseSensitivity)], out var mouseSensitivity))
            {
                MouseSensitivity = mouseSensitivity;
            }

            if (float.TryParse(ConfigurationManager.AppSettings[nameof(AutoAimAmount)], out var autoAimAmount))
            {
                AutoAimAmount = autoAimAmount;
            }

            if (float.TryParse(ConfigurationManager.AppSettings[nameof(SpawnChance)], out var spawnChance))
            {
                SpawnChance = spawnChance;
            }

            game.TargetFps = 30;
            game.Resolution = Size;
        }
    }
}