Screen fader

This commit is contained in:
Martin
2022-12-31 13:32:40 +01:00
parent 50c44b7d64
commit 756e9db049
10 changed files with 494 additions and 91 deletions

View File

@@ -1,6 +1,7 @@
import { Camera, Component, KeyCode, Prefab, Vec2, _decorator } from "cc";
import { ModalWindowManager } from "../Services/ModalWindowSystem/ModalWindowManager";
import { delay } from "../Services/Utils/AsyncUtils";
import { OpenCloseAnimator } from "../Utils/OpenCloseAnimator";
import { GameAudioAdapter } from "./Audio/GameAudioAdapter";
import { Background } from "./Background/Background";
import { MagnetCollisionSystem } from "./Collision/MagnetCollisionSystem";
@@ -50,6 +51,7 @@ export class Game extends Component {
@property(Background) private background: Background;
@property(ModalWindowManager) private modalWindowManager: ModalWindowManager;
@property(GameAudioAdapter) private gameAudioAdapter: GameAudioAdapter;
@property(OpenCloseAnimator) private screenFader: OpenCloseAnimator;
private playerCollisionSystem: PlayerCollisionSystem;
private haloProjectileLauncher: HaloProjectileLauncher;
@@ -73,6 +75,9 @@ export class Game extends Component {
public start(): void {
Game.instance = this;
this.gamePauser.pause();
this.screenFader.init();
this.screenFader.node.active = true;
}
public async playGame(
@@ -169,6 +174,7 @@ export class Game extends Component {
this.haloProjectileLauncher
);
this.gamePauser.resume();
this.screenFader.playClose();
while (!this.gameResult.hasExitManually && this.player.Health.IsAlive) await delay(100);
if (!this.gameResult.hasExitManually) {

View File

@@ -42,8 +42,6 @@ export class ProjectileLauncher extends Component implements IProjectileLauncher
this.projectilePierces = projectilePierces;
this.projectilePool = new ObjectPool<Projectile>(this.projectilePrefab, this.node, 6, "Projectile");
console.log("DAMAGE " + JSON.stringify((<Projectile>this.projectilePrefab.data).Damage));
}
public gameTick(deltaTime: number): void {