//útok a borana na kliknutí - l na blízkost, p na dálku , prostřední na obranu
        private void MouseButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (unblocked)
            {
                //zapotřebí předem identifikovat pro detekci více tlačítek
                bool l = e.ChangedButton == MouseButton.Left;
                bool r = e.ChangedButton == MouseButton.Right;
                bool m = e.ChangedButton == MouseButton.Middle;

                //plInteract.pickAttack(l,r,m);
                plInteract.pickAttack2(l, r);

                clickDelay.Start(); // spustí pro znovusprovoznění lačítka
                unblocked = false;  // zablokuje
            }
        }
Exemplo n.º 2
0
        public Fight(IEnemy enemy, Player player)
        {
            c = interact.getContext();

            enemyControl             = c.enemyControl;
            c.randomMovemet.Interval = enemy.MovementSpeed;

            c.randomMovemet.Start();

            c.fight.IsEnabled = true;
            interact.show(c.fight);
            c.stats.IsEnabled = false;
            //c.equip.IsEnabled = false;
            c.story.IsEnabled = false;

            interact.collapse(c.stats);
            //interact.collapse(c.equip);
            interact.collapse(c.story);

            c.manaRecovery.Start();
            c.enduranceRecovery.Start();

            c.enemyControl.Width = enemy.enWidth;

            c.en_hp.Maximum = enemy.maxHP;
            c.en_hp.Value   = enemy.maxHP;
            enemy.HP        = enemy.maxHP;

            c.hp.Maximum = player.maxHP;
            c.hp.Value   = player.maxHP;
            player.HP    = player.maxHP;

            c.mana.Maximum = player.manaMax;
            c.mana.Value   = player.manaMax;
            player.Mana    = player.manaMax;

            c.endurance.Maximum = player.enduranceMax;
            c.endurance.Value   = player.enduranceMax;
            player.Endurance    = player.enduranceMax;

            ImageSource enSource = enemy.Img;

            ImageBehavior.SetAnimatedSource(enemyControl, enSource);

            ImageSource plSource = player.skin;

            ImageBehavior.SetAnimatedSource(c.playerControl, plSource);

            interact.hide(c.playerWeapon);

            c.textureBrush.ImageSource = enemy.Background;

            player.won = false;

            PlayerIntercations plI = new PlayerIntercations();

            plI.pickWeapon();
            plI.pickWeapon();
            plI.pickAttack2(true, false);
            interact.hide(c.playerWeapon);
        }