技能改spine 怪物增加

This commit is contained in:
walkpan
2025-01-12 23:58:35 +08:00
parent 8d0c6e24be
commit 09f6b140bb
305 changed files with 63972 additions and 21951 deletions

View File

@@ -4,8 +4,8 @@ import { HeroViewComp } from '../hero/HeroViewComp';
import { smc } from '../common/SingletonModuleComp';
const { ccclass, property } = _decorator;
@ccclass('BuffCom')
export class BuffCom extends Component {
@ccclass('CdCom')
export class CdCom extends Component {
cd:number = 0;
base:SkillCom = null
time:number = 0;
@@ -16,10 +16,6 @@ export class BuffCom extends Component {
update(deltaTime: number) {
if(smc.mission.pause) return
this.cd+=deltaTime
this.time+=deltaTime
if(this.time>=this.base.in_time){
this.base.is_destroy = true
}
if(this.cd>=this.base.cd){
if(this.base.is_destroy) return
// this.node.setPosition(v3(-1000,0,0))

View File

@@ -0,0 +1,42 @@
import { _decorator, Animation, Collider2D, Component, Node, sp } from 'cc';
import { SkillCom } from './SkillCom';
import { BoxSet } from '../common/config/BoxSet';
import { Hero } from '../hero/Hero';
const { ccclass, property } = _decorator;
@ccclass('EndAnmBomCom')
export class EndAnmBomCom extends Component {
time:number = 0
base:SkillCom = null
collider:Collider2D = null
start() {
this.base =this.node.getComponent(SkillCom)
this.collider = this.getComponent(Collider2D);
console.log("collider",this.collider)
if(this.base.box_group ==BoxSet.HERO) this.collider.group = BoxSet.MONSTER
if(this.base.box_group ==BoxSet.MONSTER) this.collider.group = BoxSet.HERO
let anim = this.node.getComponent(Animation);
if(anim){
console.log("has anim",anim)
anim.on(Animation.EventType.FINISHED, this.onAnimationFinished, this);
}
var spine = this.node.getChildByName('anm').getComponent('sp.Skeleton') as sp.Skeleton;
if(spine){
console.log("has spine",spine)
spine.setCompleteListener((trackEntry) => {
this.onAnimationFinished()
console.log("[track %s][animation %s] complete: %s", trackEntry.trackIndex);
});
}
}
onAnimationFinished(){
this.collider.group = this.base.box_group
this.node.active=false
this.node.active=true
this.base.is_destroy = true
}
}

View File

@@ -2,7 +2,7 @@
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "9df173c3-eed0-4d48-9c27-e2ead9a9f68f",
"uuid": "455553b9-ad23-42a0-89d8-4d2906931212",
"files": [],
"subMetas": {},
"userData": {}

View File

@@ -1,13 +1,23 @@
import { _decorator, Animation, Component, Node } from 'cc';
import { _decorator, Animation, Component, Node, sp } from 'cc';
import { SkillCom } from './SkillCom';
const { ccclass, property } = _decorator;
@ccclass('EndAnmCom')
export class EndAnmCom extends Component {
start() {
start() {
let anim = this.node.getComponent(Animation);
console.log("动画",anim)
anim.on(Animation.EventType.FINISHED, this.onAnimationFinished, this);
if(anim){
console.log("has anim",anim)
anim.on(Animation.EventType.FINISHED, this.onAnimationFinished, this);
}
var spine = this.node.getChildByName('anm').getComponent('sp.Skeleton') as sp.Skeleton;
if(spine){
console.log("has spine",spine)
spine.setCompleteListener((trackEntry) => {
this.onAnimationFinished()
console.log("[track %s][animation %s] complete: %s", trackEntry.trackIndex);
});
}
}
onAnimationFinished(){
console.log("动画播放完毕")

View File

@@ -0,0 +1,27 @@
import { _decorator, Collider2D, Component, Node } from 'cc';
import { SkillCom } from './SkillCom';
import { smc } from '../common/SingletonModuleComp';
const { ccclass, property } = _decorator;
@ccclass('EndTimeBoomCom')
export class EndTimeBoomCom extends Component {
time:number = 0
base:SkillCom = null
collider:Collider2D = null
start() {
this.base =this.node.getComponent(SkillCom)
this.collider = this.getComponent(Collider2D);
this.collider.enabled = false
}
update(deltaTime: number) {
if(smc.mission.pause) return
this.time+=deltaTime
if(this.time>=this.base.in_time){
this.collider.enabled = true
this.base.is_destroy = true
}
}
}

View File

@@ -2,7 +2,7 @@
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "47be4e93-d36a-4a9c-aa51-ea6616fac6d1",
"uuid": "bb7d4fe7-a905-4a54-ba85-e1025511bcd2",
"files": [],
"subMetas": {},
"userData": {}

View File

@@ -13,7 +13,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)
this.node.setPosition(this.node.position.x+this.base.speed*deltaTime*this.base.scale,this.node.position.y,this.node.position.z)
}
}

View File

@@ -1,30 +0,0 @@
import { _decorator, Component, Node } from 'cc';
import { SkillCom } from './SkillCom';
import { smc } from '../common/SingletonModuleComp';
const { ccclass, property } = _decorator;
@ccclass('LineMCom')
export class LineMCom extends Component {
base:SkillCom = null
time:number = 0
cd:number = 0
start() {
this.base =this.node.getComponent(SkillCom)
}
update(deltaTime: number) {
if(smc.mission.pause) return
this.cd+=deltaTime
if(this.cd >= this.base.cd){
// this.node.setPosition(v3(-1000,0,0))
this.node.active = false
this.node.active = true
this.cd=0
}
this.node.setPosition(this.node.position.x+this.base.speed*deltaTime,this.node.position.y,this.node.position.z)
}
}

View File

@@ -32,8 +32,11 @@ export class Skill extends ecs.Entity {
if(!SkillSet[uuid].with){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);
if(group==BoxSet.MONSTER) {
sv.scale=-1
node.setScale(v3(sv.scale*node.scale.x,node.scale.y));
}
// let angle=0
// if(SkillSet[uuid].angle){
// angle = Math.atan2(t_pos.y,t_pos.x) * 180 / Math.PI;

View File

@@ -15,18 +15,7 @@ export class TgCom extends Component {
}
update(deltaTime: number) {
if(smc.mission.pause) return
this.cd+=deltaTime
if(this.cd>=this.base.cd){
// this.node.setPosition(v3(-1000,0,0))
this.node.active = false
this.node.active = true
this.cd=0
}
this.time+=deltaTime
if(this.time>=this.base.in_time){
this.base.is_destroy = true
}
}
}

View File

@@ -1,30 +0,0 @@
import { _decorator, Component, Node, sp ,Animation, AnimationState, animation, AnimationClip} from 'cc';
import { Timer } from '../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer';
const { ccclass, property ,} = _decorator;
@ccclass('anonce')
export class anonce extends Component {
timer:Timer=new Timer(0.5);
anm_clip: AnimationClip = null!;
start() {
}
protected onLoad(): void {
this.anm_clip = this.node.getChildByName("skill").getComponent(Animation).clips[0];
}
update(deltaTime: number) {
if(this.node.active){
if(!this.node.getChildByName("skill").getComponent(Animation).getState(this.anm_clip.name).isPlaying){
this.node.getChildByName("skill").getComponent(Animation).play();
}
if (this.timer.update(deltaTime)) {
this.node.active=false;
}
}
}
}