Files
fc/dev/project/library/imports/51/51a50987-bbc2-458a-a12b-62ecef2f7734.js
T
2026-05-24 10:21:26 +08:00

86 lines
2.1 KiB
JavaScript

"use strict";
cc._RF.push(module, '51a50mHu8JFiqErYuzvL3c0', 'cmp.adventure.map.coll');
// Scripts/mod/pve/adventure/cmp/cmp.adventure.map.coll.js
"use strict";
var ADVCT = require("adventure_controller");
//处理方块边界碰撞问题
cc.Class({
"extends": cc.Component,
properties: {
Left: {
"default": null,
type: cc.Node
},
Right: {
"default": null,
type: cc.Node
},
Ups: {
"default": null,
type: cc.Node
},
Downs: {
"default": null,
type: cc.Node
}
},
// LIFE-CYCLE CALLBACKS:
onLoad: function onLoad() {
this.index = null;
},
start: function start() {},
upCollision: function upCollision(index) {
var data = ADVCT.getInstance().getRoomDataByIndex(index);
var xy = data.room_id[0];
this.checkFogPath(xy);
},
//检测解锁迷雾路径
checkFogPath: function checkFogPath(path) {
//四面解锁的一定也是解锁的,所以不需要cloud
//边缘地带的需要本身未解锁才能确认需不需要cloud
var x = path.x;
var y = path.y;
var is_left = false;
var is_right = false;
var is_up = false;
var is_down = false;
var limit_index = 0;
var up = [x, y + 1];
var updata = ADVCT.getInstance().getRoomDataByXY(up[0], up[1]);
if (updata && updata.lock == 0) {
limit_index++;
is_up = true;
}
var down = [x, y - 1];
var dodata = ADVCT.getInstance().getRoomDataByXY(down[0], down[1]);
if (dodata && dodata.lock == 0) {
limit_index++;
is_down = true;
}
var left = [x - 1, y];
var ldata = ADVCT.getInstance().getRoomDataByXY(left[0], left[1]);
if (ldata && ldata.lock == 0) {
limit_index++;
is_left = true;
}
var right = [x + 1, y];
var rdata = ADVCT.getInstance().getRoomDataByXY(right[0], right[1]);
if (rdata && rdata.lock == 0) {
limit_index++;
is_right = true;
}
if (limit_index == 4) {
//四面皆有
return;
}
this.Ups.active = is_up;
this.Downs.active = is_down;
this.Left.active = is_left;
this.Right.active = is_right;
} // update (dt) {},
});
cc._RF.pop();