mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
重构战斗资源加载 , 新添加宠物
This commit is contained in:
@@ -13,6 +13,7 @@ import { rect } from "cc";
|
||||
import GRoleDefault from "../role/GRoleDefault";
|
||||
import { TB } from "../../../../resources/config/data/schema";
|
||||
import GRoleAttack from "../common/GRoleAttack";
|
||||
import { sp } from "cc";
|
||||
|
||||
/**
|
||||
* 抛物线 爆炸普攻
|
||||
@@ -25,10 +26,9 @@ export default class GAttackParabolicRemote implements GAttackBase{
|
||||
let enemy = role.fsm.enemy;
|
||||
if(!enemy) return;
|
||||
|
||||
let image:SpriteFrame = app.battleRes.roleResImage[info.attackArgs[0]];
|
||||
let image:SpriteFrame = app.battleRes.getData<SpriteFrame>(info.attackArgs[0]);
|
||||
let bang = {
|
||||
ske: app.battleRes.roleResSpine[info.attackArgs[1]],
|
||||
info: TD.TbGRoleBattleRes.get(parseInt(info.attackArgs[1]))
|
||||
ske: app.battleRes.getData<sp.SkeletonData>(info.attackArgs[1]),
|
||||
};
|
||||
let bone = role.spine.findBone(info.attackArgs[2]);
|
||||
let scale:number = parseFloat(info.attackArgs[3]);
|
||||
@@ -40,7 +40,6 @@ export default class GAttackParabolicRemote implements GAttackBase{
|
||||
return;
|
||||
}
|
||||
|
||||
// console.log(`播放动画[GAttackParabolicRemote]`,role.nId,enemy.nId)
|
||||
|
||||
console.log(role.spine,bone);
|
||||
let bullet = GAttackBullet.create(GButtleDefault,{
|
||||
|
@@ -99,8 +99,8 @@ export default abstract class GRoleBase<T> extends GObject<T>{
|
||||
|
||||
//初始化
|
||||
protected init(role:TB.TbGRole){
|
||||
console.log("初始化宠物",!!this.spine,!!(app.battleRes.roleSpine[role.id]));
|
||||
this.spine.skeletonData = app.battleRes.roleSpine[role.id];
|
||||
console.log("初始化宠物",!!this.spine,!!(app.battleRes.getRoleSpine(role.id)));
|
||||
this.spine.skeletonData = app.battleRes.getRoleSpine(role.id);
|
||||
}
|
||||
|
||||
//创建一个状态机
|
||||
|
@@ -25,9 +25,9 @@ export default class GDefaultMode<T,DT> extends GBaseMode<T,DT>{
|
||||
this.mapInfo = TD.TbGMap.get(mapId);
|
||||
|
||||
let scale = this.mapInfo.scale;
|
||||
this.map1.init(app.battleRes.maps[mapId][0],1,app.battleRes.maps[mapId][0].width * scale,app.battleRes.maps[mapId][0].height * scale);
|
||||
this.map2.init(app.battleRes.maps[mapId][1],1,app.battleRes.maps[mapId][1].width * scale,app.battleRes.maps[mapId][1].height * scale);
|
||||
this.map3.init(app.battleRes.maps[mapId][2],1,app.battleRes.maps[mapId][1].width * scale,1048 * scale);
|
||||
this.map1.init(app.battleRes.getMap(mapId)[0],1,app.battleRes.getMap(mapId)[0].width * scale,app.battleRes.getMap(mapId)[0].height * scale);
|
||||
this.map2.init(app.battleRes.getMap(mapId)[1],1,app.battleRes.getMap(mapId)[1].width * scale,app.battleRes.getMap(mapId)[1].height * scale);
|
||||
this.map3.init(app.battleRes.getMap(mapId)[2],1,app.battleRes.getMap(mapId)[1].width * scale,1048 * scale);
|
||||
|
||||
//更新地图
|
||||
this.onUpdateMap(0);
|
||||
|
@@ -10,6 +10,7 @@ import { rect } from "cc";
|
||||
import GRoleDefault from "../../../base/role/GRoleDefault";
|
||||
import { TB } from "../../../../../resources/config/data/schema";
|
||||
import GRoleAttack from "../../../base/common/GRoleAttack";
|
||||
import { sp } from "cc";
|
||||
|
||||
/**
|
||||
* 疯狂松鼠技能
|
||||
@@ -40,14 +41,14 @@ export default class GSkillCrazySquirrel extends GSkillCDBase{
|
||||
let ah = parseInt(this.info.skillArgs[2]);
|
||||
|
||||
//出现松鼠丢炸弹
|
||||
GSpine.onPlayAnotherSpine(this.role,app.battleRes.roleResSpine[30003],"skill",{
|
||||
GSpine.onPlayAnotherSpine(this.role,app.battleRes.getData(140003),"skill",{
|
||||
end:() => {
|
||||
//从天而降
|
||||
let pos = enemy.v2World.add(v2(0,1000));
|
||||
let end = enemy.v2World.clone();
|
||||
|
||||
//生成火球
|
||||
let spine = GSpine.onCreateSpine(app.battleRes.roleResSpine[30004]);
|
||||
let spine = GSpine.onCreateSpine(app.battleRes.getData(140004));
|
||||
this.role.mode.addGNode(spine.node,pos);
|
||||
spine.setAnimation(0,"animation",true);
|
||||
spine.node.angle = 90;
|
||||
@@ -59,7 +60,7 @@ export default class GSkillCrazySquirrel extends GSkillCDBase{
|
||||
.onComplete(() => {
|
||||
let world = spine.node.worldPosition;
|
||||
spine.node.destroy();
|
||||
GSpine.onPlaySceneSpine(scene,v2(world.x,world.y),app.battleRes.roleResSpine[30005],"animation");
|
||||
GSpine.onPlaySceneSpine(scene,v2(world.x,world.y),app.battleRes.getData<sp.SkeletonData>(140005),"animation");
|
||||
GDetection.testAABBCenterRole(rect(world.x,world.y,aw,ah)).forEach(enemy =>{
|
||||
GRoleAttack.onNormalAttack(this.role,enemy);
|
||||
});
|
||||
|
Reference in New Issue
Block a user