2024-03-28 20:35:44 -07:00
|
|
|
import { _decorator, Animation, Vec3 } from 'cc';
|
|
|
|
import Singleton from '../Singleton';
|
2024-06-09 05:12:08 -07:00
|
|
|
import Utils from '../Utilities';
|
2024-03-28 20:35:44 -07:00
|
|
|
const { ccclass, property } = _decorator;
|
|
|
|
|
|
|
|
@ccclass('CameraController')
|
|
|
|
export class CameraController extends Singleton<CameraController>() {
|
|
|
|
@property({ type: Animation, visible: true })
|
|
|
|
private _animation: Animation;
|
|
|
|
|
|
|
|
public async shake(time: number) {
|
|
|
|
this._animation.play();
|
2024-06-09 05:12:08 -07:00
|
|
|
await Utils.delay(time);
|
2024-03-28 20:35:44 -07:00
|
|
|
this._animation.stop();
|
|
|
|
this.node.setPosition(new Vec3(0, 0, 1000));
|
|
|
|
}
|
|
|
|
}
|