using KellysMarvelousAdventure.entities;
using KellysMarvelousAdventure.Scenes;
using KellysMarvelousAdventure.UI;
using Otter;

namespace KellysMarvelousAdventure
{
    class TitleScreen : Scene
    {
        public Image titleImage = new Image(Assets.TITLESCREEN);

        public TitleScreen()
        {
            AddGraphic(titleImage);
            AddTitle();
            AddOnePlayerStart();
            Add(new Oldman(Global.MW / 2, Global.MH / 2, true));
        }

        public override void Update()
        {
            base.Update();
            if (Global.PlayerSession.Controller.Button("Start").Pressed)
            {
                Global.PlayerX = 0.0f;
                Global.PlayerY = 0.0f;
                Global.PlayerHealth = 10;
                Global.PlayerSpeed = new Speed(300);//was 300 testing

                Global.Player2X = 0.0f;
                Global.Player2Y = 0.0f;
                Global.Player2Health = 300;
                Global.Player2Speed = new Speed(300);//was 300 testing

                Global.isGirlSaidGadZooks = false;
                Global.isOldManActive = false;
                Global.doesPlayerHaveWagon = false;
                Global.catSpeed = .3f;
                Global.catBulletSpeed = Rand.Float(2f, 3f);
                Global.SpawnCatTimerMin = 700;//idk, to start
                Global.SpawnCatTimerMax = 900;//idk, to start
                Global.SpawnCatTimer = Rand.Int(Global.SpawnCatTimerMin, Global.SpawnCatTimerMax);//idk, to start
                Global.NumberOfShips = 12;

                Global.SapCollected = 0;
                Global.SapBombs = 0;
                Global.score = 0;
                Global.Clicks = 0;
                Global.kills = 0;
                Global.SapBar = 1;//how many you need to get a segment in the sap bar.
                Global.Increaser = 100;
                Global.once = true;
                //class public statics:
                Player.canPlayerCollide = true;
                Player.isSpritemapChanged = true;
                //load the level
                Global.GAME.RemoveScene();
                Global.GAME.AddScene(new Bedroom("Menu"));
            }

        }

        private void AddTitle()
        {
            string author = "You may begin by:";
            var y = 0;
            for (var i = 0; i < author.Length; i++)
            {
                Add(new Numbers(202 + y, 262, author[i].ToString(), Color.FromBytes(175, 100, 50, 255), 2f));
                Add(new Numbers(200 + y, 260, author[i].ToString(), Color.White, 2f));
                y += 17;
            }
        }

        private void AddOnePlayerStart()
        {
            string author = "Press enter! heheh";
            var y = 0;
            for (var i = 0; i < author.Length; i++)
            {
                Add(new Numbers(202 + y, 287, author[i].ToString(), Color.FromHSV(10, 1, .5f, 1), 2f));
                Add(new Numbers(200 + y, 285, author[i].ToString(), Color.White, 2f));
                y += 17;
            }
        }


    }
}

