调整盾技能, 盾图片资源需要换
This commit is contained in:
@@ -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 { AType, DTType, EType, RType, SkillSet, SType, TGroup } from "../common/config/SkillSet";
|
||||
import { AType, DTType, EType, SkillSet, SType, TGroup } from "../common/config/SkillSet";
|
||||
import { BoxSet, FacSet } from "../common/config/BoxSet";
|
||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
import { BezierMove } from "../BezierMove/BezierMove";
|
||||
@@ -117,68 +117,52 @@ export class SkillCom extends CCComp {
|
||||
break;
|
||||
case AType.StartEnd:
|
||||
// 2段位移:先升高,然后移到目的地
|
||||
this.executeTwoStageMovement();
|
||||
this.node.setPosition(this.startPos.x > 360?300:this.startPos.x,0,0)
|
||||
this.do_anim()
|
||||
break;
|
||||
case AType.fixedEnd:
|
||||
this.node.setPosition(this.targetPos.x > 360?300:this.targetPos.x,0,0)
|
||||
if(this.node.getComponent(Animation)){
|
||||
let anim = this.node.getComponent(Animation);
|
||||
//console.log("[SkillCom]:has anim",anim)
|
||||
anim.on(Animation.EventType.FINISHED, this.onAnimationFinished, this);
|
||||
}
|
||||
if(this.node.getChildByName('anm')){
|
||||
if(this.node.getChildByName('anm').getComponent('sp.Skeleton')){
|
||||
//console.log("[SkillCom]:has spine",this.spine)
|
||||
this.spine.setCompleteListener((trackEntry) => {
|
||||
this.onAnimationFinished()
|
||||
//console.log("[SkillCom]:[track %s][animation %s] complete: %s", trackEntry.trackIndex);
|
||||
});
|
||||
}
|
||||
}
|
||||
this.do_anim()
|
||||
break;
|
||||
case AType.fixedStart: //
|
||||
|
||||
this.node.setPosition(this.startPos.x > 360?300:this.startPos.x,0,0)
|
||||
|
||||
if(this.node.getComponent(Animation)){
|
||||
let anim = this.node.getComponent(Animation);
|
||||
//console.log("[SkillCom]:has anim",anim)
|
||||
anim.on(Animation.EventType.FINISHED, this.onAnimationFinished, this);
|
||||
}
|
||||
if(this.node.getChildByName('anm')){
|
||||
if(this.node.getChildByName('anm').getComponent('sp.Skeleton')){
|
||||
//console.log("[SkillCom]:has spine",this.spine)
|
||||
this.spine.setCompleteListener((trackEntry) => {
|
||||
this.onAnimationFinished()
|
||||
//console.log("[SkillCom]:[track %s][animation %s] complete: %s", trackEntry.trackIndex);
|
||||
});
|
||||
}
|
||||
}
|
||||
this.node.setPosition(this.startPos.x > 360?300:this.startPos.x,0,0)
|
||||
this.do_anim()
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
do_anim(){
|
||||
if(this.node.getComponent(Animation)){
|
||||
let anim = this.node.getComponent(Animation);
|
||||
//console.log("[SkillCom]:has anim",anim)
|
||||
anim.on(Animation.EventType.FINISHED, this.onAnimationFinished, this);
|
||||
}
|
||||
if(this.node.getChildByName('anm')){
|
||||
if(this.node.getChildByName('anm').getComponent('sp.Skeleton')){
|
||||
//console.log("[SkillCom]:has spine",this.spine)
|
||||
this.spine.setCompleteListener((trackEntry) => {
|
||||
this.onAnimationFinished()
|
||||
//console.log("[SkillCom]:[track %s][animation %s] complete: %s", trackEntry.trackIndex);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
onAnimationFinished(){
|
||||
console.log("[SkillCom]:onAnimationFinished",this.s_uuid)
|
||||
if(SkillSet[this.s_uuid].EType==EType.timeEnd) return
|
||||
if(SkillSet[this.s_uuid].SType!=SType.damage){
|
||||
this.to_do_buff()
|
||||
}
|
||||
|
||||
this.is_destroy=true
|
||||
}
|
||||
//范围伤害
|
||||
range_damage(){
|
||||
// console.log("[SkillCom]:range_damage",this.s_uuid)
|
||||
let enemys=ecs.query(ecs.allOf(MonModelComp))
|
||||
if(this.fac==FacSet.MON) enemys=ecs.query(ecs.allOf(HeroModelComp))
|
||||
enemys.forEach(entity => {
|
||||
let view=entity.get(HeroViewComp)
|
||||
if(view){
|
||||
let dis_x =Math.abs(this.node.position.x-view.node.position.x)
|
||||
let dis_y =Math.abs(this.node.position.y-view.node.position.y)
|
||||
if(dis_x > SkillSet[this.s_uuid].with||dis_y > SkillSet[this.s_uuid].with) return
|
||||
this.single_damage(view,true)
|
||||
}
|
||||
});
|
||||
to_do_buff(){
|
||||
switch(SkillSet[this.s_uuid].SType){
|
||||
case SType.shield:
|
||||
this.caster.add_shield(SkillSet[this.s_uuid].buV)
|
||||
break;
|
||||
}
|
||||
}
|
||||
//单体伤害
|
||||
single_damage(target:HeroViewComp,is_range:boolean=false){
|
||||
@@ -205,7 +189,7 @@ export class SkillCom extends CCComp {
|
||||
}
|
||||
this.hit_count++
|
||||
// console.log("[SkillCom]:碰撞次数:技能次数:穿刺次数",this.hit_count,SkillSet[this.s_uuid].hit,this.puncture)
|
||||
if(this.hit_count>=(SkillSet[this.s_uuid].hit+this.puncture)&&(SkillSet[this.s_uuid].DTType!=DTType.range)&&(SkillSet[this.s_uuid].EType!=EType.animationEnd)) this.is_destroy=true // 技能命中次数
|
||||
if(this.hit_count>=(SkillSet[this.s_uuid].hit+this.puncture)&&(SkillSet[this.s_uuid].DTType!=DTType.range)&&(SkillSet[this.s_uuid].EType!=EType.animationEnd)&&(SkillSet[this.s_uuid].EType!=EType.timeEnd)) this.is_destroy=true // 技能命中次数
|
||||
}
|
||||
|
||||
onBeginContact (seCol: Collider2D, oCol: Collider2D) {
|
||||
@@ -221,53 +205,6 @@ export class SkillCom extends CCComp {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 执行2段位移:先升高,然后移到目的地
|
||||
*/
|
||||
private executeTwoStageMovement() {
|
||||
const totalDuration = SkillSet[this.s_uuid].in-0.1
|
||||
const firstStageDuration = totalDuration * 0.4; // 第一段占40%时间
|
||||
const secondStageDuration = totalDuration * 0.6; // 第二段占60%时间
|
||||
|
||||
// 第一段:升高
|
||||
const riseHeight = 100; // 升高高度
|
||||
const midPosition = v3(this.node.position.x, this.node.position.y + riseHeight, 0);
|
||||
|
||||
// 第二段:移动到目标位置
|
||||
const finalPosition = v3(this.targetPos.x, this.targetPos.y, 0);
|
||||
|
||||
// 创建缓动序列
|
||||
tween(this.node)
|
||||
// 第一段:升高
|
||||
.to(firstStageDuration, { position: midPosition }, {
|
||||
easing: 'quadOut' // 使用二次缓出效果,让上升更自然
|
||||
})
|
||||
// 第二段:移动到目标位置
|
||||
.to(secondStageDuration, { position: finalPosition }, {
|
||||
easing: 'quadInOut' // 使用二次缓入缓出效果
|
||||
}).call(()=>{
|
||||
this.do_buff()
|
||||
})
|
||||
.start();
|
||||
}
|
||||
private do_buff(){
|
||||
//console.log("[SkillCom]:do_buff")
|
||||
let teams=ecs.query(ecs.allOf(HeroModelComp))
|
||||
if(this.fac==FacSet.MON) teams=ecs.query(ecs.allOf(MonModelComp))
|
||||
if(SkillSet[this.s_uuid].TGroup==TGroup.Team||SkillSet[this.s_uuid].TGroup==TGroup.Self) {
|
||||
teams.forEach(entity => {
|
||||
let view=entity.get(HeroViewComp)
|
||||
if(view.node.position.x==this.targetPos.x){
|
||||
if(SkillSet[this.s_uuid].SType==SType.heal){
|
||||
view.add_hp(this.buV,false)
|
||||
}
|
||||
if(SkillSet[this.s_uuid].SType==SType.shield){
|
||||
view.add_shield(this.buV)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
update(deltaTime: number) {
|
||||
let config=SkillSet[this.s_uuid]
|
||||
@@ -286,12 +223,7 @@ export class SkillCom extends CCComp {
|
||||
this.is_destroy=true
|
||||
}
|
||||
}
|
||||
//范围伤害
|
||||
this.hited_time+=deltaTime
|
||||
if(this.hited_time>config.hited&&(SkillSet[this.s_uuid].DTType==DTType.range)){
|
||||
this.hited_time=0
|
||||
this.range_damage()
|
||||
}
|
||||
|
||||
//直线移动
|
||||
// if(this.AType == AType.linear) this.startLinearMove(deltaTime);
|
||||
this.toDestroy();
|
||||
|
||||
Reference in New Issue
Block a user