mirror of
https://gitee.com/dgflash/oops-plugin-framework.git
synced 2026-06-07 18:52:23 +08:00
修复在MoveTo移动中目标节点突然销毁导致的报错
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* @Author: dgflash
|
||||
* @Date: 2022-03-25 18:12:10
|
||||
* @LastEditors: dgflash
|
||||
* @LastEditTime: 2023-01-05 18:26:56
|
||||
* @LastEditTime: 2023-01-10 17:41:58
|
||||
*/
|
||||
import { Component, Node, Vec3, _decorator } from "cc";
|
||||
import { Timer } from "../../core/common/manager/TimerManager";
|
||||
@@ -53,6 +53,12 @@ export class MoveTo extends Component {
|
||||
end = this.target as Vec3;
|
||||
}
|
||||
|
||||
// 移动目标节点被释放时
|
||||
if (end == null) {
|
||||
this.exit();
|
||||
return;
|
||||
}
|
||||
|
||||
// 目标移动后,重计算移动方向与移动到目标点的速度
|
||||
if (this.end == null || !this.end.strictEquals(end)) {
|
||||
let target = end.clone();
|
||||
|
||||
Reference in New Issue
Block a user