Death effect

This commit is contained in:
Martin 2023-01-02 13:51:49 +01:00
parent af4dd8ecbd
commit 8d241c7886
12 changed files with 327 additions and 130 deletions

View File

@ -9,7 +9,7 @@
"_native": "",
"sample": 60,
"speed": 1,
"wrapMode": 2,
"wrapMode": 1,
"enableTrsBlending": false,
"_duration": 0.35,
"_hash": 500763545,

View File

@ -8,6 +8,6 @@
],
"subMetas": {},
"userData": {
"name": "DamageFlash"
"name": "DeathEffect"
}
}

View File

@ -1,7 +1,7 @@
[
{
"__type__": "cc.Prefab",
"_name": "DamageFlash",
"_name": "DeathEffect",
"_objFlags": 0,
"_native": "",
"data": {
@ -13,7 +13,7 @@
},
{
"__type__": "cc.Node",
"_name": "DamageFlash",
"_name": "DeathEffect",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": null,
@ -28,10 +28,13 @@
},
{
"__id__": 6
},
{
"__id__": 8
}
],
"_prefab": {
"__id__": 8
"__id__": 10
},
"_lpos": {
"__type__": "cc.Vec3",
@ -163,6 +166,26 @@
"__type__": "cc.CompPrefabInfo",
"fileId": "3ag4rexLNJW6A/sp6OpwZ8"
},
{
"__type__": "213a9aw7AxJUZPp4rSYoD+B",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 9
},
"animation": {
"__id__": 6
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "85y4e2eRBItKLP5t7xinqV"
},
{
"__type__": "cc.PrefabInfo",
"root": {

View File

@ -8,6 +8,6 @@
],
"subMetas": {},
"userData": {
"syncNodeName": "DamageFlash"
"syncNodeName": "DeathEffect"
}
}

View File

@ -27,11 +27,11 @@
"_active": true,
"_components": [],
"_prefab": {
"__id__": 107
"__id__": 110
},
"autoReleaseAssets": false,
"_globals": {
"__id__": 112
"__id__": 115
},
"_id": "cffa5b19-2043-4cef-8221-1a10ab7a2c1f"
},
@ -247,22 +247,25 @@
"__id__": 62
},
{
"__id__": 100
"__id__": 65
},
{
"__id__": 103
}
],
"_active": true,
"_components": [
{
"__id__": 103
},
{
"__id__": 104
},
{
"__id__": 105
},
{
"__id__": 106
},
{
"__id__": 107
},
{
"__id__": 108
},
{
"__id__": 109
}
],
"_prefab": null,
@ -1518,6 +1521,88 @@
},
"_id": "1ffjazmm5IkZwKInsSIULY"
},
{
"__type__": "cc.Node",
"_name": "EnemyDeathEffectManager",
"_objFlags": 0,
"_parent": {
"__id__": 12
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 63
},
{
"__id__": 64
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "b9L/RzIoxEG63Ey9qb7Cdv"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 62
},
"_enabled": true,
"__prefab": null,
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "c5MBPkeSdJT4zvySWGVswV"
},
{
"__type__": "3d2079Oe4hGb4KAQJkl2Luy",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 62
},
"_enabled": true,
"__prefab": null,
"deathEffectPrefab": {
"__uuid__": "33559f93-a351-4249-a775-f8ee7f31714c",
"__expectedType__": "cc.Prefab"
},
"_id": "f30EIVwGFBAYMGmW70IlmJ"
},
{
"__type__": "cc.Node",
"_name": "GameUI",
@ -1527,16 +1612,16 @@
},
"_children": [
{
"__id__": 63
"__id__": 66
},
{
"__id__": 90
"__id__": 93
}
],
"_active": true,
"_components": [
{
"__id__": 99
"__id__": 102
}
],
"_prefab": null,
@ -1573,26 +1658,26 @@
"_name": "TopUI",
"_objFlags": 0,
"_parent": {
"__id__": 62
"__id__": 65
},
"_children": [
{
"__id__": 64
},
{
"__id__": 76
"__id__": 67
},
{
"__id__": 79
},
{
"__id__": 82
}
],
"_active": true,
"_components": [
{
"__id__": 88
"__id__": 91
},
{
"__id__": 89
"__id__": 92
}
],
"_prefab": null,
@ -1629,26 +1714,26 @@
"_name": "XpBar",
"_objFlags": 0,
"_parent": {
"__id__": 63
"__id__": 66
},
"_children": [
{
"__id__": 65
},
{
"__id__": 68
},
{
"__id__": 71
},
{
"__id__": 74
}
],
"_active": true,
"_components": [
{
"__id__": 74
"__id__": 77
},
{
"__id__": 75
"__id__": 78
}
],
"_prefab": null,
@ -1685,16 +1770,16 @@
"_name": "Background",
"_objFlags": 0,
"_parent": {
"__id__": 64
"__id__": 67
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 66
"__id__": 69
},
{
"__id__": 67
"__id__": 70
}
],
"_prefab": null,
@ -1731,7 +1816,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 65
"__id__": 68
},
"_enabled": true,
"__prefab": null,
@ -1752,7 +1837,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 65
"__id__": 68
},
"_enabled": true,
"__prefab": null,
@ -1790,16 +1875,16 @@
"_name": "Background-001",
"_objFlags": 0,
"_parent": {
"__id__": 64
"__id__": 67
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 69
"__id__": 72
},
{
"__id__": 70
"__id__": 73
}
],
"_prefab": null,
@ -1836,7 +1921,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 68
"__id__": 71
},
"_enabled": true,
"__prefab": null,
@ -1857,7 +1942,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 68
"__id__": 71
},
"_enabled": true,
"__prefab": null,
@ -1895,16 +1980,16 @@
"_name": "MovableBar",
"_objFlags": 0,
"_parent": {
"__id__": 64
"__id__": 67
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 72
"__id__": 75
},
{
"__id__": 73
"__id__": 76
}
],
"_prefab": null,
@ -1941,7 +2026,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 71
"__id__": 74
},
"_enabled": true,
"__prefab": null,
@ -1962,7 +2047,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 71
"__id__": 74
},
"_enabled": true,
"__prefab": null,
@ -2000,7 +2085,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 64
"__id__": 67
},
"_enabled": true,
"__prefab": null,
@ -2021,12 +2106,12 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 64
"__id__": 67
},
"_enabled": true,
"__prefab": null,
"_barSprite": {
"__id__": 73
"__id__": 76
},
"_mode": 0,
"_totalLength": 284,
@ -2039,16 +2124,16 @@
"_name": "TimeAliveText",
"_objFlags": 0,
"_parent": {
"__id__": 63
"__id__": 66
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 77
"__id__": 80
},
{
"__id__": 78
"__id__": 81
}
],
"_prefab": null,
@ -2085,7 +2170,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 76
"__id__": 79
},
"_enabled": true,
"__prefab": null,
@ -2106,7 +2191,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 76
"__id__": 79
},
"_enabled": true,
"__prefab": null,
@ -2147,29 +2232,29 @@
"_name": "PauseBtn",
"_objFlags": 0,
"_parent": {
"__id__": 63
"__id__": 66
},
"_children": [
{
"__id__": 80
"__id__": 83
}
],
"_active": true,
"_components": [
{
"__id__": 83
},
{
"__id__": 84
},
{
"__id__": 85
},
{
"__id__": 86
},
{
"__id__": 87
},
{
"__id__": 88
},
{
"__id__": 89
},
{
"__id__": 90
}
],
"_prefab": null,
@ -2206,16 +2291,16 @@
"_name": "Square",
"_objFlags": 0,
"_parent": {
"__id__": 79
"__id__": 82
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 81
"__id__": 84
},
{
"__id__": 82
"__id__": 85
}
],
"_prefab": null,
@ -2252,7 +2337,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 80
"__id__": 83
},
"_enabled": true,
"__prefab": null,
@ -2273,7 +2358,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 80
"__id__": 83
},
"_enabled": true,
"__prefab": null,
@ -2314,7 +2399,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 79
"__id__": 82
},
"_enabled": true,
"__prefab": null,
@ -2335,7 +2420,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 79
"__id__": 82
},
"_enabled": true,
"__prefab": null,
@ -2373,7 +2458,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 79
"__id__": 82
},
"_enabled": true,
"__prefab": null,
@ -2427,7 +2512,7 @@
"_duration": 0.1,
"_zoomScale": 0.92,
"_target": {
"__id__": 79
"__id__": 82
},
"_id": "44V8O8mzZKQZv5NNhU9U2X"
},
@ -2436,7 +2521,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 79
"__id__": 82
},
"_enabled": true,
"__prefab": null,
@ -2447,12 +2532,12 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 79
"__id__": 82
},
"_enabled": true,
"__prefab": null,
"button": {
"__id__": 86
"__id__": 89
},
"_id": "19CfluWQpOB4qddmLDK5n9"
},
@ -2461,7 +2546,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 63
"__id__": 66
},
"_enabled": true,
"__prefab": null,
@ -2482,7 +2567,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 63
"__id__": 66
},
"_enabled": true,
"__prefab": null,
@ -2511,17 +2596,17 @@
"_name": "UI",
"_objFlags": 0,
"_parent": {
"__id__": 62
"__id__": 65
},
"_children": [
{
"__id__": 91
"__id__": 94
}
],
"_active": true,
"_components": [
{
"__id__": 98
"__id__": 101
}
],
"_prefab": null,
@ -2558,23 +2643,23 @@
"_name": "VirtualJoystic",
"_objFlags": 0,
"_parent": {
"__id__": 90
"__id__": 93
},
"_children": [
{
"__id__": 92
"__id__": 95
}
],
"_active": true,
"_components": [
{
"__id__": 95
"__id__": 98
},
{
"__id__": 96
"__id__": 99
},
{
"__id__": 97
"__id__": 100
}
],
"_prefab": null,
@ -2611,16 +2696,16 @@
"_name": "Knob",
"_objFlags": 0,
"_parent": {
"__id__": 91
"__id__": 94
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 93
"__id__": 96
},
{
"__id__": 94
"__id__": 97
}
],
"_prefab": null,
@ -2657,7 +2742,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 92
"__id__": 95
},
"_enabled": true,
"__prefab": null,
@ -2678,7 +2763,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 92
"__id__": 95
},
"_enabled": true,
"__prefab": null,
@ -2716,7 +2801,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 91
"__id__": 94
},
"_enabled": true,
"__prefab": null,
@ -2737,7 +2822,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 91
"__id__": 94
},
"_enabled": true,
"__prefab": null,
@ -2775,13 +2860,13 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 91
"__id__": 94
},
"_enabled": true,
"__prefab": null,
"maxDistance": 50,
"knob": {
"__id__": 92
"__id__": 95
},
"_id": "50ceZG62tGlYXvZWEvSDKl"
},
@ -2790,7 +2875,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 90
"__id__": 93
},
"_enabled": true,
"__prefab": null,
@ -2811,18 +2896,18 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 62
"__id__": 65
},
"_enabled": true,
"__prefab": null,
"xpBar": {
"__id__": 75
},
"timeAliveText": {
"__id__": 78
},
"timeAliveText": {
"__id__": 81
},
"pauseBtn": {
"__id__": 86
"__id__": 89
},
"_id": "bau/7eItRFrKKoAZZb/uYL"
},
@ -2837,10 +2922,10 @@
"_active": true,
"_components": [
{
"__id__": 101
"__id__": 104
},
{
"__id__": 102
"__id__": 105
}
],
"_prefab": null,
@ -2877,7 +2962,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 100
"__id__": 103
},
"_enabled": true,
"__prefab": null,
@ -2898,7 +2983,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 100
"__id__": 103
},
"_enabled": true,
"__prefab": null,
@ -3004,7 +3089,7 @@
"_enabled": true,
"__prefab": null,
"virtualJoystic": {
"__id__": 97
"__id__": 100
},
"player": null,
"haloProjectileLauncherComponent": {
@ -3025,21 +3110,24 @@
"enemyManager": {
"__id__": 61
},
"deathEffectSpawner": {
"__id__": 64
},
"itemManager": {
"__id__": 57
},
"gameUI": {
"__id__": 99
"__id__": 102
},
"gameCanvas": {
"__id__": 104
"__id__": 107
},
"background": {
"__id__": 23
},
"gameAudioAdapter": null,
"blackScreen": {
"__id__": 100
"__id__": 103
},
"_id": "3a9z1bqlFCGL4/WyDwU4L5"
},
@ -3048,10 +3136,10 @@
"fileId": "cffa5b19-2043-4cef-8221-1a10ab7a2c1f",
"targetOverrides": [
{
"__id__": 108
"__id__": 111
},
{
"__id__": 110
"__id__": 113
}
],
"nestedPrefabInstanceRoots": [
@ -3069,7 +3157,7 @@
{
"__type__": "cc.TargetOverrideInfo",
"source": {
"__id__": 106
"__id__": 109
},
"sourceInfo": null,
"propertyPath": [
@ -3079,7 +3167,7 @@
"__id__": 34
},
"targetInfo": {
"__id__": 109
"__id__": 112
}
},
{
@ -3091,7 +3179,7 @@
{
"__type__": "cc.TargetOverrideInfo",
"source": {
"__id__": 106
"__id__": 109
},
"sourceInfo": null,
"propertyPath": [
@ -3101,7 +3189,7 @@
"__id__": 13
},
"targetInfo": {
"__id__": 111
"__id__": 114
}
},
{
@ -3113,19 +3201,19 @@
{
"__type__": "cc.SceneGlobals",
"ambient": {
"__id__": 113
},
"shadows": {
"__id__": 114
},
"_skybox": {
"__id__": 115
},
"fog": {
"__id__": 116
},
"octree": {
"shadows": {
"__id__": 117
},
"_skybox": {
"__id__": 118
},
"fog": {
"__id__": 119
},
"octree": {
"__id__": 120
}
},
{

View File

@ -20,6 +20,7 @@ import { GameModalLauncher } from "./ModalWIndows/GameModalLauncher";
import { Pauser } from "./Pauser";
import { TestValues } from "./TestGameRunner";
import { GameUI } from "./UI/GameUI";
import { EnemyDeathEffectSpawner } from "./Unit/Enemy/EnemyDeathEffectSpawner/EnemyDeathEffectSpawner";
import { EnemyManager } from "./Unit/Enemy/EnemyManager";
import { EnemyProjectileLauncher } from "./Unit/Enemy/ProjectileLauncher.cs/EnemyProjectileLauncher";
import { MetaUpgrades } from "./Unit/MetaUpgrades/MetaUpgrades";
@ -45,6 +46,7 @@ export class Game extends Component {
@property(ProjectileLauncher) private enemyAxeProjectileLauncherComponent: ProjectileLauncher;
@property(ProjectileLauncher) private enemyMagicOrbProjectileLauncherComponent: ProjectileLauncher;
@property(EnemyManager) private enemyManager: EnemyManager;
@property(EnemyDeathEffectSpawner) private deathEffectSpawner: EnemyDeathEffectSpawner;
@property(ItemManager) private itemManager: ItemManager;
@property(GameUI) private gameUI: GameUI;
@property(Canvas) private gameCanvas: Canvas;
@ -96,6 +98,7 @@ export class Game extends Component {
this.player.init(multiInput, this.createPlayerData(settings.player, metaUpgrades));
this.enemyManager.init(this.player.node, settings.enemyManager);
this.deathEffectSpawner.init(this.enemyManager);
this.playerCollisionSystem = new PlayerCollisionSystem(this.player, settings.player.collisionDelay, this.itemManager);
new WeaponCollisionSystem(this.player.Weapon);

View File

@ -143,7 +143,7 @@ export class Enemy extends Component {
this.sprite.node.active = false;
await delay(200);
if (this.sprite == null) break;
if (this.sprite == null) break; // exit scene
this.sprite.node.active = true;
await delay(200);

View File

@ -0,0 +1,12 @@
{
"ver": "1.1.0",
"importer": "directory",
"imported": true,
"uuid": "5d3c93fa-41c2-4927-8a1a-5be0ccaa177b",
"files": [],
"subMetas": {},
"userData": {
"compressionType": {},
"isRemoteBundle": {}
}
}

View File

@ -0,0 +1,14 @@
import { _decorator, Component, Animation, Vec3 } from "cc";
const { ccclass, property } = _decorator;
@ccclass("EnemyDeathEffect")
export class EnemyDeathEffect extends Component {
@property(Animation) private animation: Animation;
public setup(worldPosition: Vec3): void {
this.node.setWorldPosition(worldPosition);
this.node.active = true;
this.animation.play("DeathEffect");
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "213a96b0-ec0c-4951-93e9-e2b498a03f81",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,39 @@
import { _decorator, Component, Node, Prefab } from "cc";
import { ObjectPool } from "../../../../Services/ObjectPool";
import { delay } from "../../../../Services/Utils/AsyncUtils";
import { Enemy } from "../Enemy";
import { EnemyManager } from "../EnemyManager";
import { EnemyDeathEffect } from "./EnemyDeathEffect";
const { ccclass, property } = _decorator;
@ccclass("EnemyDeathEffectSpawner")
export class EnemyDeathEffectSpawner extends Component {
@property(Prefab) private deathEffectPrefab: Prefab;
private effectPool: ObjectPool<EnemyDeathEffect>;
public init(enemyManager: EnemyManager): void {
enemyManager.EnemyAddedEvent.on(this.onEnemyAdded, this);
enemyManager.EnemyRemovedEvent.on(this.onEnemyRemoved, this);
this.effectPool = new ObjectPool(this.deathEffectPrefab, this.node, 5, "EnemyDeathEffect");
}
private onEnemyAdded(enemy: Enemy): void {
enemy.DeathEvent.on(this.animateDeathEffect, this);
}
private onEnemyRemoved(enemy: Enemy): void {
enemy.DeathEvent.off(this.animateDeathEffect);
}
private async animateDeathEffect(enemy: Enemy): Promise<void> {
const deathEffect = this.effectPool.borrow();
deathEffect.setup(enemy.node.worldPosition);
await delay(360);
this.effectPool.return(deathEffect);
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "3d207f4e-7b88-466f-8280-409925d8bbb2",
"files": [],
"subMetas": {},
"userData": {}
}