feat: update gameplay
parent
6e8f0aa965
commit
8f4734cee6
|
@ -17749,7 +17749,8 @@
|
|||
},
|
||||
"weight": 100,
|
||||
"weightStepOnGoal": 0,
|
||||
"maxWeight": 100
|
||||
"maxWeight": 100,
|
||||
"maxObjects": -1
|
||||
},
|
||||
{
|
||||
"__type__": "weightedObject",
|
||||
|
@ -17759,7 +17760,8 @@
|
|||
},
|
||||
"weight": 0,
|
||||
"weightStepOnGoal": 5,
|
||||
"maxWeight": 30
|
||||
"maxWeight": 30,
|
||||
"maxObjects": 2
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
|
@ -17809,7 +17811,7 @@
|
|||
"y": -1200,
|
||||
"z": 0
|
||||
},
|
||||
"_timePlay": 120,
|
||||
"_timePlay": 90,
|
||||
"_startSound": {
|
||||
"__uuid__": "6452248b-259c-4844-b0e1-70f47d69955e",
|
||||
"__expectedType__": "cc.AudioClip"
|
||||
|
|
|
@ -74,7 +74,6 @@ export class GameManager extends Component {
|
|||
}
|
||||
|
||||
private addScore(score: number, type: ScoreType, position: Vec3) {
|
||||
score = this._isMultiBall ? score * 2 : score;
|
||||
this._score += score;
|
||||
const floatingScore = this._FloatingScorePool.get(this._floatingTextContainer, FloatingText);
|
||||
floatingScore.show(`+${score}`, position, score >= 100 ? 1.5 : 1, score >= 100 ? 1 : 0.7);
|
||||
|
@ -124,7 +123,7 @@ export class GameManager extends Component {
|
|||
}
|
||||
|
||||
public async goal(bonusScore: number, position: Vec3) {
|
||||
this.addScore(bonusScore, ScoreType.Goal, position);
|
||||
this.addScore(this._isMultiBall ? bonusScore * 2 : bonusScore, ScoreType.Goal, position);
|
||||
this.setCurrentBallInGame(-1);
|
||||
if (this._currentBallInGame <= 0) {
|
||||
await Utilities.delay(TimeConfig.DelayGoal);
|
||||
|
|
|
@ -18,6 +18,8 @@ class weightedObject {
|
|||
public weightStepOnGoal = 0;
|
||||
@property(CCInteger)
|
||||
public maxWeight = 0;
|
||||
@property(CCInteger)
|
||||
public maxObjects = -1;
|
||||
}
|
||||
|
||||
@ccclass('SpawnObjectManager')
|
||||
|
@ -67,7 +69,9 @@ export class SpawnObjectManager extends Component {
|
|||
|
||||
private spawn() {
|
||||
if (Object.keys(this._usedPoints).length == this._spawnPoints.length) return;
|
||||
var randomPool = Utilities.weightedRandom(this._pools, this._weights);
|
||||
do {
|
||||
var [randomPool, index] = Utilities.weightedRandom(this._pools, this._weights);
|
||||
} while (this._objects[index].maxObjects != -1 && randomPool.countActive >= this._objects[index].maxObjects);
|
||||
do {
|
||||
var randomPoint = this._spawnPoints[randomRangeInt(0, this._spawnPoints.length)];
|
||||
} while (Object.values(this._usedPoints).indexOf(randomPoint) != -1);
|
||||
|
|
|
@ -68,6 +68,7 @@ export class UIController extends Component {
|
|||
this._overPanel.active = false;
|
||||
break;
|
||||
case GameState.GameOver:
|
||||
this._buffFx.stop();
|
||||
this._playing = false;
|
||||
this._overPanel.active = true;
|
||||
this._resultLabel.string = this._scoreLabel.string;
|
||||
|
|
|
@ -27,7 +27,7 @@ export default class Utilities {
|
|||
}
|
||||
}
|
||||
|
||||
public static weightedRandom<T>(items: T[], weights: number[]): T {
|
||||
public static weightedRandom<T>(items: T[], weights: number[]): [T, number] {
|
||||
let i = 0;
|
||||
const weightsClone = [...weights];
|
||||
for (i = 1; i < weightsClone.length; i++) {
|
||||
|
@ -39,6 +39,6 @@ export default class Utilities {
|
|||
for (i = 0; i < weightsClone.length; i++) {
|
||||
if (weightsClone[i] > random) break;
|
||||
}
|
||||
return items[i];
|
||||
return [items[i], i];
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 537 KiB |
|
@ -1,3 +1,10 @@
|
|||
{
|
||||
"__version__": "1.3.4"
|
||||
"__version__": "1.3.4",
|
||||
"splash-setting": {
|
||||
"displayRatio": 1,
|
||||
"totalTime": 2000,
|
||||
"watermarkLocation": "default",
|
||||
"autoFit": true,
|
||||
"url": "C:\\ProgramData\\cocos\\editors\\Creator\\3.7.2\\resources\\app.asar.unpacked\\builtin\\builder\\static\\logo\\logo.png"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue