优化:正确的设置洞的基点

pull/1912/head
ChenX 2 years ago
parent e80e4cae75
commit 8238cfccc1

@ -184,7 +184,7 @@ export class Command_DrawHole implements Command
hole.Position = new Vector3(0, 0, 800);
JigUtils.Draw(hole);
let jigWalls: RoomWallBase[];
let fakerWalls: RoomWallBase[];
let helper = new RoomWallPlaceLHoleHelper();
if (!helper._stands.length)
@ -220,7 +220,7 @@ export class Command_DrawHole implements Command
if (v)
{
preWalls = undefined;
jigWalls = [];
fakerWalls = [];
let breakData = RoomWallParse._CacheWallMaps[helper._standGroupIndexMap.get(v)][0];
@ -254,8 +254,8 @@ export class Command_DrawHole implements Command
else
wall2.EndPoint = wall2.GetPointAtDistance(800);
jigWalls.push(wall1);
jigWalls.push(wall2);
fakerWalls.push(wall1);
fakerWalls.push(wall2);
for (let i = 0; i < walls.length; i++)
{
@ -276,23 +276,24 @@ export class Command_DrawHole implements Command
}
else
{
if (jigWalls)
if (fakerWalls)
{
let moveV = p.clone().sub(jigWalls[0].EndPoint);
for (let wall of jigWalls)
let moveV = p.clone().sub(fakerWalls[0].EndPoint);
for (let wall of fakerWalls)
wall.Move(moveV);
}
else
{
jigWalls = [
fakerWalls = [
new RoomWallLine(p.clone().add(new Vector3(0, 800, 0)), p.clone()),
new RoomWallLine(p.clone(), p.clone().add(new Vector3(800, 0, 0))),
];
}
}
new RoomWallParse(false, undefined, false).Parse(jigWalls);
hole.FakerWalls = jigWalls;
new RoomWallParse(false, undefined, false).Parse(fakerWalls);
hole.Position = fakerWalls[0].StartPoint.add(new Vector3(0, 0, 800));//在设置fakerwalls时 会改变它的位置,所以我们先复制这个点
hole.FakerWalls = fakerWalls;
hole.UpdatePoints();
return v;
@ -359,7 +360,7 @@ export class Command_DrawHole implements Command
hole.Position = new Vector3(0, 0, 800);
JigUtils.Draw(hole);
let jigWalls: RoomWallBase[];
let fakerWalls: RoomWallBase[];
let preR: Route;
let preWalls: RoomWallBase[];
@ -411,7 +412,7 @@ export class Command_DrawHole implements Command
else
wall2.EndPoint = r2.to.position;
jigWalls = [wall1, wall, wall2];
fakerWalls = [wall1, wall, wall2];
preWalls = orgWalls;
for (let i = 0; i < orgWalls.length; i++)
@ -429,24 +430,25 @@ export class Command_DrawHole implements Command
orgWall.Update();
}
}
else if (jigWalls)
else if (fakerWalls)
{
let moveV = p.clone().sub(jigWalls[1].GetPointAtParam(0.5));
for (let wall of jigWalls)
let moveV = p.clone().sub(fakerWalls[1].GetPointAtParam(0.5));
for (let wall of fakerWalls)
wall.Move(moveV);
}
if (!jigWalls)
if (!fakerWalls)
{
jigWalls = [
fakerWalls = [
new RoomWallLine(p.clone().add(new Vector3(-400, 600, 0)), p.clone().add(new Vector3(-400, 0, 0))),
new RoomWallLine(p.clone().add(new Vector3(-400, 0, 0)), p.clone().add(new Vector3(400, 0, 0))),
new RoomWallLine(p.clone().add(new Vector3(400, 0, 0)), p.clone().add(new Vector3(400, 600, 0))),
];
}
new RoomWallParse(false, undefined, false).Parse(jigWalls);
new RoomWallParse(false, undefined, false).Parse(fakerWalls);
hole.FakerWalls = jigWalls;
hole.Position = fakerWalls[0].StartPoint.add(new Vector3(0, 0, 800));//在设置fakerwalls时 会改变它的位置,所以我们先复制这个点
hole.FakerWalls = fakerWalls;
hole.UpdatePoints();
return route;

Loading…
Cancel
Save