refactor: invulnerability
This commit is contained in:
parent
4b46b2f0ab
commit
83d8924517
|
@ -23,6 +23,9 @@ export default class Vulnerable extends Component {
|
|||
id = 0;
|
||||
Types = DamageTypes;
|
||||
damage(specification) {
|
||||
if (this.isInvulnerable) {
|
||||
return;
|
||||
}
|
||||
const {Alive} = Component.ecs.get(this.entity);
|
||||
if (Alive) {
|
||||
switch (specification.type) {
|
||||
|
@ -39,4 +42,7 @@ export default class Vulnerable extends Component {
|
|||
}
|
||||
};
|
||||
}
|
||||
static properties = {
|
||||
isInvulnerable: {type: 'uint8'},
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
const {Sprite, Ticking} = entity;
|
||||
const {Sprite, Ticking, Vulnerable} = entity;
|
||||
if (Vulnerable) {
|
||||
Vulnerable.isInvulnerable = 1;
|
||||
}
|
||||
if (Sprite) {
|
||||
const {promise} = transition(
|
||||
entity.Sprite,
|
||||
|
|
Loading…
Reference in New Issue
Block a user