public Controler(IfrmMain view) { timer = new Timer(); timer.Enabled = true; timer.Tick += new EventHandler(test); timer.Interval = 20; View = view; User能力 = new Game_User能力(View); 特效 = new 傷害特效_2(); Monster = new monster(View, this, User能力); 傷害數字 = new Game_傷害數字(); 子彈 = new Game_子彈(this, 特效); Auto = new Game_AutoAttack(子彈, User能力, 特效); hit = new Game_Hit(View, Monster, 子彈, User能力, 傷害數字, 特效); 繪圖Action = new _繪圖(View, 傷害數字, Monster, 子彈, 特效, User能力); /* 以下為建立Test用*/ //form2 = new Test(); //form2.Visible = true; /* 以上為建立Test用*/ // information = user; View.Set_Level = "目前等級為: " + User能力.Get_Set_level + "等!"; }
public Game_子彈(Controler controler, IGame_傷害特效 _特效) { 特效 = _特效; Controler = controler; I子彈 = new Timer(); I子彈.Enabled = true; I子彈.Tick += new EventHandler(子彈移動); I子彈.Interval = 10; }
public Game_AutoAttack(I子彈 _子彈, IGame_User能力 _能力, IGame_傷害特效 _特效) { 子彈 = _子彈; 能力 = _能力; 特效 = _特效; Timer_AutoAttack = new Timer(); Timer_AutoAttack.Enabled = true; Timer_AutoAttack.Tick += new EventHandler(speed_Tick); Timer_AutoAttack.Interval = 35; }
/// <summary> /// 建構式 /// </summary> /// <param name="monster"></param> /// <param name="_子彈"></param> /// <param name="_傷害"></param> public Game_Hit(IfrmMain main, IMonster monster, I子彈 _子彈, IGame_User能力 _傷害, IGame_傷害數字 Number, IGame_傷害特效 _特效) { Main = main; Monster = monster; 子彈 = _子彈; 能力 = _傷害; 特效 = _特效; Show_Number = Number; Check_Attack = new Timer(); Check_Attack.Enabled = true; Check_Attack.Interval = 10; Check_Attack.Tick += new EventHandler(成攻擊); }
public _繪圖(IfrmMain _View, IGame_傷害數字 _傷害數字, IMonster _Monster, I子彈 _子彈, IGame_傷害特效 _特效, IGame_User能力 _能力) { View = _View; 傷害數字 = _傷害數字; Monster = _Monster; 子彈 = _子彈; 特效 = _特效; 能力 = _能力; SuperMan = new Bitmap(Properties.Resources.超人, 200, 150); Pen pen_write = new Pen(Color.White, 30); 經驗底線 = new Bitmap(1920, 30); using (var g = Graphics.FromImage(經驗底線)) { int x = (int)(View._width / 10); for (int y = x; y < View._width; y += x) { g.DrawLine(pen_write, new Point(y, 0), new Point(y + 2, 0)); } } }