Commit 9041bc81 authored by Vũ Gia Vương's avatar Vũ Gia Vương

fix time beat jar

parent dbd4db80
...@@ -47,10 +47,10 @@ export default class FragmentJarController extends cc.Component { ...@@ -47,10 +47,10 @@ export default class FragmentJarController extends cc.Component {
return; return;
} }
const pos = point.clone().subtract(cc.v2(this.node.position.x, this.node.position.y)); const pos = point.clone().subtract(cc.v2(this.node.position.x, this.node.position.y));
const isInside = cc.Intersection.pointInPolygon(pos, this._physicsCollider.points); const isInside = cc.Intersection.pointInPolygon(pos, this._physicsCollider.points);
let isInsideFragmentLink = false; let isInsideFragmentLink = false;
if (this._physicsColliderFragmentLink) { if (this._physicsColliderFragmentLink) {
const posFragmentLink = point.clone().subtract(cc.v2(this.fragmentLink.position.x, this.fragmentLink.position.y)); const posFragmentLink = point.clone().subtract(cc.v2(this.fragmentLink.position.x, this.fragmentLink.position.y));
isInsideFragmentLink = cc.Intersection.pointInPolygon(posFragmentLink, this._physicsColliderFragmentLink.points); isInsideFragmentLink = cc.Intersection.pointInPolygon(posFragmentLink, this._physicsColliderFragmentLink.points);
...@@ -60,10 +60,15 @@ export default class FragmentJarController extends cc.Component { ...@@ -60,10 +60,15 @@ export default class FragmentJarController extends cc.Component {
return; return;
} }
this._numberOfBeats--;
if (this._slots.length > 0) { if (this._slots.length > 0) {
this._slots[Math.min(3 - this._numberOfBeats, 1)].active = true; cc.tween(this)
.delay(0.5)
.call(() => {
this._slots[Math.min(2 - this._numberOfBeats, 1)].active = true
})
.start();
} }
this._numberOfBeats--;
eventTarget.emit(HAMMER, point); eventTarget.emit(HAMMER, point);
if (this._numberOfBeats <= 0) { if (this._numberOfBeats <= 0) {
......
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