1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- import { _decorator, Component, Label, macro, Node, NodeEventType } from 'cc';
- const { ccclass, property } = _decorator;
- @ccclass('DifficultyManager')
- export class DifficultyManager extends Component {
- Difficulty: number = -1
- static UpSpeed: number = 10;
- static G: number = 20;
- protected start(): void {
- 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;
- }
- }
- }, 1, macro.REPEAT_FOREVER, 0)
- }
- }
|