private void DoProcess() { try { do { this.DoMove(2); if ((this.m_level == 3) && (this.m_secondBullet == null)) { if (this.m_secondBulletLoad > 0) { this.m_secondBulletLoad--; } else { this.m_secondBullet = new Bullet(this.m_canvas, this.m_owner, 2); } } Thread.Sleep(5); } while (this.m_processThread.IsAlive); } catch { } }
private void Fire() { if (this.m_bulletDelay == 0) { if ((this.m_bullet != null) && (this.m_bullet.Life < 0)) { this.m_bullet.Dispose(); this.m_bullet = null; } if (this.m_bullet == null) { this.m_bullet = new Bullet(this.m_canvas, this, 1); } this.m_bulletDelay = 20; } }
protected override bool CanMove(int x, int y) { if (this.m_canvas != null) { bool canMove = true; try { bool hit = false; this.HitCanvas(this.m_canvas.Rectangle, x, y, ref canMove); if ((this.m_canvas.Home != null) && (this.m_canvas.Home.Life > 1)) { hit = this.HitTest(this.m_canvas.Home.Rectangle, x, y, ref canMove); if (hit) { this.m_canvas.Home.Life = 1; } } for (int i = 0; i < this.m_canvas.MapItemsHomeCover.Length; i++) { MapItem item = this.m_canvas.MapItemsHomeCover[i]; if ((item != null) && (item.Life > 0)) { hit = this.HitTest(item.Rectangle, x, y, ref canMove); if (hit) { if (item.Type == MapItemTypes.brick) { this.m_canvas.MapItemsHomeCover[i].Face = this.m_face; if (this.m_level < 2) { this.m_canvas.MapItemsHomeCover[i].Life = item.Life - 1; } else { this.m_canvas.MapItemsHomeCover[i].Life = 0; } } else if ((item.Type == MapItemTypes.ferum) && (this.m_level == 3)) { this.m_canvas.MapItemsHomeCover[i].Face = this.m_face; this.m_canvas.MapItemsHomeCover[i].Life = 0; } } } } for (int i = 0; i < this.m_canvas.MapItemsBrick.Count; i++) { MapItem item = this.m_canvas.MapItemsBrick[i]; if ((item != null) && (item.Life > 0)) { hit = this.HitTest(item.Rectangle, x, y, ref canMove); if (hit) { this.m_canvas.MapItemsBrick[i].Face = this.m_face; if (this.m_level < 2) { this.m_canvas.MapItemsBrick[i].Life = item.Life - 1; } else { this.m_canvas.MapItemsBrick[i].Life = 0; } } } } for (int i = 0; i < this.m_canvas.MapItemsFerum.Count; i++) { MapItem item = this.m_canvas.MapItemsFerum[i]; if ((item != null) && (item.Life > 0)) { hit = this.HitTest(item.Rectangle, x, y, ref canMove); if ((hit) && (this.m_level == 3)) { this.m_canvas.MapItemsFerum[i].Face = this.m_face; this.m_canvas.MapItemsFerum[i].Life = 0; } } } if (this.m_owner is Player) { for (int e = 0; e < this.m_canvas.Enemy.Length; e++) { if ((this.m_canvas.Enemy[e] != null) && (!this.m_canvas.Enemy[e].IsPortal) && (this.m_canvas.Enemy[e].Life > 0)) { if ((this.m_canvas.Enemy[e].Bullet != null) && (this.m_canvas.Enemy[e].Bullet.Life > 1)) { hit = this.HitTest(this.m_canvas.Enemy[e].Bullet.Rectangle, x, y, ref canMove); if (hit) { this.m_canvas.Enemy[e].Bullet.Life = -1; this.Life = -1; break; } } hit = this.HitTest(this.m_canvas.Enemy[e].Rectangle, x, y, ref canMove); if (hit) { this.m_canvas.Enemy[e].Life -= 1; this.Life = -1; if (this.m_secondBullet != null) { this.m_secondBullet.Dispose(); this.m_secondBullet = null; } break; } } } } else if (this.m_owner is Enemies) { if ((this.m_canvas.Player1 != null) && (!this.m_canvas.Player1.IsPortal) && (this.m_canvas.Player1.Life > 0)) { hit = this.HitTest(this.m_canvas.Player1.Rectangle, x, y, ref canMove); if (hit) { TRACE("Hit on Player! Life : " + this.m_canvas.Player1.Life.ToString()); if (!this.m_canvas.Player1.HasArmor) { this.m_canvas.Player1.Life = this.m_canvas.Player1.Life - 1; } this.Life = -1; } } } canMove = (canMove && base.CanMove(x, y)); } catch { return false; } return canMove; } return false; }