Added health potion

This commit is contained in:
Martin
2022-12-20 13:37:56 +01:00
parent 1c009e9fa4
commit dbb55957a0
17 changed files with 409 additions and 195 deletions

View File

@@ -1,4 +1,4 @@
import { BoxCollider2D, Color, Component, Material, randomRange, Sprite, Vec3, _decorator } from "cc";
import { BoxCollider2D, Component, Material, randomRange, Sprite, Vec3, _decorator } from "cc";
import { ISignal } from "../../../Services/EventSystem/ISignal";
import { Signal } from "../../../Services/EventSystem/Signal";
import { delay } from "../../../Services/Utils/AsyncUtils";
@@ -28,6 +28,7 @@ export class Enemy extends Component {
private xpReward: number;
private goldReward: number;
private healthPotionRewardChance: number;
private endOfLifetimeTriggered = false;
@@ -42,6 +43,7 @@ export class Enemy extends Component {
this.xpReward = settings.xpReward;
this.goldReward = settings.goldReward;
this.healthPotionRewardChance = settings.healthPotionRewardChance;
this.node.setWorldPosition(position);
this.node.active = true;
@@ -82,6 +84,10 @@ export class Enemy extends Component {
return this.goldReward;
}
public get HealthPotionRewardChance(): number {
return this.healthPotionRewardChance;
}
public get LifetimeEndedEvent(): ISignal<Enemy> {
return this.lifetimeEndedEvent;
}