update 添加松鼠角色

This commit is contained in:
DESKTOP-5RP3AKU\Jisol
2023-10-30 02:34:11 +08:00
parent ca84f38096
commit bb4334c0ff
178 changed files with 6352 additions and 195 deletions

View File

@@ -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,
}

View File

@@ -1,12 +0,0 @@
export default class GAttackBullet {
//创建子弹
static create(){
}
}

View File

@@ -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();

View File

@@ -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": {}

View File

@@ -1,9 +0,0 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "8c684f5a-84b5-4ea1-92d3-c0b70461970c",
"files": [],
"subMetas": {},
"userData": {}
}