mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
update 添加松鼠角色
This commit is contained in:
@@ -2,7 +2,7 @@ import { Node } from "cc";
|
||||
import { TableGRoleAttack } from "../../../../resources/config/ts/TableGRoleAttack";
|
||||
import GRoleBase from "../role/GRoleBase";
|
||||
import GAttackNormal from "./GAttackNormal";
|
||||
import GAttackParabolicRemote from "./GAttackParabolicRemote";
|
||||
import GAttackParabolicBangRemote from "./GAttackParabolicBangRemote";
|
||||
import { UITransform } from "cc";
|
||||
import GButtleBase from "../bullet/GButtleBase";
|
||||
|
||||
@@ -21,13 +21,13 @@ export class GAttackBullet{
|
||||
}
|
||||
|
||||
//攻击方式基类
|
||||
export class GAttackBase{
|
||||
attack(role:GRoleBase<{}>,info:TableGRoleAttack){};
|
||||
export interface GAttackBase{
|
||||
attack(role:GRoleBase<{}>,info:TableGRoleAttack);
|
||||
}
|
||||
|
||||
//攻击方式
|
||||
export const GAttack:{[key:string]:(new () => GAttackBase)} = {
|
||||
["Normal"]:GAttackNormal,
|
||||
["ParabolicRemote"]:GAttackParabolicRemote,
|
||||
["ParabolicBangRemote"]:GAttackParabolicBangRemote,
|
||||
}
|
||||
|
||||
|
@@ -1,12 +0,0 @@
|
||||
|
||||
|
||||
export default class GAttackBullet {
|
||||
|
||||
//创建子弹
|
||||
static create(){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -8,20 +8,40 @@ import { v3 } from "cc";
|
||||
import { bezier } from "cc";
|
||||
import { v2 } from "cc";
|
||||
import { Vec2 } from "cc";
|
||||
import { sp } from "cc";
|
||||
import GEffectUtil from "../../effect/GEffectUtil";
|
||||
import { TableGRoleAttackEffect } from "../../../../resources/config/ts/TableGRoleAttackEffect";
|
||||
import GDetection from "../common/GDetection";
|
||||
import { rect } from "cc";
|
||||
import { UITransform } from "cc";
|
||||
import { BoxCollider2D } from "cc";
|
||||
/**
|
||||
* 抛物线普攻
|
||||
* 攻击子弹,子弹大小,龙骨-初始位置
|
||||
* 抛物线 爆炸普攻
|
||||
* 攻击子弹,爆炸特效,龙骨-初始位置,子弹大小
|
||||
*/
|
||||
export default class GAttackParabolicRemote implements GAttackBase{
|
||||
|
||||
attack(role: GRoleBase<{}>, info: TableGRoleAttack): void {
|
||||
|
||||
let enemy = role.fsm.enemy;
|
||||
if(!enemy) return;
|
||||
|
||||
//[子弹图片]
|
||||
let image:SpriteFrame = app.role.bullets[info.attackArgs[0]];
|
||||
let scale:number = info.attackArgs[1] as unknown as number;
|
||||
let bang = {
|
||||
ske: app.role.effects[info.attackArgs[1]],
|
||||
info: TableGRoleAttackEffect.getConfig(info.attackArgs[1])
|
||||
};
|
||||
let bone = role.spine.findBone(info.attackArgs[2]);
|
||||
let scale:number = parseFloat(info.attackArgs[3]);
|
||||
let aw = parseFloat(info.attackArgs[4]);
|
||||
let ah = parseFloat(info.attackArgs[5]);
|
||||
|
||||
if(!image || !bone || !scale || !bang|| !aw|| !ah) {
|
||||
console.warn("GAttackParabolicRemote ERROR",image,bone,scale,bang);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(role.spine,bone);
|
||||
let bullet = GAttackBullet.create(GButtleDefault,{
|
||||
image:image,
|
||||
@@ -48,8 +68,21 @@ export default class GAttackParabolicRemote implements GAttackBase{
|
||||
))
|
||||
})
|
||||
.onComplete(() => {
|
||||
enemy.onHit();
|
||||
bullet.node.removeFromParent();
|
||||
|
||||
//生成爆炸特效
|
||||
let effect = GEffectUtil.create(bang.ske);
|
||||
role.mode.addGNode(effect.node,bullet.node.worldPosition);
|
||||
//获取默认动画
|
||||
effect.setAnimation(0,bang.info.animation,false);
|
||||
//销毁
|
||||
bullet.node.destroy();
|
||||
|
||||
// enemy.getComponent(BoxCollider2D).apply();
|
||||
|
||||
// console.log(enemy.v2World,enemy.getComponent(BoxCollider2D).worldPoints,enemy.getComponent(UITransform).getBoundingBoxToWorld());
|
||||
GDetection.testAABBRole(rect(effect.node.worldPosition.x,effect.node.worldPosition.y,aw,ah)).forEach(role =>{
|
||||
role.onHit();
|
||||
});
|
||||
})
|
||||
.start();
|
||||
|
@@ -2,7 +2,7 @@
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "13b542e0-5fa9-4b1d-bfef-8196b3b3ffd6",
|
||||
"uuid": "f4c29cde-2ca3-452d-ad3e-3d6376f2bd6c",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "8c684f5a-84b5-4ea1-92d3-c0b70461970c",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
Reference in New Issue
Block a user