From 54167ec52868f7eb21f04a643cc6b37d10ed9bea Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 20 Dec 2022 10:05:43 +0100 Subject: [PATCH] Xp anim --- assets/Media/Prefabs/Game/Drops/XP.prefab | 3 +++ assets/Scripts/Game/XP/XP.ts | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/assets/Media/Prefabs/Game/Drops/XP.prefab b/assets/Media/Prefabs/Game/Drops/XP.prefab index a7ad47f..070f4b9 100644 --- a/assets/Media/Prefabs/Game/Drops/XP.prefab +++ b/assets/Media/Prefabs/Game/Drops/XP.prefab @@ -342,6 +342,9 @@ "__prefab": { "__id__": 17 }, + "animation": { + "__id__": 18 + }, "_id": "" }, { diff --git a/assets/Scripts/Game/XP/XP.ts b/assets/Scripts/Game/XP/XP.ts index b4b5078..91e5d7b 100644 --- a/assets/Scripts/Game/XP/XP.ts +++ b/assets/Scripts/Game/XP/XP.ts @@ -1,10 +1,12 @@ -import { Component, Vec3, _decorator } from "cc"; +import { Animation, 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 { + @property(Animation) private animation: Animation; + private pickUpEvent: Signal = new Signal(); private value = 2; @@ -12,6 +14,7 @@ export class XP extends Component { this.node.setWorldPosition(position); this.value = value; this.node.active = true; + this.animation.play("DropStart"); } public get Value(): number {