技能layer改变,位置信息修改
This commit is contained in:
@@ -1,27 +1,28 @@
|
||||
import { _decorator, Component, Node, tween, v3, Vec3 } from 'cc';
|
||||
import { SkillCom } from './SkillCom';
|
||||
import { smc } from '../common/SingletonModuleComp';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('BezCom')
|
||||
export class BezCom extends Component {
|
||||
start() {
|
||||
let base =this.node.getComponent(SkillCom)
|
||||
if(this.node.parent.scale.x < 0){
|
||||
base.t_pos.x=base.t_pos.x*-1
|
||||
}
|
||||
let s_pos = v3(this.node.position.x,this.node.position.y)
|
||||
let c_pos = v3((base.t_pos.x+this.node.position.x)/2,this.node.position.y+100)
|
||||
let e_pos = v3(this.node.position.x+base.t_pos.x,this.node.position.y+base.t_pos.y)
|
||||
// if(this.node.parent.scale.x < 0){
|
||||
// base.t_pos.x=base.t_pos.x*-1
|
||||
// }
|
||||
let s_pos = v3(this.node.position.x,this.node.position.y+35)
|
||||
let c_pos = v3((base.t_pos.x+this.node.position.x)/2,this.node.position.y+200)
|
||||
let e_pos = v3(base.t_pos.x,this.node.position.y+50)
|
||||
let time =Math.abs(base.t_pos.x/base.speed)
|
||||
BezCom.bezierTo(this.node,time,s_pos,c_pos,e_pos,{
|
||||
BezCom.bezierTo(this.node,base.in_time,s_pos,c_pos,e_pos,{
|
||||
onComplete: (target?: object) => {
|
||||
base.is_destroy=true
|
||||
},
|
||||
},
|
||||
}).start();
|
||||
}
|
||||
|
||||
update(deltaTime: number) {
|
||||
|
||||
if(smc.mission.pause) return
|
||||
}
|
||||
|
||||
public static bezierTo(target: any, duration: number, c1: Vec3, c2: Vec3, to: Vec3, opts: any) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { _decorator, Component, Node, tween, v3, Vec3 } from 'cc';
|
||||
import { SkillCom } from './SkillCom';
|
||||
import { smc } from '../common/SingletonModuleComp';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('LineCom')
|
||||
@@ -11,6 +12,7 @@ export class LineCom extends Component {
|
||||
}
|
||||
|
||||
update(deltaTime: number) {
|
||||
if(smc.mission.pause) return
|
||||
this.node.setPosition(this.node.position.x+this.base.speed*deltaTime,this.node.position.y,this.node.position.z)
|
||||
if(this.node.position.x>1000||this.node.position.x<-1000){
|
||||
this.base.is_destroy = true
|
||||
|
||||
@@ -29,8 +29,9 @@ export class Skill extends ecs.Entity {
|
||||
// console.log("load skill :",path,prefab)
|
||||
var node = instantiate(prefab);
|
||||
pos=v3(pos.x,pos.y)
|
||||
node.parent = parent;
|
||||
node.parent = parent.parent;
|
||||
node.setPosition(pos)
|
||||
if(group==BoxSet.MONSTER) node.setScale(v3(-1*node.scale.x,node.scale.y));
|
||||
var sv = node.getComponent(SkillCom);
|
||||
// let angle=0
|
||||
// if(SkillSet[uuid].angle){
|
||||
@@ -54,7 +55,7 @@ export class Skill extends ecs.Entity {
|
||||
// node.setScale(v3(node.scale.x*scale,node.scale.y))
|
||||
sv.speed=SkillSet[uuid].speed;
|
||||
sv.in_time=SkillSet[uuid].in;
|
||||
// if(group==BoxSet.MONSTER) t_pos.x=-1*t_pos.x
|
||||
|
||||
sv.t_pos = t_pos; // 目标增量
|
||||
sv.type = SkillSet[uuid].type;
|
||||
sv.box_tag= BoxSet.SKILL_TAG;
|
||||
|
||||
@@ -5,6 +5,8 @@ import { BoxSet } from "../common/config/BoxSet";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer";
|
||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
@@ -35,6 +37,7 @@ export class SkillCom extends CCComp {
|
||||
in_time:number = 0.3; // 不动技能持续时间
|
||||
enemys:any = [];
|
||||
start() {
|
||||
oops.message.on(GameEvent.MissionEnd, this.doDestroy, this);
|
||||
this.node.active=true
|
||||
let collider = this.getComponent(Collider2D);
|
||||
collider.group = this.box_group;
|
||||
@@ -73,7 +76,7 @@ export class SkillCom extends CCComp {
|
||||
|
||||
}
|
||||
update(deltaTime: number) {
|
||||
|
||||
if(smc.mission.pause) return
|
||||
this.toDestroy()
|
||||
|
||||
}
|
||||
@@ -82,6 +85,9 @@ export class SkillCom extends CCComp {
|
||||
this.ent.destroy()
|
||||
}
|
||||
}
|
||||
doDestroy(){
|
||||
this.is_destroy=true
|
||||
}
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
this.is_destroy=false
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { _decorator, Component, Node, v3 } from 'cc';
|
||||
import { SkillCom } from './SkillCom';
|
||||
import { BoxSet } from '../common/config/BoxSet';
|
||||
import { smc } from '../common/SingletonModuleComp';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('TgCom')
|
||||
@@ -10,13 +11,11 @@ export class TgCom extends Component {
|
||||
base:SkillCom = null
|
||||
start() {
|
||||
this.base =this.node.getComponent(SkillCom)
|
||||
if(this.base.box_group==BoxSet.MONSTER){
|
||||
this.base.t_pos.x=-1*this.base.t_pos.x
|
||||
}
|
||||
this.node.setPosition(this.base.t_pos)
|
||||
}
|
||||
|
||||
update(deltaTime: number) {
|
||||
if(smc.mission.pause) return
|
||||
this.cd+=deltaTime
|
||||
if(this.cd>=1){
|
||||
// this.node.setPosition(v3(-1000,0,0))
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import { timedCom } from './timedCom';
|
||||
import { HeroViewComp } from '../hero/HeroViewComp';
|
||||
import { smc } from '../common/SingletonModuleComp';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('debuff')
|
||||
@@ -16,6 +17,7 @@ export class debuff extends Component {
|
||||
}
|
||||
|
||||
update(deltaTime: number) {
|
||||
if(smc.mission.pause) return
|
||||
this.cd += deltaTime
|
||||
if(this.cd >=1){
|
||||
// this.node.setPosition(v3(-1000,0,0))
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import { SkillSet } from '../common/config/SkillSet';
|
||||
import { smc } from '../common/SingletonModuleComp';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('timedCom')
|
||||
|
||||
Reference in New Issue
Block a user