激光门完毕
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type MapController from "./Map";
|
||||
import type Wall from "./Wall";
|
||||
import type Block from "./Block";
|
||||
import { LQCollide } from "./lq_collide_system/lq_collide";
|
||||
import { LQCollideSystem } from "./lq_collide_system/lq_collide_system";
|
||||
import { LQCollideShape } from "./lq_base/data/lq_const";
|
||||
@@ -173,23 +174,64 @@ export default class LaserSystem {
|
||||
}
|
||||
}
|
||||
|
||||
private collectColliders(): { shape: LaserCollider; wall: cc.Node }[] {
|
||||
const result: { shape: LaserCollider; wall: cc.Node }[] = [];
|
||||
/** Prediction only: movable blockers may clear; actual reception still uses every solid. */
|
||||
getPotentialExitIds(): Set<string> {
|
||||
const fixed = this.collectColliders().filter(item => !this.canMoveBlocker(item.block));
|
||||
const result = new Set<string>();
|
||||
for (const group of this.groups) {
|
||||
const obstacles = fixed.filter(item => item.wall !== group.emitter.node.parent
|
||||
&& item.wall !== group.receiver.node.parent).map(item => item.shape);
|
||||
// Scan to the receiver, including blockers hidden behind the visible beam's first hit.
|
||||
if (!nearestLaserHit(group.source.getBeamOrigin(), group.target.getBeamOrigin(), obstacles)) {
|
||||
result.add(group.config.id);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private canMoveBlocker(block: Block, visited = new Set<Block>()): boolean {
|
||||
if (!block || block.over || visited.has(block)) return false;
|
||||
visited.add(block);
|
||||
const info = block.block_Info || {};
|
||||
// Exit locks, question blocks and petal covers do not prevent dragging.
|
||||
// Temporary input locks during spawning/opening also need no elimination to clear.
|
||||
const hasAxis = (block.type !== 8 && info.vertical == null)
|
||||
|| (block.type !== 7 && info.horizontal == null);
|
||||
if ([3, 4, 10, 12].indexOf(block.type) < 0
|
||||
&& (!info.floor || info.floorMove === true) && hasAxis) return true;
|
||||
|
||||
const drivers: cc.Node[] = [];
|
||||
if (block.type === 10 && info.node) drivers.push(info.node);
|
||||
if (info.floor && info.floorMove === true) drivers.push(...(block.teamBlocks || []));
|
||||
// Adhesive followers can move even when they cannot be dragged directly.
|
||||
for (const node of this.map.node.children) {
|
||||
const driver = node.getComponent("Block") as Block;
|
||||
if (driver && driver.type === 9 && driver.block_Info && driver.block_Info.node === block.node) {
|
||||
drivers.push(node);
|
||||
}
|
||||
}
|
||||
return drivers.some(node => cc.isValid(node, true) && node.activeInHierarchy
|
||||
&& this.canMoveBlocker(node.getComponent("Block"), visited));
|
||||
}
|
||||
|
||||
private collectColliders(): { shape: LaserCollider; wall: cc.Node; block: Block }[] {
|
||||
const result: { shape: LaserCollider; wall: cc.Node; block: Block }[] = [];
|
||||
for (const collider of LQCollideSystem.collide_arr) {
|
||||
const node = collider.node;
|
||||
if (!cc.isValid(node, true) || !node.activeInHierarchy || !collider.is_enable
|
||||
|| !collider.enabled || collider.data_string === "-1" || collider.data_string === "-2") continue;
|
||||
if (node.name === "rise" && this.map.riseFallBlock.indexOf(node.parent) >= 0) continue;
|
||||
let ancestor = node, wall: cc.Node = null, transparent = false;
|
||||
let ancestor = node, wall: cc.Node = null, owner: Block = null, transparent = false;
|
||||
while (ancestor && ancestor !== this.map.node) {
|
||||
const block = ancestor.getComponent("Block");
|
||||
const block = ancestor.getComponent("Block") as Block;
|
||||
if (block && !owner) owner = block;
|
||||
if (block && (block.type === 22 || block.over)) transparent = true;
|
||||
if (ancestor.getChildByName("wall") && ancestor.getChildByName("wall").getComponent("Wall")) wall = ancestor;
|
||||
ancestor = ancestor.parent;
|
||||
}
|
||||
if (ancestor !== this.map.node || transparent) continue;
|
||||
const shape = this.colliderShape(collider);
|
||||
if (shape) result.push({ shape, wall });
|
||||
if (shape) result.push({ shape, wall, block: owner });
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2714,6 +2714,7 @@ export default class MapConroler extends cc.Component {
|
||||
for (let j = 0; j < cc.fx.GameConfig.WALL_INFO[0].length; j++) {
|
||||
for (let k = 0; k < this.wallArray.length; k++) {
|
||||
if (this.wallArray[k].getChildByName("wall").getComponent("Wall").num == cc.fx.GameConfig.WALL_INFO[0][j].num
|
||||
&& this.wallArray[k].getChildByName("wall").getComponent("Wall").wall_Info.laserId == null
|
||||
&& (this.wallArray[k].getChildByName("wall").getComponent("Wall").special != 2 && this.wallArray[k].getChildByName("wall").getComponent("Wall").special != 4
|
||||
&& this.wallArray[k].getChildByName("wall").getComponent("Wall").special != 5)) {
|
||||
|
||||
@@ -2835,7 +2836,7 @@ export default class MapConroler extends cc.Component {
|
||||
for (let i = 0; i < this.revolvingWallArray.length; i++) {
|
||||
let wall = this.revolvingWallArray[i][0].getChildByName("wall").getComponent("Wall");
|
||||
|
||||
if (wall.special == 2 || wall.special == 9 || wall.longAndShort.length > 0 || wall.colorArray.length > 0 || wall.wall_Info.toggle != undefined) {
|
||||
if (wall.special == 2 || wall.special == 9 || wall.wall_Info.laserId != null || wall.longAndShort.length > 0 || wall.colorArray.length > 0 || wall.wall_Info.toggle != undefined) {
|
||||
this.revolvingWallArray.splice(i, 1);
|
||||
i--;
|
||||
}
|
||||
@@ -7438,6 +7439,7 @@ export default class MapConroler extends cc.Component {
|
||||
if (this.blocks.length == 0) {
|
||||
return true;
|
||||
}
|
||||
const potentialLaserExits = this.laserSystem ? this.laserSystem.getPotentialExitIds() : null;
|
||||
let result = false;
|
||||
let colorOver = true;
|
||||
let openResult = 0; //0为没有开关门,1为有开关门门开着,2为没有开关门门关着
|
||||
@@ -7447,6 +7449,8 @@ export default class MapConroler extends cc.Component {
|
||||
//确保方块是可移动状态下再做判断
|
||||
if (this.blockCanMove(this.blocks[i])) {
|
||||
for (let j = 0; j < this.wall_Pass.length; j++) {
|
||||
const laserId = this.wall_Pass[j].wall_Info && this.wall_Pass[j].wall_Info.laserId;
|
||||
if (laserId != null && potentialLaserExits && !potentialLaserExits.has(laserId)) continue;
|
||||
if (anyColor && (!this.wall_Pass[j].wall_Info || this.wall_Pass[j].wall_Info.stickLength)) continue;
|
||||
//如果颜色相同
|
||||
// console.log("判断颜色是否相同", this.wall_Pass[j].color, color);
|
||||
|
||||
@@ -19,7 +19,7 @@ import DailyTaskSync from "../Task/DailyTaskSync";
|
||||
//@ts-ignore
|
||||
//最大工具类 各种公共方法,以及处理上传,获取后端接口数据
|
||||
var GameTool = {
|
||||
MAX_NORMAL_LEVEL: 9001,
|
||||
MAX_NORMAL_LEVEL: 2040,
|
||||
starterPackReactivationUid: "",
|
||||
starterPackQueuedReason: "",
|
||||
MEMORY_WARNING_EVENT: "game-memory-warning",
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
{
|
||||
"LEVEL_INFO": [
|
||||
{
|
||||
"id": "9001",
|
||||
"map": [10, 10],
|
||||
"time": 300,
|
||||
"gap": [],
|
||||
"risefall": [
|
||||
{ "x": 4, "y": 5, "color": 5 },
|
||||
{ "x": 6, "y": 5, "vine": 2 },
|
||||
{ "x": 6, "y": 6, "vine": 1 }
|
||||
],
|
||||
"lasers": [
|
||||
{
|
||||
"id": "green_a",
|
||||
"color": 7,
|
||||
"emitter": { "num": 2 },
|
||||
"receiver": { "num": 26 }
|
||||
},
|
||||
{
|
||||
"id": "green_b",
|
||||
"color": 7,
|
||||
"emitter": { "num": 5 },
|
||||
"receiver": { "num": 29 }
|
||||
},
|
||||
{
|
||||
"id": "cyan_cross",
|
||||
"color": 6,
|
||||
"emitter": { "num": 14 },
|
||||
"receiver": { "num": 15 }
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"BLOCK_INFO": [[
|
||||
{
|
||||
"id": 90010,
|
||||
"block": 0,
|
||||
"color": 10,
|
||||
"type": 0,
|
||||
"position": { "x": -240, "y": -240, "z": 0 }
|
||||
},
|
||||
{
|
||||
"id": 90020,
|
||||
"block": 1,
|
||||
"color": 8,
|
||||
"type": 0,
|
||||
"position": { "x": -240, "y": -360, "z": 0 }
|
||||
},
|
||||
{
|
||||
"id": 90030,
|
||||
"block": 3,
|
||||
"color": 5,
|
||||
"type": 0,
|
||||
"position": { "x": 360, "y": 240, "z": 0 }
|
||||
},
|
||||
{
|
||||
"id": 90040,
|
||||
"block": 0,
|
||||
"color": 5,
|
||||
"type": 22,
|
||||
"position": { "x": 0, "y": -120, "z": 0 }
|
||||
},
|
||||
{
|
||||
"id": 90050,
|
||||
"block": 23,
|
||||
"color": 11,
|
||||
"type": 0,
|
||||
"position": { "x": 360, "y": -360, "z": 0 }
|
||||
}
|
||||
]],
|
||||
"WALL_INFO": [[
|
||||
{ "id": 90011, "num": 6, "color": 10, "special": 0, "length": 1, "laserId": "green_a" },
|
||||
{ "id": 90021, "num": 8, "color": 8, "special": 0, "length": 2, "laserId": "green_b" },
|
||||
{ "id": 90021, "num": 10, "color": 8, "special": 0, "length": 0, "laserId": "green_b" },
|
||||
{ "id": 90031, "num": 17, "color": 5, "special": 0, "length": 3, "laserId": "cyan_cross" },
|
||||
{ "id": 90031, "num": 19, "color": 5, "special": 0, "length": 0, "laserId": "cyan_cross" },
|
||||
{ "id": 90031, "num": 21, "color": 5, "special": 0, "length": 0, "laserId": "cyan_cross" }
|
||||
]]
|
||||
}
|
||||
Reference in New Issue
Block a user