Commit 994e312f authored by Vũ Gia Vương's avatar Vũ Gia Vương

update slot when break jar fragment

parent ac5fbaf3
...@@ -36,12 +36,13 @@ export default class BehindFragment extends cc.Component { ...@@ -36,12 +36,13 @@ export default class BehindFragment extends cc.Component {
public onDrop() { public onDrop() {
console.log('onDrop',)
this._isDropped = true; this._isDropped = true;
cc.tween(this.node) cc.tween(this.node)
.repeat(4, cc.tween(this.node) .repeat(4, cc.tween(this.node)
.by(Global.getRandomTime(), { position: cc.v3(-5, -5) }) .by(Global.getRandomTimeSkew(), { position: cc.v3(-5, -5) })
.by(Global.getRandomTime(), { position: cc.v3(5, 5) }) .by(Global.getRandomTimeSkew(), { position: cc.v3(5, 5) })
) )
.start(); .start();
......
...@@ -185,7 +185,6 @@ export default class BreakingJarController extends cc.Component { ...@@ -185,7 +185,6 @@ export default class BreakingJarController extends cc.Component {
} }
private onTouchStart(event: cc.Event.EventTouch) { private onTouchStart(event: cc.Event.EventTouch) {
console.log('onTouchStart', 1)
eventTarget.emit(STOP_GUILD_TAP); eventTarget.emit(STOP_GUILD_TAP);
const pos = event.getLocation(); const pos = event.getLocation();
const nodePos = this.node.convertToNodeSpaceAR(pos); const nodePos = this.node.convertToNodeSpaceAR(pos);
......
...@@ -96,6 +96,9 @@ export default class FragmentJarController extends cc.Component { ...@@ -96,6 +96,9 @@ export default class FragmentJarController extends cc.Component {
} }
if (this._numberOfBeats > 0) { if (this._numberOfBeats > 0) {
cc.tween(this.node)
.to(0.1, { scale: 1 - 0.02 * (3 - this._numberOfBeats) })
.start();
return; return;
} }
...@@ -117,20 +120,22 @@ export default class FragmentJarController extends cc.Component { ...@@ -117,20 +120,22 @@ export default class FragmentJarController extends cc.Component {
this.isDropped = true; this.isDropped = true;
const pos = this.node.position; const pos = this.node.position;
eventTarget.emit(CHECK_FRAGMENT, this.node); eventTarget.emit(CHECK_FRAGMENT, this.node);
cc.Tween.stopAllByTarget(this.node);
cc.tween(this.node) cc.tween(this.node)
.repeat(4, cc.tween(this.node) .repeat(4, cc.tween(this.node)
.by(Global.getRandomTime(), { position: cc.v3(-5, -5) }) .by(Global.getRandomTimeSkew(), { position: cc.v3(-5, -5) })
.by(Global.getRandomTime(), { position: cc.v3(5, 5) }) .by(Global.getRandomTimeSkew(), { position: cc.v3(5, 5) })
) )
.to(Global.getRandomTime() * 5, { scale: 1.1 })
.call(() => { .call(() => {
eventTarget.emit(PLAY_DROP_SOUND); eventTarget.emit(PLAY_DROP_SOUND);
this.node.setSiblingIndex(-1); this.node.setSiblingIndex(-1);
})
.to(Global.getRandomTimeSkew() * 5, { position: cc.v3(pos.x, pos.y - Global.getRandomTimeSkew() * 50) })
.call(() => {
this._physicsCollider.enabled = true; this._physicsCollider.enabled = true;
this._rg.type = cc.RigidBodyType.Dynamic; this._rg.type = cc.RigidBodyType.Dynamic;
this._rg.gravityScale = 10; this._rg.gravityScale = 15;
}) })
.delay(1) .delay(1)
.to(0, { scale: 1 }) .to(0, { scale: 1 })
......
export class Global { export class Global {
public static tool: number = 0; public static tool: number = 0;
public static getRandomTime() { public static getRandomTimeSkew() {
return Math.random() * 0.05 + 0.03; return Math.random() * 0.05 + 0.03;
} }
} }
\ No newline at end of file
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