dd
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { _decorator,v3,Vec3 } from "cc";
|
||||
import { _decorator,v3,Vec3 ,Label} from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer";
|
||||
@@ -8,6 +8,7 @@ import { Monster } from "./Monster";
|
||||
import { MonsterModelComp } from "./MonsterModelComp";
|
||||
import { MonsterViewComp } from "./MonsterViewComp";
|
||||
import { BoxSet } from "../common/config/BoxSet";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@@ -18,6 +19,7 @@ export class CSkillComp extends CCComp {
|
||||
private sd:Timer = new Timer(5)
|
||||
private cd:Timer = new Timer(1)
|
||||
private is_destroy:boolean = false;
|
||||
time:number = 0;
|
||||
scale:number = 1;
|
||||
speed:number = 0;
|
||||
dis:number = 0;
|
||||
@@ -29,6 +31,8 @@ export class CSkillComp extends CCComp {
|
||||
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
|
||||
this.sd =new Timer(SkillSet[this.skill_uuid].sd)
|
||||
this.cd = new Timer(SkillSet[this.skill_uuid].cd)
|
||||
this.time =SkillSet[this.skill_uuid].sd
|
||||
this.node.getChildByName("time").getComponent(Label).string = this.time.toString()
|
||||
|
||||
}
|
||||
protected update(dt: number): void {
|
||||
@@ -39,6 +43,8 @@ export class CSkillComp extends CCComp {
|
||||
this.to_destroy()
|
||||
}
|
||||
if (this.cd.update(dt)) {
|
||||
this.time -=1
|
||||
this.node.getChildByName("time").getComponent(Label).string = this.time.toString()
|
||||
this.shoot()
|
||||
}
|
||||
}
|
||||
@@ -78,6 +84,7 @@ export class CSkillComp extends CCComp {
|
||||
// }
|
||||
to_destroy() {
|
||||
this.is_destroy = true
|
||||
this.remove_buff()
|
||||
// console.log("CSkillComp toDestroy");
|
||||
if (this.node.isValid) {
|
||||
// console.log("CSkillComp.node.isValid");
|
||||
@@ -85,6 +92,14 @@ export class CSkillComp extends CCComp {
|
||||
this.ent.destroy()
|
||||
}
|
||||
}
|
||||
remove_buff(){
|
||||
for (let index = 0; index < 8; index++) {
|
||||
if(smc.player_buffs[index].eid == this.ent.eid){
|
||||
smc.player_buffs[index].eid=0
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
this.sd.reset()
|
||||
|
||||
Reference in New Issue
Block a user