yuliang 6 months ago
parent
commit
2c94fae7c9
  1. 29
      src/modules/cl2/Cl23dObject.ts

29
src/modules/cl2/Cl23dObject.ts

@ -338,7 +338,7 @@ export default class Cl23dObject extends THREE.Object3D {
private _cl2Entity: Cl2Entity = null; private _cl2Entity: Cl2Entity = null;
private taskList: Task[] = []; private taskList: Task[] = [];
private executingTask: Task[] = []; private currentTask: any = null;
private travelAnimation: core.Tween = null private travelAnimation: core.Tween = null
private rotationAnimation: core.Tween = null; private rotationAnimation: core.Tween = null;
@ -524,19 +524,26 @@ export default class Cl23dObject extends THREE.Object3D {
executeTask() { executeTask() {
const currentTask = this.executingTask[this.executingTask.length - 1] if (this.currentAnimation) {
return
}
while (this.taskList.length > 0) { while (this.taskList.length > 0) {
const task = this.taskList.shift() const task = this.taskList[0]
if (task.OperationType === 0) {
this.addTravel(task.X, task.Y, task.Speed / 1000) if (task.OperationType == 0 && ((task.Speed > 0) != (this.currentTask.Speed > 1) || task.Direction != this.currentTask.Direction)) {
} if (!this.currentAnimation || this.currentAnimation == this.rotationAnimation) {
if ((task.Speed > 0) != (currentTask.Speed > 1) || task.Direction != currentTask.Direction) { // 转向
// 转向 this.addRotation(task.Direction)
// this.addArmRotate(task.Direction) this.currentAnimation = task
}
} else if (task.OperationType === 0) {
if (!this.currentAnimation || this.currentAnimation == this.travelAnimation) {
this.taskList.shift()
this.addTravel(task.X, task.Y, task.Speed / 1000)
this.currentAnimation = task
}
} }
} }
} }

Loading…
Cancel
Save