41 lines
1.0 KiB
TypeScript
41 lines
1.0 KiB
TypeScript
class HitObject {
|
|
amount: number;
|
|
position: Vector3Mp;
|
|
count: number = 0;
|
|
|
|
constructor(amount: number, position: Vector3Mp) {
|
|
this.amount = amount;
|
|
this.position = position;
|
|
}
|
|
}
|
|
|
|
class HitText {
|
|
list: HitObject[] = [];
|
|
|
|
add(amount: number, position: Vector3Mp) {
|
|
this.list.push(new HitObject(amount, position));
|
|
}
|
|
|
|
render() {
|
|
this.list.forEach((element: HitObject) => {
|
|
|
|
mp.game.graphics.drawText(element.amount.toString(), [element.position.x, element.position.y, element.position.z + 1.4], { font: 2, centre: true, color: [255, 255, 255, 155 - element.count], scale: [0.3, 0.3], outline: true });
|
|
element.count += 3;
|
|
element.position.z += 0.03;
|
|
|
|
if (element.count > 155) {
|
|
var find = Hits.list.findIndex(elemen => elemen == element);
|
|
|
|
Hits.list.splice(find, 1);
|
|
}
|
|
});
|
|
|
|
}
|
|
}
|
|
|
|
var Hits = new HitText();
|
|
|
|
mp.events.add(RageEnums.EventKey.RENDER, () => {
|
|
Hits.render();
|
|
});
|