Beispiel #1
0
 public void Update_INFO(object sender, NumOfEnemy arg)
 {
     // th1 = new Thread(new ParameterizedThreadStart(Update_Info_thread));
     if (th1 == null)
     {
         th1 = new Thread(new ParameterizedThreadStart(Update_Info_thread));
     }
     //else
     if (th1.ThreadState == System.Threading.ThreadState.Aborted || th1.ThreadState == System.Threading.ThreadState.Running)
     {
         th1 = new Thread(new ParameterizedThreadStart(Update_Info_thread));
     }
     if (th1.ThreadState == System.Threading.ThreadState.Stopped)
     {
         th1 = new Thread(new ParameterizedThreadStart(Update_Info_thread));
     }
     //else
     try
     {
         th1.Start(arg.i);
     }
     catch (Exception) { }
     //if (th1.ThreadState == System.Threading.ThreadState.Stopped)
     //    th1.Resume();
 }
Beispiel #2
0
        public void Fight_Source(object sender, NumOfEnemy arg)
        {
            Player_HP.Visible     = true;
            Enemy_HP.Visible      = true;
            Hero_Stats.Visible    = true;
            Enemy_Stats.Visible   = true;
            Attack_Button.Visible = true;
            STOIKA_BUTTON.Visible = true;
            hodiki.Visible        = true;
            hodiki.ForeColor      = Color.Green;
            Random rnd = RandomProvider.GetThreadRandom();

            if (!IsHeroCreated)
            {
                hero          = new Hero(stHP, stHP, stDMG, stEvadeChance, stBlockChance, CriticalDmgChance, CriticalDmg);
                IsHeroCreated = true;
            }
            int enemyFullhp = (int)rnd.Next(enstHP + Dungeon_Number * 5, enstHP + Dungeon_Number * 7);

            enemy = new Enemy(enemyFullhp,
                              enemyFullhp,
                              rnd.Next(enstDMG + Dungeon_Number * 3, enstDMG + Dungeon_Number * 5),
                              rnd.Next(enstEvadeChance + Dungeon_Number, enstEvadeChance + Dungeon_Number * 2),
                              rnd.Next(enstBlockChance + Dungeon_Number, enstBlockChance + Dungeon_Number * 3),
                              rnd.Next(enCriticalDmgChance + Dungeon_Number * 2, enCriticalDmgChance + Dungeon_Number * 3),
                              rnd.Next(enCriticalDmg + Dungeon_Number * 5, enCriticalDmg + Dungeon_Number * 7));
            Application.DoEvents();
            UpdInfo.Invoke(this, new NumOfEnemy {
                i = arg.i
            });
        }
Beispiel #3
0
 private void TurnEnemy(object sender, NumOfEnemy e) //enemy
 {
     th1 = new Thread(new ParameterizedThreadStart(_thread2));
     if (th1.ThreadState != System.Threading.ThreadState.Running)
     {
         th1.Start(e.i);
     }
 }
Beispiel #4
0
 private void TurnHero(object sender, NumOfEnemy e) //hero
 {
     th1 = new Thread(new ParameterizedThreadStart(_thread));
     if (th1.ThreadState == System.Threading.ThreadState.Running)
     {
         th1.Abort();
     }
     th1.Start(e.i);
 }