ddd
This commit is contained in:
35
assets/script/game/skills/BuffCom.ts
Normal file
35
assets/script/game/skills/BuffCom.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { _decorator, Component, Node, tween, Vec3 } from 'cc';
|
||||
import { SkillCom } from './SkillCom';
|
||||
import { HeroViewComp } from '../hero/HeroViewComp';
|
||||
import { smc } from '../common/SingletonModuleComp';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('BuffCom')
|
||||
export class BuffCom extends Component {
|
||||
cd:number = 0;
|
||||
base:SkillCom = null
|
||||
start() {
|
||||
this.base =this.node.getComponent(SkillCom)
|
||||
tween(this.node).to( this.base.in_time,
|
||||
{ position: new Vec3(this.node.position.x,this.node.position.y) },
|
||||
{
|
||||
onComplete: (target?: object) => {
|
||||
this.base.is_destroy=true
|
||||
},
|
||||
}
|
||||
).start();
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
9
assets/script/game/skills/BuffCom.ts.meta
Normal file
9
assets/script/game/skills/BuffCom.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "38c6979b-18f3-46b3-9834-c1c9a3347a91",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -46,6 +46,7 @@ export class Skill extends ecs.Entity {
|
||||
sv.s_name = SkillSet[uuid].name;
|
||||
sv.ap = ap*SkillSet[uuid].ap;
|
||||
sv.cd = SkillSet[uuid].cd;
|
||||
sv.tg = SkillSet[uuid].tg;
|
||||
sv.debtime = SkillSet[uuid].debtime;
|
||||
sv.debuff = SkillSet[uuid].debuff;
|
||||
sv.depb = SkillSet[uuid].depb;
|
||||
|
||||
@@ -7,6 +7,7 @@ import { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/
|
||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { SkillSet } from "../common/config/SkillSet";
|
||||
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
@@ -34,6 +35,7 @@ export class SkillCom extends CCComp {
|
||||
box_group:number = 0;
|
||||
box_tag:number=0;
|
||||
type:number = 1;
|
||||
tg:number = 3;
|
||||
in_time:number = 0.3; // 不动技能持续时间
|
||||
enemys:any = [];
|
||||
start() {
|
||||
@@ -46,19 +48,19 @@ export class SkillCom extends CCComp {
|
||||
if (collider) {
|
||||
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
|
||||
// collider.on(Contact2DType.END_CONTACT, this.onEndContact, this);
|
||||
collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);
|
||||
// collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);
|
||||
}
|
||||
|
||||
}
|
||||
onBeginContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||
if(otherCollider.group != selfCollider.group&&otherCollider.tag ==0){
|
||||
onBeginContact (seCol: Collider2D, otCol: Collider2D, contact: IPhysics2DContact | null) {
|
||||
if(otCol.group != seCol.group&&otCol.tag ==0){
|
||||
this.atk_count+=1
|
||||
// console.log("skill onBeginContact",otherCollider.node.getComponent(HeroViewComp).uuid)
|
||||
// let uid=otherCollider.node.getComponent(HeroViewComp).uuid
|
||||
// console.log("skill onBeginContact",otCol.node.getComponent(HeroViewComp).uuid)
|
||||
// let uid=otCol.node.getComponent(HeroViewComp).uuid
|
||||
// const count = this.enemys.filter(enemy => enemy.uid === uid).length;
|
||||
// if(count==0){
|
||||
// // otherCollider.node.getComponent(HeroViewComp).check_uatk(this)
|
||||
// console.log("count==0",otherCollider.node.getComponent(HeroViewComp).uuid)
|
||||
// // otCol.node.getComponent(HeroViewComp).check_uatk(this)
|
||||
// console.log("count==0",otCol.node.getComponent(HeroViewComp).uuid)
|
||||
// this.enemys.push(uid)
|
||||
// }
|
||||
|
||||
@@ -66,13 +68,35 @@ export class SkillCom extends CCComp {
|
||||
if(this.type==1 ){
|
||||
this.is_destroy=true
|
||||
}
|
||||
// console.log("skill onBeginContact",selfCollider.group,otherCollider.group)
|
||||
// console.log("skill onBeginContact",seCol.group,otCol.group)
|
||||
// if(this.type==1 ){
|
||||
// this.is_destroy=true
|
||||
// }
|
||||
}
|
||||
if(otCol.group == seCol.group&&otCol.tag ==0&&this.tg==2){
|
||||
this.to_console("skill onBeginContact 是对自己人的buff",seCol,otCol)
|
||||
this.do_buff(otCol.node.getComponent(HeroViewComp))
|
||||
}
|
||||
}
|
||||
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||
to_console(value:any,value2:any=null,value3:any=null){
|
||||
console.log("["+this.s_name+this.s_uuid+"]:",value,value2,value3)
|
||||
}
|
||||
|
||||
do_buff(hero:any){
|
||||
this.to_console(" do_buff hero: ",hero)
|
||||
if(SkillSet[this.s_uuid].hp > 0){ //buff加血
|
||||
let increase_hp=Math.floor(SkillSet[this.s_uuid].hp*this.ap/(this.in_time/this.cd))
|
||||
hero.add_hp(increase_hp)
|
||||
}
|
||||
|
||||
if(SkillSet[this.s_uuid].apup > 0){ //buff加攻击
|
||||
let increase_atk=Math.floor(SkillSet[this.s_uuid].apup*this.ap/(this.in_time/this.cd))
|
||||
hero.add_ap(increase_atk)
|
||||
}
|
||||
|
||||
if(SkillSet[this.s_uuid].shield > 0){ //buff护盾
|
||||
hero.add_shield(SkillSet[this.s_uuid].shield/(this.in_time/this.cd))
|
||||
}
|
||||
|
||||
}
|
||||
update(deltaTime: number) {
|
||||
|
||||
14
assets/script/game/skills/TgLineCom.ts
Normal file
14
assets/script/game/skills/TgLineCom.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('TgLineCom')
|
||||
export class TgLineCom extends Component {
|
||||
start() {
|
||||
|
||||
}
|
||||
|
||||
update(deltaTime: number) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
9
assets/script/game/skills/TgLineCom.ts.meta
Normal file
9
assets/script/game/skills/TgLineCom.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "b7a2bf85-f71f-4c4c-bda0-e13e8730dd43",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
21
assets/script/game/skills/seCom.ts
Normal file
21
assets/script/game/skills/seCom.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import { SkillCom } from './SkillCom';
|
||||
import { SkillSet } from '../common/config/SkillSet';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('seCom')
|
||||
export class seCom extends Component {
|
||||
base:SkillCom = null
|
||||
|
||||
start() {
|
||||
this.base =this.node.getComponent(SkillCom)
|
||||
}
|
||||
|
||||
update(deltaTime: number) {
|
||||
if (this.base.is_destroy) {
|
||||
console.log("执行第二技能",SkillSet[this.base.s_uuid].sonsk)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
9
assets/script/game/skills/seCom.ts.meta
Normal file
9
assets/script/game/skills/seCom.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "f5c0a714-f53b-40e4-9046-39b30f3997b7",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
Reference in New Issue
Block a user