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 { ...@@ -35,7 +35,7 @@ export default {
progress(), progress(),
BannerVariable({ BannerVariable({
values: { values: {
__ENV__: JSON.stringify(process.env.NODE_ENV || 'pord'), __ENV__: JSON.stringify(process.env.NODE_ENV || 'production'),
__version__: JSON.stringify(version), __version__: JSON.stringify(version),
__buildDate__: JSON.stringify(new Date()), __buildDate__: JSON.stringify(new Date()),
} }
......
...@@ -213,7 +213,7 @@ export const ParkourGameConfig: ParkourGameConfigInfer = { ...@@ -213,7 +213,7 @@ export const ParkourGameConfig: ParkourGameConfigInfer = {
{ {
uniqueKey: 'protect', uniqueKey: 'protect',
Container: 'obstack3.png', Container: 'obstack3.png',
ProbabilityPort: 3, ProbabilityPort: 10,
// anchorX: 100, // anchorX: 100,
// anchorY: 100, // anchorY: 100,
collisionConfig: { collisionConfig: {
...@@ -227,7 +227,7 @@ export const ParkourGameConfig: ParkourGameConfigInfer = { ...@@ -227,7 +227,7 @@ export const ParkourGameConfig: ParkourGameConfigInfer = {
], ],
CommonConfig: { CommonConfig: {
speed: 300, // 速度 可以通过GAME_SPEEDUP 修改 speed: 300, // 速度 可以通过GAME_SPEEDUP 修改
CollisionDebug: false, // 碰撞检测 debug CollisionDebug: __ENV__ === 'production' ? false : true, // 碰撞检测 debug
GamerAxisY: 1100, // 玩家轴Y GamerAxisY: 1100, // 玩家轴Y
GamerIndex: 1, // 当前玩家索引 在哪条道 GamerIndex: 1, // 当前玩家索引 在哪条道
DetermineXAxis: 50, // 左右滑动判定距离 DetermineXAxis: 50, // 左右滑动判定距离
......
...@@ -102,7 +102,8 @@ export class ConveyorBeltItem extends FYGE.Container { ...@@ -102,7 +102,8 @@ export class ConveyorBeltItem extends FYGE.Container {
type ProbabilityItemType = { type ProbabilityItemType = {
value: number value: number
index: number index: number,
ownValuue: number
} }
/** /**
...@@ -180,12 +181,14 @@ export class ConveyorBelt extends FYGE.Container { ...@@ -180,12 +181,14 @@ export class ConveyorBelt extends FYGE.Container {
const _ParkourGameEleList = this.ParkourGameEleList const _ParkourGameEleList = this.ParkourGameEleList
const sumProbability = _ParkourGameEleList.reduce((prev, cur) => prev + cur.ProbabilityPort, 0) const sumProbability = _ParkourGameEleList.reduce((prev, cur) => prev + cur.ProbabilityPort, 0)
const _ProbabilityList: ProbabilityItemType[] = [] const _ProbabilityList: ProbabilityItemType[] = []
_ParkourGameEleList.reduce((pre, curr, index) => { _ParkourGameEleList.reduce((pre, curr, index, arr) => {
const tp = curr.ProbabilityPort / sumProbability
_ProbabilityList.push({ _ProbabilityList.push({
value: pre + curr.ProbabilityPort / sumProbability, value: index == arr.length - 1 ? 1 : pre + tp,
index index,
ownValuue: tp
}) })
return pre + curr.ProbabilityPort / sumProbability return pre + tp
}, 0) }, 0)
this.ProbabilityList = _ProbabilityList this.ProbabilityList = _ProbabilityList
console.log('ProbabilityList ==== > ', _ProbabilityList) console.log('ProbabilityList ==== > ', _ProbabilityList)
...@@ -327,9 +330,18 @@ export class ConveyorBelt extends FYGE.Container { ...@@ -327,9 +330,18 @@ export class ConveyorBelt extends FYGE.Container {
if (this.onJudgeNextObstacle) { if (this.onJudgeNextObstacle) {
const b = this.onJudgeNextObstacle(ParkourGameEle) const b = this.onJudgeNextObstacle(ParkourGameEle)
if (!b) { if (!b) {
const skipPortList = portList.filter((item) => { const skipPortList: ProbabilityItemType[] = portList.filter((item) => {
return item.index !== index 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) 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