Commit 5ed973cb authored by Vũ Gia Vương's avatar Vũ Gia Vương

add RESET_FRAGMENT

parent f4eee2d3
......@@ -24,4 +24,5 @@ export const STOP_GUILD_TAP = 'STOP_GUILD_TAP';
export const CHECK_TOUCH = 'CHECK_TOUCH';
export const CHECK_FRAGMENT = 'CHECK_FRAGMENT';
export const HAMMER = 'HAMMER';
export const RESET_BOTTLE = 'RESET_BOTTLE';
\ No newline at end of file
export const RESET_BOTTLE = 'RESET_BOTTLE';
export const RESET_FRAGMENT = 'RESET_FRAGMENT';
\ No newline at end of file
import { CHECK_FRAGMENT, CHECK_TOUCH, eventTarget, HAMMER, RESET_BOTTLE, SHOW_CARD_POPUP } from "../Events";
import { CHECK_FRAGMENT, CHECK_TOUCH, eventTarget, HAMMER, RESET_BOTTLE, RESET_FRAGMENT, SHOW_CARD_POPUP } from "../Events";
import { Global } from "../Global";
import FragmentController from "./FragmentController";
import TheController from "./TheController";
......@@ -47,10 +47,10 @@ export default class BreakingBottleController extends cc.Component {
this._spine.setSkin(this._skins[Global.tool % this._skins.length]);
this._spine.setAnimation(0, "Dap4", false);
this._fragmentsNode.forEach((item, index) => {
item.position = this._fragmentsPosition[index];
item.getComponent(FragmentController).reset();
this._fragmentsNode.forEach((node, index) => {
node.position = this._fragmentsPosition[index];
})
eventTarget.emit(RESET_FRAGMENT);
}
private onHammer(newPos: cc.Vec2) {
......
import { eventTarget, CHECK_TOUCH, CHECK_FRAGMENT, HAMMER } from "../Events";
import { eventTarget, CHECK_TOUCH, CHECK_FRAGMENT, HAMMER, RESET_FRAGMENT } from "../Events";
const { ccclass, property } = cc._decorator;
......@@ -20,6 +20,7 @@ export default class FragmentController extends cc.Component {
this.reset();
eventTarget.on(CHECK_TOUCH, this.checkTouch, this);
eventTarget.on(RESET_FRAGMENT, this.reset, this);
}
public reset() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment