Hidden enemy

This commit is contained in:
Martin 2022-12-20 08:44:26 +01:00
parent 4400311a11
commit 8512aa898d
4 changed files with 13 additions and 4 deletions

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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<Enemy> = new Signal<Enemy>();
private lifetimeEndedEvent: Signal<Enemy> = new Signal<Enemy>();
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 = <EnemyMovementType>settings.moveType;
this.health = new UnitHealth(settings.health);
this.damage = settings.damage;