/// <summary> /// 刷新魔塔地图 /// </summary> public override void NextFrame() { //对当前楼层的所有元素刷新一次 CurFloorNode.Refresh(); //驱动人物运转 CurHero.Play(); //地图晃动计数 View.ShakeCount++; GuidePoint.Play(); base.NextFrame(); }
/// <summary> /// 绘制地图 /// </summary> /// <param name="canvas">画布</param> /// <param name="paintRange">绘制范围</param> private void DrawMap(Graphics canvas, CoordRange paintRange) { for (int i = paintRange.startPos.Row; i < paintRange.endPos.Row; i++) { for (int j = paintRange.startPos.Col; j < paintRange.endPos.Col; j++) { CurFloorNode.Draw(canvas, new Coord(j, i)); } //在人物出现的那一行绘制人物,实现覆盖效果 if (CurHero.Station.Row == i) { CurHero.Draw(canvas); } } }
/// <summary> /// 处理按键进行人物移动和道具使用 /// </summary> /// <param name="code">按键</param> /// <returns>返回一个布尔值,标示按键是否被处理</returns> public override bool HandleKeyDown(System.Windows.Forms.Keys code) { //委托勇士对象处理按键 return(CurHero.HandleKeyDown(code)); }