aoe技能继续添加
This commit is contained in:
@@ -94,7 +94,7 @@ export class Skill extends ecs.Entity {
|
||||
// 设置技能组件属性
|
||||
Object.assign(SComp, {
|
||||
s_uuid: uuid,
|
||||
animType: config.AnimType,
|
||||
AType: config.AType,
|
||||
speed: config.speed,
|
||||
atk_count: 0,
|
||||
startPos: startPos,
|
||||
|
||||
@@ -4,7 +4,7 @@ import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/modu
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { AnimType, endType, RunType, SkillSet } from "../common/config/SkillSet";
|
||||
import { AType, EType, RType, SkillSet } from "../common/config/SkillSet";
|
||||
import { BoxSet } from "../common/config/BoxSet";
|
||||
import { HeroFac, HeroSet } from "../common/config/heroSet";
|
||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
@@ -28,7 +28,7 @@ export class SkillCom extends CCComp {
|
||||
atk_count:number = 0;
|
||||
is_destroy:boolean = false;
|
||||
enemys:any = [];
|
||||
animType: number = 0; // 运动类型
|
||||
AType: number = 0; // 运动类型
|
||||
startPos: Vec3 = v3(); // 起始位置
|
||||
targetPos: Vec3 = v3(); // 目标位置
|
||||
duration: number = 0; // 技能持续时间
|
||||
@@ -60,17 +60,17 @@ export class SkillCom extends CCComp {
|
||||
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
|
||||
}
|
||||
// console.log(this.group +"技能 collider ",collider);
|
||||
switch(SkillSet[this.s_uuid].AnimType){
|
||||
case AnimType.parabolic:
|
||||
switch(SkillSet[this.s_uuid].AType){
|
||||
case AType.parabolic:
|
||||
this.node.angle +=10
|
||||
let bm=this.node.getComponent(BezierMove)
|
||||
// bm.speed=700
|
||||
if(this.group==BoxSet.MONSTER) bm.controlPointSide=-1
|
||||
if(SkillSet[this.s_uuid].RunType==RunType.linear) bm.controlPointOffset=0
|
||||
if(SkillSet[this.s_uuid].RType==RType.linear) bm.controlPointOffset=0
|
||||
|
||||
bm.moveTo(this.targetPos)
|
||||
break;
|
||||
case AnimType.linear:
|
||||
case AType.linear:
|
||||
let tx =400
|
||||
if(this.group==BoxSet.MONSTER){
|
||||
tx=-400
|
||||
@@ -82,10 +82,10 @@ export class SkillCom extends CCComp {
|
||||
}
|
||||
}).start()
|
||||
break;
|
||||
case AnimType.fixedStart:
|
||||
case AType.fixedStart:
|
||||
|
||||
break;
|
||||
case AnimType.fixedEnd:
|
||||
case AType.fixedEnd:
|
||||
this.node.setPosition(this.targetPos.x,this.targetPos.y,0)
|
||||
if(this.node.getComponent(Animation)){
|
||||
let anim = this.node.getComponent(Animation);
|
||||
@@ -120,6 +120,8 @@ export class SkillCom extends CCComp {
|
||||
enemys.forEach(entity => {
|
||||
let view=entity.get(HeroViewComp)
|
||||
if(view){
|
||||
let dis =Math.abs(this.node.position.x-view.node.position.x)
|
||||
if(dis > SkillSet[this.s_uuid].with) return
|
||||
view.do_atked(remainingDamage)
|
||||
}
|
||||
});
|
||||
@@ -167,14 +169,15 @@ export class SkillCom extends CCComp {
|
||||
}
|
||||
|
||||
update(deltaTime: number) {
|
||||
let config=SkillSet[this.s_uuid]
|
||||
if(smc.mission.pause) return;
|
||||
if (!this.node || !this.node.isValid) return;
|
||||
this.hited_time+=deltaTime
|
||||
if(this.hited_time>SkillSet[this.s_uuid].hited&&this.animType==AnimType.fixedEnd&&this.hit_count==0){
|
||||
if(this.hited_time>config.hited&&this.AType==AType.fixedEnd&&this.hit_count == 0){
|
||||
this.hited_time=0
|
||||
this.onAnimationFinished()
|
||||
}
|
||||
// if(this.animType == AnimType.linear) this.startLinearMove(deltaTime);
|
||||
// if(this.AType == AType.linear) this.startLinearMove(deltaTime);
|
||||
this.toDestroy();
|
||||
}
|
||||
toDestroy() {
|
||||
@@ -196,7 +199,7 @@ export class SkillCom extends CCComp {
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
this.is_destroy = false;
|
||||
this.animType = 0;
|
||||
this.AType = 0;
|
||||
this.speed = 0;
|
||||
this.startPos.set();
|
||||
this.targetPos.set();
|
||||
|
||||
Reference in New Issue
Block a user