From 8512aa898d9ca0bd8b8c6fbc6cca258143dd8543 Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 20 Dec 2022 08:44:26 +0100 Subject: [PATCH] Hidden enemy --- assets/Media/Prefabs/Game/Bat.prefab | 4 ++++ assets/Media/Prefabs/Game/Goblin.prefab | 4 ++++ assets/Media/Prefabs/Game/Shark.prefab | 4 ++++ assets/Scripts/Game/Unit/Enemy/Enemy.ts | 5 +---- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/assets/Media/Prefabs/Game/Bat.prefab b/assets/Media/Prefabs/Game/Bat.prefab index c87ec9e..d06bf05 100644 --- a/assets/Media/Prefabs/Game/Bat.prefab +++ b/assets/Media/Prefabs/Game/Bat.prefab @@ -271,6 +271,10 @@ "sprite": { "__id__": 5 }, + "defaultMaterial": { + "__uuid__": "fda095cb-831d-4601-ad94-846013963de8", + "__expectedType__": "cc.Material" + }, "whiteMaterial": { "__uuid__": "9cb17675-370b-48ed-bfa2-bb613a88af44", "__expectedType__": "cc.Material" diff --git a/assets/Media/Prefabs/Game/Goblin.prefab b/assets/Media/Prefabs/Game/Goblin.prefab index 8d432cc..4106886 100644 --- a/assets/Media/Prefabs/Game/Goblin.prefab +++ b/assets/Media/Prefabs/Game/Goblin.prefab @@ -271,6 +271,10 @@ "sprite": { "__id__": 5 }, + "defaultMaterial": { + "__uuid__": "fda095cb-831d-4601-ad94-846013963de8", + "__expectedType__": "cc.Material" + }, "whiteMaterial": { "__uuid__": "9cb17675-370b-48ed-bfa2-bb613a88af44", "__expectedType__": "cc.Material" diff --git a/assets/Media/Prefabs/Game/Shark.prefab b/assets/Media/Prefabs/Game/Shark.prefab index 210a032..c62a0d4 100644 --- a/assets/Media/Prefabs/Game/Shark.prefab +++ b/assets/Media/Prefabs/Game/Shark.prefab @@ -271,6 +271,10 @@ "sprite": { "__id__": 5 }, + "defaultMaterial": { + "__uuid__": "fda095cb-831d-4601-ad94-846013963de8", + "__expectedType__": "cc.Material" + }, "whiteMaterial": { "__uuid__": "9cb17675-370b-48ed-bfa2-bb613a88af44", "__expectedType__": "cc.Material" diff --git a/assets/Scripts/Game/Unit/Enemy/Enemy.ts b/assets/Scripts/Game/Unit/Enemy/Enemy.ts index cf8d660..4142817 100644 --- a/assets/Scripts/Game/Unit/Enemy/Enemy.ts +++ b/assets/Scripts/Game/Unit/Enemy/Enemy.ts @@ -12,13 +12,12 @@ const { ccclass, property } = _decorator; export class Enemy extends Component { @property(BoxCollider2D) private collider: BoxCollider2D; @property(Sprite) private sprite: Sprite; + @property(Material) private defaultMaterial: Material; @property(Material) private whiteMaterial: Material; private deathEvent: Signal = new Signal(); private lifetimeEndedEvent: Signal = new Signal(); - private defaultMaterial: Material; - private movementType: EnemyMovementType; private health: UnitHealth; private damage: number; @@ -32,8 +31,6 @@ export class Enemy extends Component { private endOfLifetimeTriggered = false; public setup(position: Vec3, settings: EnemySettings): void { - this.defaultMaterial = this.sprite.material; - this.movementType = settings.moveType; this.health = new UnitHealth(settings.health); this.damage = settings.damage;