Commit dd1d95c4 authored by haiyoucuv's avatar haiyoucuv

init

parent 0b66826e
......@@ -25,8 +25,6 @@ export default class ReviewPanel extends Panel {
tip: Label = null!;
async start() {
sendLog(LOG_TYPE.EXPOSURE, 24);
sendLog(LOG_TYPE.EXPOSURE, 25);
this.ok.on(Button.EventType.CLICK, this.onOk, this);
this.close.on(Button.EventType.CLICK, this.onClose, this);
this.cancel.on(Button.EventType.CLICK, this.onClose, this);
......@@ -39,7 +37,6 @@ export default class ReviewPanel extends Panel {
* 确认复活
*/
onOk = () => {
sendLog(LOG_TYPE.CLICK, 25);
this.data.review();
this.hidePanel();
}
......@@ -49,7 +46,6 @@ export default class ReviewPanel extends Panel {
*/
onClose = () => {
// 结算
sendLog(LOG_TYPE.CLICK, 24)
this.data.submit();
this.hidePanel();
}
......
......@@ -28,7 +28,7 @@ import Svga from "db://assets/Component/Svga/Svga";
import { showPanel } from "db://assets/Module/UIFast";
import GameChooseHand from "db://assets/Scripts/Panels/GameChooseHand";
import ReviewPanel from "db://assets/Scripts/Panels/ReviewPanel";
import { sleep } from "db://assets/Scripts/Utils/Utils";
import { _asyncThrottle, sleep } from "db://assets/Scripts/Utils/Utils";
import {
LOG_TYPE,
sendLog,
......@@ -493,9 +493,8 @@ export class MainGame extends Scene {
onTouchMove = (e: EventTouch) => {
};
onTouchEC = this.throttle((event: EventTouch) => {
onTouchEC = _asyncThrottle((e: EventTouch) => {
if (!this.isStart || this.isOver) return;
let e = event[0];
const start = e.getStartLocation ? e.getStartLocation() : e.getLocation();
const end = e.getLocation();
......@@ -506,7 +505,6 @@ export class MainGame extends Scene {
if (this.isUseGod) {
this.schedule(
() => {
console.log(1)
this.shoot(powerScale, dp.x / 130);
},
0.1,
......@@ -517,21 +515,6 @@ export class MainGame extends Scene {
}
}, 1000);
// 截流
throttle(fn, delay) {
let prev = Date.now();
return function () {
const context = this,
args = arguments;
let now = Date.now();
// console.log(now, prev);
if (now - prev >= delay) {
fn.call(context, args);
prev = now;
}
};
}
/**
* 发射
* @param powerScale
......
......@@ -46,7 +46,8 @@ export class Quan extends Component {
}
const collider = this.node.addComponent(BoxCollider);
collider.size = v3(0.8 * this.radius * this.scale, 0.1, 0.8 * this.radius * this.scale);
const w = 0.85 * this.radius * this.scale;
collider.size = v3(w, 0.08, w);
collider.isTrigger = true;
collider.on("onTriggerEnter", this.onTriggerEnter, this);
}
......@@ -79,7 +80,7 @@ export class Quan extends Component {
this.isShoot = true;
this.hit = false;
this.rb.enabled = true;
const power = v3(endX, 27, -22).multiply3f(1, powerScale, powerScale);
const power = v3(endX, 27.8, -22).multiply3f(1, powerScale, powerScale);
this.rb.applyImpulse(power);
// this.rb.setLinearVelocity(new Vec3(0, 15, -25));
// this.rb.applyForce(new Vec3(0, 800, -2050));
......@@ -96,6 +97,8 @@ export class Quan extends Component {
this.judgeDestroy();
}
v3 = new Vec3();
/**
* 检测是否停止或者消失
*/
......@@ -103,15 +106,20 @@ export class Quan extends Component {
if (!this.isShoot || this.hit) return;
const y = this.node.getPosition().y;
// this.frame1Y = this.frame2Y;
// this.frame2Y = this.frame3Y;
// this.frame3Y = y;
//
this.frame1Y = this.frame2Y;
this.frame2Y = this.frame3Y;
this.frame3Y = y;
this.rb.getLinearVelocity(this.v3);
if(this.v3.length() < 0.001) {
this.node.destroy();
return;
}
// const dy32 = Math.abs(this.frame3Y - this.frame2Y);
// const dy21 = Math.abs(this.frame2Y - this.frame1Y);
// const dy31 = Math.abs(this.frame3Y - this.frame1Y);
//
// if (dy32 < 0.0005 && dy21 < 0.0005 && dy31 < 0.0005) {
// if (dy32 < 0.0002 && dy21 < 0.0002 && dy31 < 0.0002) {
// // TODO找个合理的边界值
// // console.log("停止飞行");
// this.node.destroy();
......
This diff is collapsed.
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