Example #1
0
 public override void OnExit()
 {
     UpdateManager.RemoveAll();
     DrawManager.RemoveAll();
     PhysicsManager.RemoveAll();
     GfxManager.RemoveAll();
     BulletManager.RemoveAll();
     SpawnManager.RemoveAll();
 }
Example #2
0
        public Bar(Vector2 position, string textureName = "playerBar", float maxValue = 100, int height = 0) : base(position, textureName, DrawManager.Layer.GUI)
        {
            barWidth = texture.Width;
            value    = MaxValue = maxValue;
            //sprite.scale = new Vector2(texture.Width, 1);

            frameTexture   = GfxManager.GetSpritesheet("barFrame").Item1;
            frame          = new Sprite(frameTexture.Width, frameTexture.Height);
            frame.position = position;
        }
Example #3
0
 public GameObject(Vector2 spritePosition, string textureName, DrawManager.Layer drawLayer = DrawManager.Layer.Playground, int spriteWidth = 0, int spriteHeight = 0)
 {
     texture         = GfxManager.GetTexture(textureName);
     sprite          = new Sprite(spriteWidth > 0 ? spriteWidth : texture.Width, spriteHeight > 0 ? spriteHeight : texture.Height);
     sprite.position = spritePosition;
     layer           = drawLayer;
     IsActive        = true;
     UpdateManager.AddItem(this);
     DrawManager.AddItem(this);
 }
Example #4
0
        public GameObject(
            Vector2 spritePosition, string spritesheetName,
            DrawManager.Layer drawLayer = DrawManager.Layer.Playground)
        {
            Tuple <Texture, Animation> ss = GfxManager.GetSpritesheet(spritesheetName);

            texture   = ss.Item1;
            Animation = ss.Item2;

            sprite          = new Sprite(Animation.FrameWidth, Animation.FrameHeight);
            sprite.position = spritePosition;
            layer           = drawLayer;
            IsActive        = true;
            UpdateManager.AddItem(this);
            DrawManager.AddItem(this);
        }
Example #5
0
        public static void Play()
        {
            GfxManager.Load();
            player = new Player("player", new Vector2(window.Width / 2, window.Height / 2));
            bg     = new Background("bg", Vector2.Zero, -220);

            string[] joysticks = Game.window.Joysticks;

            for (int i = 0; i < joysticks.Length; i++)
            {
                if (joysticks[i] != null && joysticks[i] != "Unmapped Controller")
                {
                    NumJoysticks++;
                }
            }
            while (window.opened)
            {
                //totalTime += GfxTools.Win.deltaTime;
                Console.SetCursorPosition(0, 0);
                Console.Write((1 / window.deltaTime) + "                   ");

                //Input
                if (window.GetKey(KeyCode.Esc))
                {
                    break;
                }
                if (player.IsActive)
                {
                    player.Input();
                }

                //Update
                PhysicsManager.Update();
                UpdateManager.Update();
                PhysicsManager.CheckCollisions();
                SpawnManager.Update();


                //Draw
                DrawManager.Draw();



                window.Update();
            }
        }
Example #6
0
        public override void Start()
        {
            base.Start();
            GfxManager.AddTexture("player", "Assets/player_ship.png");
            GfxManager.AddTexture("bg", "Assets/spaceBg.png");
            GfxManager.AddTexture("bullets", "Assets/beams.png");
            GfxManager.AddTexture("enemy", "Assets/enemy_ship.png");
            GfxManager.AddTexture("enemy2", "Assets/redEnemy_ship.png");
            GfxManager.AddTexture("fireGlobe", "Assets/fireGlobe.png");
            GfxManager.AddTexture("blueLaser", "Assets/blueLaser.png");
            GfxManager.AddTexture("playerBar", "Assets/loadingBar_bar.png");
            GfxManager.AddTexture("barFrame", "Assets/loadingBar_frame.png");
            GfxManager.AddTexture("powerUp_Nrg", "Assets/powerUp_battery.png");

            UpdateManager.Init();
            DrawManager.Init();
            PhysicsManager.Init();
            BulletManager.Init();
            SpawnManager.Init();

            player = new Player("player", new Vector2(Game.window.Width / 2, Game.window.Height / 2));
            bg     = new Background("bg", Vector2.Zero, -220);
        }