增加涡流修改器

This commit is contained in:
tianmo committed 2026-09-22 15:58:28 +08:00
1 parent 3f2699a946
commit 5f3a4a33fe
10 files changed
+136 -7

No files matched your search

+28
View File
@@ -132,6 +132,34 @@ export function drawForceField(store: EditorStore, forceFieldGfx: Graphics | nul
g.endFill()
}
/** 绘制当前选中系统的全局漩涡范围与旋转方向。 */
export function drawVortex(store: EditorStore, vortexGfx: Graphics | null) {
if (!vortexGfx) return
const g = vortexGfx
g.clear()
const sys = store.systems.find((item) => item.id === store.activeId)
if (sys?.visible === false) return
const cfg = sys?.config
if (!cfg?.vortex || cfg.vortexRadius <= 0) return
const x = cfg.vortexCenterX
const y = -cfg.vortexCenterY
const color = cfg.vortexStrength >= 0 ? 0xb97cff : 0xffa24c
g.lineStyle(2, color, 0.9)
g.beginFill(color, 0.07)
g.drawCircle(x, y, cfg.vortexRadius)
g.endFill()
g.beginFill(color, 0.95)
g.drawCircle(x, y, 4)
g.endFill()
const markerX = x + Math.min(cfg.vortexRadius * 0.65, 50)
const direction = cfg.vortexStrength >= 0 ? -1 : 1
const endY = y + direction * 14
g.lineStyle(2, color, 0.9)
g.moveTo(markerX, y + direction * -8); g.lineTo(markerX, endY)
g.moveTo(markerX, endY); g.lineTo(markerX - 4, endY - direction * 5)
g.moveTo(markerX, endY); g.lineTo(markerX + 4, endY - direction * 5)
}
/** 绘制全局吸附点与吸附完成半径;半径为 0 时显示为红色点。 */
export function drawAttraction(store: EditorStore, attractionGfx: Graphics | null) {
if (!attractionGfx) return