Commit 48c4bca0 authored by Master Q's avatar Master Q

Merge branch 'parkourGame_template' into zhonghuacaixian-parkourGame-20220616

parents 562e0ab1 22f88a2f
......@@ -35,7 +35,7 @@ export default {
progress(),
BannerVariable({
values: {
__ENV__: JSON.stringify(process.env.NODE_ENV || 'pord'),
__ENV__: JSON.stringify(process.env.NODE_ENV || 'production'),
__version__: JSON.stringify(version),
__buildDate__: JSON.stringify(new Date()),
}
......
......@@ -213,7 +213,7 @@ export const ParkourGameConfig: ParkourGameConfigInfer = {
{
uniqueKey: 'protect',
Container: 'obstack3.png',
ProbabilityPort: 3,
ProbabilityPort: 10,
// anchorX: 100,
// anchorY: 100,
collisionConfig: {
......@@ -227,7 +227,7 @@ export const ParkourGameConfig: ParkourGameConfigInfer = {
],
CommonConfig: {
speed: 300, // 速度 可以通过GAME_SPEEDUP 修改
CollisionDebug: false, // 碰撞检测 debug
CollisionDebug: __ENV__ === 'production' ? false : true, // 碰撞检测 debug
GamerAxisY: 1100, // 玩家轴Y
GamerIndex: 1, // 当前玩家索引 在哪条道
DetermineXAxis: 50, // 左右滑动判定距离
......
......@@ -102,7 +102,8 @@ export class ConveyorBeltItem extends FYGE.Container {
type ProbabilityItemType = {
value: number
index: number
index: number,
ownValuue: number
}
/**
......@@ -180,12 +181,14 @@ export class ConveyorBelt extends FYGE.Container {
const _ParkourGameEleList = this.ParkourGameEleList
const sumProbability = _ParkourGameEleList.reduce((prev, cur) => prev + cur.ProbabilityPort, 0)
const _ProbabilityList: ProbabilityItemType[] = []
_ParkourGameEleList.reduce((pre, curr, index) => {
_ParkourGameEleList.reduce((pre, curr, index, arr) => {
const tp = curr.ProbabilityPort / sumProbability
_ProbabilityList.push({
value: pre + curr.ProbabilityPort / sumProbability,
index
value: index == arr.length - 1 ? 1 : pre + tp,
index,
ownValuue: tp
})
return pre + curr.ProbabilityPort / sumProbability
return pre + tp
}, 0)
this.ProbabilityList = _ProbabilityList
console.log('ProbabilityList ==== > ', _ProbabilityList)
......@@ -327,9 +330,18 @@ export class ConveyorBelt extends FYGE.Container {
if (this.onJudgeNextObstacle) {
const b = this.onJudgeNextObstacle(ParkourGameEle)
if (!b) {
const skipPortList = portList.filter((item) => {
const skipPortList: ProbabilityItemType[] = portList.filter((item) => {
return item.index !== index
})
.reduce((pre, cur, index, arr) => {
if (randomItem.ownValuue === 1) return []
const cloneCur = {...cur}
const ownValue = cloneCur.ownValuue / (1 - randomItem.ownValuue)
cloneCur.ownValuue = ownValue
cloneCur.value = index == arr.length - 1 ? 1 : ((pre.length == 0 ? 0 : pre[pre.length - 1].value) + cloneCur.ownValuue)
return pre.concat(cloneCur)
}, [])
// debugger
return this.onGetFinalObstacle(skipPortList)
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment