|
@@ -1,7 +1,9 @@
|
|
-import { _decorator, CircleCollider2D, Component, log, Node, RigidBody2D, Vec2, Vec3 } from 'cc';
|
|
|
|
|
|
+import { _decorator, CircleCollider2D, Component, find, log, Node, RigidBody2D, Vec2, Vec3 } from 'cc';
|
|
import { EventManager } from './EventManager';
|
|
import { EventManager } from './EventManager';
|
|
import { PropBase } from './Prop/Base/PropBase';
|
|
import { PropBase } from './Prop/Base/PropBase';
|
|
import { diban } from './Prop/Type/diban';
|
|
import { diban } from './Prop/Type/diban';
|
|
|
|
+import { DifficultyManager } from './DifficultyManager';
|
|
|
|
+import { AudioManager } from './Set/AudioManager';
|
|
const { ccclass, property } = _decorator;
|
|
const { ccclass, property } = _decorator;
|
|
|
|
|
|
@ccclass('RoleControl')
|
|
@ccclass('RoleControl')
|
|
@@ -16,13 +18,18 @@ export class RoleControl extends Component {
|
|
RightBtn: Node = null;
|
|
RightBtn: Node = null;
|
|
|
|
|
|
|
|
|
|
- private UpSpeed: number = 20;
|
|
|
|
- private G: number = 20;
|
|
|
|
|
|
+ private Left_Right_Speed: number = 20;
|
|
|
|
+ // G: number = 20;
|
|
|
|
|
|
|
|
|
|
MyDir: number = 0;
|
|
MyDir: number = 0;
|
|
|
|
|
|
|
|
+
|
|
protected onLoad(): void {
|
|
protected onLoad(): void {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
EventManager.instance.et.on(EventManager.EventType.Reset_Role, this.Reset_Role, this);
|
|
EventManager.instance.et.on(EventManager.EventType.Reset_Role, this.Reset_Role, this);
|
|
EventManager.instance.et.on(EventManager.EventType.Die_Role, this.Die_Role, this);
|
|
EventManager.instance.et.on(EventManager.EventType.Die_Role, this.Die_Role, this);
|
|
|
|
|
|
@@ -30,6 +37,7 @@ export class RoleControl extends Component {
|
|
|
|
|
|
Die_Role() {
|
|
Die_Role() {
|
|
this.scheduleOnce(() => {
|
|
this.scheduleOnce(() => {
|
|
|
|
+
|
|
this.Role.active = false
|
|
this.Role.active = false
|
|
}, 0)
|
|
}, 0)
|
|
}
|
|
}
|
|
@@ -52,7 +60,7 @@ export class RoleControl extends Component {
|
|
|
|
|
|
this.scheduleOnce(() => {
|
|
this.scheduleOnce(() => {
|
|
this.Role.setPosition(new Vec3(TempNode.node.position.x, TempNode.node.position.y + 45, 0))
|
|
this.Role.setPosition(new Vec3(TempNode.node.position.x, TempNode.node.position.y + 45, 0))
|
|
- this.Role.getComponent(RigidBody2D).linearVelocity = new Vec2(0, -this.G); // 速度值可以根据需要调整
|
|
|
|
|
|
+ this.Role.getComponent(RigidBody2D).linearVelocity = new Vec2(0, -DifficultyManager.G); // 速度值可以根据需要调整
|
|
}, 0)
|
|
}, 0)
|
|
|
|
|
|
|
|
|
|
@@ -61,7 +69,7 @@ export class RoleControl extends Component {
|
|
protected start(): void {
|
|
protected start(): void {
|
|
|
|
|
|
|
|
|
|
- this.Role.getComponent(RigidBody2D).linearVelocity = new Vec2(0, -this.G); // 速度值可以根据需要调整
|
|
|
|
|
|
+ this.Role.getComponent(RigidBody2D).linearVelocity = new Vec2(0, - DifficultyManager.G); // 速度值可以根据需要调整
|
|
|
|
|
|
|
|
|
|
this.LeftBtn.on(Node.EventType.TOUCH_START, this.LeftStart, this);
|
|
this.LeftBtn.on(Node.EventType.TOUCH_START, this.LeftStart, this);
|
|
@@ -110,13 +118,13 @@ export class RoleControl extends Component {
|
|
}
|
|
}
|
|
switch (this.MyDir) {
|
|
switch (this.MyDir) {
|
|
case 0:
|
|
case 0:
|
|
- this.Role.getComponent(RigidBody2D).linearVelocity = new Vec2(0, -this.G); // 速度值可以根据需要调整
|
|
|
|
|
|
+ this.Role.getComponent(RigidBody2D).linearVelocity = new Vec2(0, -DifficultyManager.G); // 速度值可以根据需要调整
|
|
break;
|
|
break;
|
|
case -1:
|
|
case -1:
|
|
- this.Role.getComponent(RigidBody2D).linearVelocity = new Vec2(-this.UpSpeed, -this.G); // 速度值可以根据需要调整
|
|
|
|
|
|
+ this.Role.getComponent(RigidBody2D).linearVelocity = new Vec2(-this.Left_Right_Speed, -DifficultyManager.G); // 速度值可以根据需要调整
|
|
break;
|
|
break;
|
|
case 1:
|
|
case 1:
|
|
- this.Role.getComponent(RigidBody2D).linearVelocity = new Vec2(this.UpSpeed, -this.G); // 速度值可以根据需要调整
|
|
|
|
|
|
+ this.Role.getComponent(RigidBody2D).linearVelocity = new Vec2(this.Left_Right_Speed, -DifficultyManager.G); // 速度值可以根据需要调整
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
break;
|
|
break;
|