buff 改为固定时间消失,不再根据cd 保持

This commit is contained in:
2025-01-13 09:07:16 +08:00
parent 19780877ea
commit 82b68e4f87
2 changed files with 155 additions and 146 deletions

View File

@@ -428,7 +428,7 @@
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": -5.921,
"y": 10,
"z": 0
},
"_lrot": {
@@ -440,8 +440,8 @@
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 0.8,
"y": 0.8,
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
@@ -467,7 +467,7 @@
"__id__": 18
}
],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 40
@@ -481,8 +481,8 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -17.5,
"y": 17.5,
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
@@ -494,8 +494,8 @@
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 0.8,
"y": 0.8,
"x": 1.1,
"y": 1.1,
"z": 1
},
"_mobility": 0,
@@ -1028,8 +1028,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 35,
"height": 35
"width": 40,
"height": 40
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -1097,7 +1097,7 @@
"__id__": 46
}
],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 68
@@ -1111,8 +1111,8 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 17.5,
"y": 17.5,
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
@@ -1124,8 +1124,8 @@
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 0.7999999999999996,
"y": 0.7999999999999996,
"x": 1.1,
"y": 1.1,
"z": 1
},
"_mobility": 0,
@@ -1658,8 +1658,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 35,
"height": 35
"width": 40,
"height": 40
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -1727,7 +1727,7 @@
"__id__": 74
}
],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 96
@@ -1741,8 +1741,8 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -17.5,
"y": 49.5,
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
@@ -1754,8 +1754,8 @@
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 0.7999999999999996,
"y": 0.7999999999999996,
"x": 1.1,
"y": 1.1,
"z": 1
},
"_mobility": 0,
@@ -2288,8 +2288,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 35,
"height": 35
"width": 40,
"height": 40
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -2357,7 +2357,7 @@
"__id__": 102
}
],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 124
@@ -2371,8 +2371,8 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 17.5,
"y": 49.5,
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
@@ -2384,8 +2384,8 @@
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 0.7999999999999996,
"y": 0.7999999999999996,
"x": 1.1,
"y": 1.1,
"z": 1
},
"_mobility": 0,
@@ -2918,8 +2918,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 35,
"height": 35
"width": 40,
"height": 40
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -2987,7 +2987,7 @@
"__id__": 130
}
],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 152
@@ -3001,8 +3001,8 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -17.5,
"y": 81.5,
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
@@ -3014,8 +3014,8 @@
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 0.7999999999999996,
"y": 0.7999999999999996,
"x": 1.1,
"y": 1.1,
"z": 1
},
"_mobility": 0,
@@ -3548,8 +3548,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 35,
"height": 35
"width": 40,
"height": 40
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -3617,7 +3617,7 @@
"__id__": 158
}
],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 180
@@ -3631,8 +3631,8 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 17.5,
"y": 81.5,
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
@@ -3644,8 +3644,8 @@
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 0.7999999999999998,
"y": 0.7999999999999998,
"x": 1.1,
"y": 1.1,
"z": 1
},
"_mobility": 0,
@@ -4178,8 +4178,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 35,
"height": 35
"width": 40,
"height": 40
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -4247,7 +4247,7 @@
"__id__": 186
}
],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 208
@@ -4261,8 +4261,8 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -17.5,
"y": 113.5,
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
@@ -4274,8 +4274,8 @@
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 0.7999999999999998,
"y": 0.7999999999999998,
"x": 1.1,
"y": 1.1,
"z": 1
},
"_mobility": 0,
@@ -4808,8 +4808,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 35,
"height": 35
"width": 40,
"height": 40
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -4877,7 +4877,7 @@
"__id__": 214
}
],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 236
@@ -4891,8 +4891,8 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 17.5,
"y": 113.5,
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
@@ -4904,8 +4904,8 @@
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 0.7999999999999998,
"y": 0.7999999999999998,
"x": 1.1,
"y": 1.1,
"z": 1
},
"_mobility": 0,
@@ -5438,8 +5438,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 35,
"height": 35
"width": 40,
"height": 40
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -5507,7 +5507,7 @@
"__id__": 242
}
],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 264
@@ -5521,8 +5521,8 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -17.5,
"y": 145.5,
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
@@ -5534,8 +5534,8 @@
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 0.7999999999999998,
"y": 0.7999999999999998,
"x": 1.1,
"y": 1.1,
"z": 1
},
"_mobility": 0,
@@ -6068,8 +6068,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 35,
"height": 35
"width": 40,
"height": 40
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -6137,7 +6137,7 @@
"__id__": 270
}
],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 292
@@ -6151,8 +6151,8 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 17.5,
"y": 145.5,
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
@@ -6164,8 +6164,8 @@
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 0.7999999999999998,
"y": 0.7999999999999998,
"x": 1.1,
"y": 1.1,
"z": 1
},
"_mobility": 0,
@@ -6698,8 +6698,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 35,
"height": 35
"width": 40,
"height": 40
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -6768,13 +6768,13 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 70,
"height": 500
"width": 50,
"height": 50
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0
"y": 0.5
},
"_id": ""
},
@@ -6790,7 +6790,7 @@
"node": {
"__id__": 16
},
"_enabled": true,
"_enabled": false,
"__prefab": {
"__id__": 300
},

View File

@@ -1,4 +1,4 @@
import { _decorator, Component, instantiate, Label, Node, Prefab, ProgressBar, v3 } from 'cc';
import { _decorator, Component, instantiate, Label, Node, Prefab, ProgressBar, tween, v3, Vec3 } from 'cc';
import { HeroViewComp } from './HeroViewComp';
import { oops } from 'db://oops-framework/core/Oops';
import { ecs } from 'db://oops-framework/libs/ecs/ECS';
@@ -33,7 +33,7 @@ export class BuffComp extends Component {
start() {
this.heroView = this.node.getComponent(HeroViewComp);
this.in_fired(10,0)
this.show_ap(10)
// this.node.getChildByName("top").getChildByName("buff").getChildByName("ap").active = false;
// this.node.getChildByName("top").getChildByName("buff").getChildByName("cd").active = false;
// this.node.getChildByName("top").getChildByName("buff").getChildByName("def").active = false;
@@ -43,66 +43,6 @@ export class BuffComp extends Component {
update(deltaTime: number) {
if(smc.mission.pause) return
if(this.ap_cd > 0 ) this.ap_cd -= deltaTime;
if(this.ap_cd <= 0 && this.node.getChildByName("top").getChildByName("buff").getChildByName("ap").active){
this.node.getChildByName("top").getChildByName("buff").getChildByName("ap").active = false;
}
if(this.cd_cd > 0 ) this.cd_cd -= deltaTime;
if(this.cd_cd <= 0 && this.node.getChildByName("top").getChildByName("buff").getChildByName("cd").active) {
this.node.getChildByName("top").getChildByName("buff").getChildByName("cd").active = false;
}
if(this.def_cd > 0 ) this.def_cd -= deltaTime;
if(this.def_cd <= 0 && this.node.getChildByName("top").getChildByName("buff").getChildByName("def").active){
this.node.getChildByName("top").getChildByName("buff").getChildByName("def").active = false;
}
if(this.hp_cd > 0 ) this.hp_cd -= deltaTime;
if(this.hp_cd <= 0 && this.node.getChildByName("top").getChildByName("buff").getChildByName("hp").active){
this.node.getChildByName("top").getChildByName("buff").getChildByName("hp").active = false;
}
if(this.crit_cd > 0 ) this.crit_cd -= deltaTime;
if(this.crit_cd <= 0 && this.node.getChildByName("top").getChildByName("buff").getChildByName("crit").active){
this.node.getChildByName("top").getChildByName("buff").getChildByName("crit").active = false;
}
if(this.deap_cd > 0 ) this.deap_cd -= deltaTime;
if(this.deap_cd <= 0 && this.node.getChildByName("top").getChildByName("buff").getChildByName("deap").active){
this.node.getChildByName("top").getChildByName("buff").getChildByName("deap").active = false;
}
if(this.decd_cd > 0 ) this.decd_cd -= deltaTime;
if(this.decd_cd <= 0 && this.node.getChildByName("top").getChildByName("buff").getChildByName("decd").active) {
this.node.getChildByName("top").getChildByName("buff").getChildByName("decd").active = false;
}
if(this.dedef_cd > 0 ) this.dedef_cd -= deltaTime;
if(this.dedef_cd <= 0 && this.node.getChildByName("top").getChildByName("buff").getChildByName("dedef").active){
this.node.getChildByName("top").getChildByName("buff").getChildByName("dedef").active = false;
}
if(this.dehp_cd > 0 ) this.dehp_cd -= deltaTime;
if(this.dehp_cd <= 0 && this.node.getChildByName("top").getChildByName("buff").getChildByName("dehp").active){
this.node.getChildByName("top").getChildByName("buff").getChildByName("dehp").active = false;
}
if(this.decrit_cd > 0 ) this.decrit_cd -= deltaTime;
if(this.decrit_cd <= 0 && this.node.getChildByName("top").getChildByName("buff").getChildByName("decrit").active){
this.node.getChildByName("top").getChildByName("buff").getChildByName("decrit").active = false;
}
if(this.wind_cd > 0 ) this.wind_cd -= deltaTime;
if(this.wind_cd <= 0 && this.node.getChildByName("wind").active){
@@ -127,44 +67,113 @@ export class BuffComp extends Component {
show_ap(t:number=2){
this.ap_cd = t;
this.node.getChildByName("top").getChildByName("buff").getChildByName("ap").active = true;
console.log("show_ap",this.node.getChildByName("top").getChildByName("buff").getChildByName("ap"))
let node = this.node.getChildByName("top").getChildByName("buff").getChildByName("ap")
this.scheduleOnce(()=>{
tween(node).to( 0.1,
{ position: new Vec3(node.position.x,node.position.y+50) },
{ onComplete:()=>{ node.position=v3(0,0);node.active = false; }, }
).start();
}, 1);
}
show_cd(t:number=2){
this.cd_cd = t;
this.node.getChildByName("top").getChildByName("buff").getChildByName("cd").active = true;
let node = this.node.getChildByName("top").getChildByName("buff").getChildByName("cd")
this.scheduleOnce(()=>{
tween(node).to( 0.1,
{ position: new Vec3(node.position.x,node.position.y+50) },
{ onComplete:()=>{ node.position=v3(0,0);node.active = false; }, }
).start();
}, 1);
}
show_def(t:number=2){
this.def_cd = t;
this.node.getChildByName("top").getChildByName("buff").getChildByName("def").active = true;
let node = this.node.getChildByName("top").getChildByName("buff").getChildByName("def")
this.scheduleOnce(()=>{
tween(node).to( 0.1,
{ position: new Vec3(node.position.x,node.position.y+50) },
{ onComplete:()=>{ node.position=v3(0,0);node.active = false; }, }
).start();
}, 1);
}
show_hp(t:number=2){
this.hp_cd = t;
this.node.getChildByName("top").getChildByName("buff").getChildByName("hp").active = true;
let node = this.node.getChildByName("top").getChildByName("buff").getChildByName("hp")
this.scheduleOnce(()=>{
tween(node).to( 0.1,
{ position: new Vec3(node.position.x,node.position.y+50) },
{ onComplete:()=>{ node.position=v3(0,0);node.active = false; }, }
).start();
}, 1);
}
show_crit(t:number=2){
this.crit_cd = t;
this.node.getChildByName("top").getChildByName("buff").getChildByName("crit").active = true;
let node = this.node.getChildByName("top").getChildByName("buff").getChildByName("crit")
this.scheduleOnce(()=>{
tween(node).to( 0.1,
{ position: new Vec3(node.position.x,node.position.y+50) },
{ onComplete:()=>{ node.position=v3(0,0);node.active = false; }, }
).start();
}, 1);
}
show_debuff_ap(t:number=2){
this.deap_cd = t;
this.node.getChildByName("top").getChildByName("buff").getChildByName("ap").active = true;
console.log("show_ap",this.node.getChildByName("top").getChildByName("buff").getChildByName("ap"))
this.node.getChildByName("top").getChildByName("buff").getChildByName("deap").active = true;
let node = this.node.getChildByName("top").getChildByName("buff").getChildByName("deap")
this.scheduleOnce(()=>{
tween(node).to( 0.1,
{ position: new Vec3(node.position.x,node.position.y+50) },
{ onComplete:()=>{ node.position=v3(0,0);node.active = false; }, }
).start();
}, 1);
}
show_debuff_cd(t:number=2){
this.decd_cd = t;
this.node.getChildByName("top").getChildByName("buff").getChildByName("cd").active = true;
this.node.getChildByName("top").getChildByName("buff").getChildByName("decd").active = true;
let node = this.node.getChildByName("top").getChildByName("buff").getChildByName("decd")
this.scheduleOnce(()=>{
tween(node).to( 0.1,
{ position: new Vec3(node.position.x,node.position.y+50) },
{ onComplete:()=>{ node.position=v3(0,0);node.active = false; }, }
).start();
}, 1);
}
show_debuff_def(t:number=2){
this.dedef_cd = t;
this.node.getChildByName("top").getChildByName("buff").getChildByName("def").active = true;
this.node.getChildByName("top").getChildByName("buff").getChildByName("dedef").active = true;
let node = this.node.getChildByName("top").getChildByName("buff").getChildByName("dedef")
this.scheduleOnce(()=>{
tween(node).to( 0.1,
{ position: new Vec3(node.position.x,node.position.y+50) },
{ onComplete:()=>{ node.position=v3(0,0);node.active = false; }, }
).start();
}, 1);
}
show_debuff_hp(t:number=2){
this.dehp_cd = t;
this.node.getChildByName("top").getChildByName("buff").getChildByName("hp").active = true;
this.node.getChildByName("top").getChildByName("buff").getChildByName("dehp").active = true;
let node = this.node.getChildByName("top").getChildByName("buff").getChildByName("dehp")
this.scheduleOnce(()=>{
tween(node).to( 0.1,
{ position: new Vec3(node.position.x,node.position.y+50) },
{ onComplete:()=>{ node.position=v3(0,0);node.active = false; }, }
).start();
}, 1);
}
show_debuff_crit(t:number=2){
this.decrit_cd = t;
this.node.getChildByName("top").getChildByName("buff").getChildByName("crit").active = true;
this.node.getChildByName("top").getChildByName("buff").getChildByName("decrit").active = true;
let node = this.node.getChildByName("top").getChildByName("buff").getChildByName("decrit")
this.scheduleOnce(()=>{
tween(node).to( 0.1,
{ position: new Vec3(node.position.x,node.position.y+50) },
{ onComplete:()=>{ node.position=v3(0,0);node.active = false; }, }
).start();
}, 1);
}