Пример #1
0
        public void TakeDamage(Player player, Enemy enemy, Hud hud)
        {
            player.health = player.health - enemy.attack;

            if (player.health <= 0)
            {
                player.health = 0;
                player.alive  = false;

                Hud.GameOver();
            }

            hud.ShowPlayerStats(player);
        }
Пример #2
0
        public void PlayGame()
        {
            itemManager.InitItems();
            itemManager.InitCoins(map);
            enemyManager.InitEnemies();
            shopManager.InitShops();
            hud.initHud();


            hud.ShowPlayerStats(player);
            SetUp();
            while (player.alive == true)
            {
                SetScreen();

                player.Update(map, player, enemyManager, camera, hud, inventory);
                enemyManager.Update(map, player, hud);
                itemManager.Update(player, hud, inventory);
                shopManager.Update(player, inventory);

                SetScreen();

                map.DisplayMap(camera, render, map);
                player.Draw(camera, render);
                enemyManager.Draw(camera, render);
                itemManager.Draw(camera, render, map);
                shopManager.Draw(camera, render);
                inventory.Draw();



                if (scrollingCamera)
                {
                    render.ScrollSetMap(player, camera, map);
                }
            }
        }