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

fix slot jar when emit, fix slot drop, update debound hammer

parent 878d9177
......@@ -12495,9 +12495,7 @@
},
"_enabled": true,
"slotJarIndex": [
1,
2,
4
1
],
"_id": ""
},
......
......@@ -36,7 +36,6 @@ export default class BehindFragment extends cc.Component {
public onDrop() {
console.log('onDrop',)
this._isDropped = true;
cc.tween(this.node)
......
......@@ -26,6 +26,7 @@ export default class BreakingJarController extends cc.Component {
private _behindJarChild: BehindFragment[] = [];
private _behindJarChildPosition: cc.Vec3[] = [];
private _hamerAvatar: cc.Sprite = null;
private _isBreak = true;
onLoad() {
cc.director.getPhysicsManager().enabled = true;
......@@ -176,7 +177,13 @@ export default class BreakingJarController extends cc.Component {
const pos = event.getLocation();
const nodePos = this.node.convertToNodeSpaceAR(pos);
if (!this._isBreak) {
return;
}
eventTarget.emit(CHECK_TOUCH, nodePos);
this._isBreak = false;
this.scheduleOnce(() => this._isBreak = true, 0.5);
}
private onTouchEnd(event: cc.Event.EventTouch) {
......
......@@ -71,15 +71,16 @@ export default class FragmentJarController extends cc.Component {
eventTarget.emit(HAMMER, point);
this.scheduleOnce(() => {
eventTarget.emit(SHOW_SLOT_JAR, this.slotJarIndex, 3 - this._numberOfBeats);
this.node.scale = 1 - 0.02 * (3 - this._numberOfBeats);
}, 0.5);
if (this._numberOfBeats == 1) {
eventTarget.emit(SHOW_FOG, this.node.position);
}
if (this._numberOfBeats > 0) {
cc.tween(this.node)
.to(0.1, { scale: 1 - 0.02 * (3 - this._numberOfBeats) })
.start();
return;
}
......@@ -107,6 +108,7 @@ export default class FragmentJarController extends cc.Component {
cc.Tween.stopAllByTarget(this.node);
cc.tween(this.node)
.delay(0.5)
.repeat(4, cc.tween(this.node)
.by(Global.getRandomTimeSkew(), { position: cc.v3(-5, -5) })
.by(Global.getRandomTimeSkew(), { position: cc.v3(5, 5) })
......@@ -115,13 +117,15 @@ export default class FragmentJarController extends cc.Component {
eventTarget.emit(PLAY_DROP_SOUND);
this.node.setSiblingIndex(-1);
})
.to(Global.getRandomTimeSkew() * 5, { position: cc.v3(pos.x, pos.y - Global.getRandomTimeSkew() * 50) })
.call(() => {
this._physicsCollider.enabled = true;
this._rg.type = cc.RigidBodyType.Dynamic;
this._physicsCollider.enabled = false;
this._rg.gravityScale = 15;
})
.delay(1)
.delay(0.4)
.call(() => this._physicsCollider.enabled = true)
.delay(0.6)
.to(0, { scale: 1 })
.start();
}
......
......@@ -19,6 +19,10 @@ export default class SlotJar extends cc.Component {
private showSlotByIndex(indexs: number[], breakCount: number): void {
indexs.forEach(index => {
if(this._slotShowder[index] > 1){
return;
}
this._slotShowder[index] = breakCount;
this._slotBreak1thNodes[index].active = true;
this._slotBreak2thNodes[index].active = breakCount >= 2;
})
......@@ -32,5 +36,6 @@ export default class SlotJar extends cc.Component {
private resetSlots(): void {
this._slotBreak1thNodes.forEach(node => node.active = false);
this._slotBreak2thNodes.map(node => node.active = false);
this._slotShowder = {};
}
}
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