|
@@ -1,4 +1,6 @@
|
|
|
import { _decorator, Component, Label, macro, Node, NodeEventType } from 'cc';
|
|
|
+import { EventManager } from './EventManager';
|
|
|
+import { DEBUG } from 'cc/env';
|
|
|
const { ccclass, property } = _decorator;
|
|
|
|
|
|
@ccclass('DifficultyManager')
|
|
@@ -9,38 +11,63 @@ export class DifficultyManager extends Component {
|
|
|
|
|
|
|
|
|
static UpSpeed: number = 10;
|
|
|
- static G: number = 20;
|
|
|
+ static G: number = 0;
|
|
|
|
|
|
- protected start(): void {
|
|
|
|
|
|
+ static Left_Right_Speed: number = 20;
|
|
|
+
|
|
|
+
|
|
|
+ protected onLoad(): void {
|
|
|
+ EventManager.instance.et.on(EventManager.EventType.initOver, this.initOver, this);
|
|
|
+ }
|
|
|
+
|
|
|
+ initOver() {
|
|
|
+ this.up()
|
|
|
this.schedule(() => {
|
|
|
- let num = parseInt(this.getComponent(Label).string)
|
|
|
- if (num < 50) {
|
|
|
- if (this.Difficulty != 0) {
|
|
|
- this.Difficulty = 0
|
|
|
- /////////////////////////
|
|
|
- DifficultyManager.UpSpeed = 10;
|
|
|
- DifficultyManager.G = 20;
|
|
|
- }
|
|
|
- } else if (num < 100) {
|
|
|
- if (this.Difficulty != 1) {
|
|
|
- this.Difficulty = 1
|
|
|
- /////////////////////////
|
|
|
- DifficultyManager.UpSpeed = 15;
|
|
|
- DifficultyManager.G = 30;
|
|
|
- }
|
|
|
- } else if (num < 150) {
|
|
|
- if (this.Difficulty != 2) {
|
|
|
- this.Difficulty = 2
|
|
|
- /////////////////////////
|
|
|
- DifficultyManager.UpSpeed = 20;
|
|
|
- DifficultyManager.G = 40;
|
|
|
- }
|
|
|
- }
|
|
|
+ this.up()
|
|
|
}, 1, macro.REPEAT_FOREVER, 0)
|
|
|
}
|
|
|
|
|
|
|
|
|
+ up() {
|
|
|
+ let num = parseInt(this.getComponent(Label).string)
|
|
|
+ if (num < 2000) {
|
|
|
+ if (this.Difficulty != 0) {
|
|
|
+ this.Difficulty = 0
|
|
|
+ /////////////////////////
|
|
|
+ DifficultyManager.UpSpeed = 10;
|
|
|
+ DifficultyManager.G = 20;
|
|
|
+ DifficultyManager.Left_Right_Speed = 20;
|
|
|
+
|
|
|
+ }
|
|
|
+ } else if (num < 4000) {
|
|
|
+ if (this.Difficulty != 1) {
|
|
|
+ this.Difficulty = 1
|
|
|
+ /////////////////////////
|
|
|
+ DifficultyManager.UpSpeed = 15;
|
|
|
+ DifficultyManager.G = 30;
|
|
|
+ DifficultyManager.Left_Right_Speed = 30;
|
|
|
+ }
|
|
|
+ } else if (num < 6000) {
|
|
|
+ if (this.Difficulty != 2) {
|
|
|
+ this.Difficulty = 2
|
|
|
+ /////////////////////////
|
|
|
+ DifficultyManager.UpSpeed = 20;
|
|
|
+ DifficultyManager.G = 40;
|
|
|
+ DifficultyManager.Left_Right_Speed = 40;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ protected start(): void {
|
|
|
+ return
|
|
|
+
|
|
|
+ // EventManager.instance.et.emit(EventManager.EventType.initOver);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|