mirror of
https://github.com/MartinKral/Slash-The-Hordes
synced 2025-10-09 16:46:00 +00:00
Screen fader
This commit is contained in:
@@ -12,8 +12,7 @@ export class OpenCloseAnimator extends Component {
|
||||
private openDuration = 0;
|
||||
private closeDuration = 0;
|
||||
|
||||
public start(): void {
|
||||
this.node.active = false;
|
||||
public init(): void {
|
||||
this.openDuration = this.animation.getState(this.openStateName).duration;
|
||||
this.closeDuration = this.animation.getState(this.closeStateName).duration;
|
||||
}
|
||||
@@ -21,13 +20,13 @@ export class OpenCloseAnimator extends Component {
|
||||
public async playOpen(): Promise<void> {
|
||||
this.node.active = true;
|
||||
this.animation.play(this.openStateName);
|
||||
await delay(this.openDuration);
|
||||
await delay(this.openDuration * 1000);
|
||||
}
|
||||
|
||||
public async playClose(): Promise<void> {
|
||||
this.node.active = true;
|
||||
this.animation.play(this.openStateName);
|
||||
await delay(this.closeDuration);
|
||||
this.animation.play(this.closeStateName);
|
||||
await delay(this.closeDuration * 1000);
|
||||
this.node.active = false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user