mirror of
https://github.com/MartinKral/Slash-The-Hordes
synced 2025-12-10 14:49:45 +00:00
Progress
This commit is contained in:
29
assets/Scripts/Game/XP/XP.ts
Normal file
29
assets/Scripts/Game/XP/XP.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { Component, Vec3, _decorator } from "cc";
|
||||
import { ISignal } from "../../Services/EventSystem/ISignal";
|
||||
import { Signal } from "../../Services/EventSystem/Signal";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass("XP")
|
||||
export class XP extends Component {
|
||||
private pickUpEvent: Signal<XP> = new Signal<XP>();
|
||||
private value = 2;
|
||||
|
||||
public setup(position: Vec3, value: number): void {
|
||||
this.node.setWorldPosition(position);
|
||||
this.value = value;
|
||||
this.node.active = true;
|
||||
}
|
||||
|
||||
public get Value(): number {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public get PickupEvent(): ISignal<XP> {
|
||||
return this.pickUpEvent;
|
||||
}
|
||||
|
||||
public pickup(): void {
|
||||
this.pickUpEvent.trigger(this);
|
||||
this.node.active = false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user