This commit is contained in:
2025-01-03 11:48:37 +08:00
parent 713800df2b
commit 197be0c56a
43 changed files with 18419 additions and 6482 deletions

View File

@@ -1,41 +1,47 @@
import { _decorator, Component, Node, tween ,Vec3,v3,Collider2D,Contact2DType} from 'cc';
import { BoxSet } from '../common/config/BoxSet';
import { Timer } from 'db://oops-framework/core/common/timer/Timer';
const { ccclass, property } = _decorator;
@ccclass('baseCom')
export class baseCom extends Component {
speed:number = 600;
range:number = 80;
s_uuid:number = 0;
speed:number = 200;
y_speed:number = 0;
x_speed:number = 0;
dis:number = 80;
scale:number = 1;
ap:number = 10;
atk_count:number = 0;
is_crit:boolean = false;
crit_add: number = 0;//暴击伤害加成
angle:number = 0;
t_pos:Vec3 = v3(0,0,0); // 目标增量
is_destroy:boolean = false;
box_group:number = 0;
box_tag:number=0;
type:number = 1;
time:Timer = new Timer(0.01);
run_type:number = 0; // 0有目标 带方向1贝塞尔曲线 2 不动 ,3 直线
in_time:number = 0.3; // 不动技能持续时间
start() {
let collider = this.getComponent(Collider2D);
if (collider) {
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
}
console.log("baseCom start")
// let collider = this.getComponent(Collider2D);
// collider.group = this.box_group;
// collider.tag = this.box_tag;
// collider.sensor = true;
// if (collider) {
// collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
// // collider.on(Contact2DType.END_CONTACT, this.onEndContact, this);
// collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);
// }
}
onBeginContact (selfCollider: Collider2D, otherCollider: Collider2D) {
switch (selfCollider.group) {
case BoxSet.HERO_SKILL:
switch (otherCollider.group){
case BoxSet.MONSTER:
// this.reset()
console.log('hero skill',selfCollider,otherCollider);
// this.speed = 0;
// this.timer = 1;
// console.log("speed:"+this.speed+" | timer:"+this.timer);
break;
}
break;
case BoxSet.MONSTER_SKILL:
switch (otherCollider.group){
case BoxSet.HERO:
// console.log('monster skill',selfCollider,otherCollider);
// this.reset()
break;
}
}
}
onPostSolve(selfCollider: Collider2D, otherCollider: Collider2D){
}
reset() {
@@ -43,12 +49,7 @@ export class baseCom extends Component {
}
update(deltaTime: number) {
this.node.setScale(v3(this.scale,this.node.scale.y,this.node.scale.z))
this.node.setPosition(v3(this.node.position.x+deltaTime*this.speed*this.scale,this.node.position.y,this.node.position.z))
if(Math.abs(this.node.position.x) > this.range)
{
this.node.destroy()
}
}
}