mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交地图
This commit is contained in:
@@ -81,7 +81,8 @@ export default class GRoleDefault extends GRoleBase<{}>{
|
||||
//监听攻击
|
||||
this.fsmAnim.addEventListener(GRoleAnimEvent.Attack,this.onAttack.bind(this));
|
||||
//监听死亡击飞
|
||||
this.fsmAnim.addStartListener(GPetAminEnum.Fly,this.onFly.bind(this));
|
||||
// this.fsmAnim.addStartListener(GPetAminEnum.Fly,this.onFly.bind(this));
|
||||
this.killBack.push(this.onFly.bind(this));
|
||||
}
|
||||
|
||||
//初始化
|
||||
@@ -106,7 +107,10 @@ export default class GRoleDefault extends GRoleBase<{}>{
|
||||
//设置血条位置
|
||||
if(this.spine){
|
||||
let runtimeData = this.spine.skeletonData.getRuntimeData();
|
||||
let headY = (runtimeData.height + runtimeData.y + 20) * this.spine.node.scale.x;
|
||||
let height = Math.abs(runtimeData.height);
|
||||
let y = Math.abs(runtimeData.y);
|
||||
let x = Math.abs(this.spine.node.scale.x);
|
||||
let headY = (height + y + 20) * x;
|
||||
this.headInfo.setPosition(v3(this.headInfo.position.x,headY,this.headInfo.position.z))
|
||||
}
|
||||
|
||||
@@ -155,7 +159,7 @@ export default class GRoleDefault extends GRoleBase<{}>{
|
||||
this.JTween(vWorld)
|
||||
.to({x:vEndWorld.x},1200)
|
||||
.onUpdate(pos => {
|
||||
if(this.node.isValid)
|
||||
if(this.node && this.node.isValid)
|
||||
this.node.worldPosition = pos;
|
||||
})
|
||||
.start();
|
||||
@@ -163,7 +167,7 @@ export default class GRoleDefault extends GRoleBase<{}>{
|
||||
.to({y:vEndWorld.y},1200)
|
||||
.easing(JEasing.Circular.Out)
|
||||
.onUpdate(pos => {
|
||||
if(this.node.isValid)
|
||||
if(this.node && this.node.isValid)
|
||||
this.node.worldPosition = vWorld
|
||||
})
|
||||
.start();
|
||||
|
@@ -7,7 +7,7 @@ import GBaseMode from "../GBaseMode";
|
||||
import { Prefab } from "cc";
|
||||
import { instantiate } from "cc";
|
||||
import GRoleCGCrystal from "../base/role/CampGuardian/GRoleCGCrystal";
|
||||
import { TD } from "../../App";
|
||||
import { TD, app } from "../../App";
|
||||
import { GTowards } from "../base/GObject";
|
||||
import GRoleBase from "../base/role/GRoleBase";
|
||||
import { GTactical } from "../entity/GTactical";
|
||||
@@ -16,6 +16,8 @@ import { TbGPetId } from "../../config/TbGPet";
|
||||
import GModeTools from "./GModeTools";
|
||||
import GPetAttribute from "../base/values/attribute/role/GPetAttribute";
|
||||
import RandomUtil from "../../../../extensions/ngame/assets/ngame/util/RandomUtil";
|
||||
import { GModeEvent } from "./GMode";
|
||||
import { Camera } from "cc";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
//阵营守护 角色
|
||||
@@ -51,6 +53,10 @@ export default class GCampGuardianMode extends GBaseMode<{},{}>{
|
||||
//敌方宠物
|
||||
enemyRoles: GRoleBase<{}>[] = [];
|
||||
|
||||
//模式相机
|
||||
@property(Camera)
|
||||
modeCamera:Camera;
|
||||
|
||||
onSyncInitSuccess(){
|
||||
|
||||
//生成水晶
|
||||
@@ -127,8 +133,8 @@ export default class GCampGuardianMode extends GBaseMode<{},{}>{
|
||||
petStar:0,
|
||||
petStarExp:0,
|
||||
}));
|
||||
// //绑定受击回调
|
||||
// entity.addHitCallback(this.onHitBack.bind(this));
|
||||
//绑定受击回调
|
||||
entity.addHitCallback(this.onHitBack.bind(this));
|
||||
|
||||
this.addGObject(entity,pos);
|
||||
this.getOnesRole(type).push(entity);
|
||||
@@ -158,6 +164,22 @@ export default class GCampGuardianMode extends GBaseMode<{},{}>{
|
||||
},3000)
|
||||
|
||||
}
|
||||
|
||||
//角色受击回调
|
||||
onHitBack(role:GRoleDefault,hit:number){
|
||||
|
||||
if(!role.get()) return;
|
||||
|
||||
//添加受击显示
|
||||
app.event.emit(GModeEvent.HIT,{
|
||||
mode:this,
|
||||
role:role,
|
||||
hit:hit,
|
||||
world:role.v2World,
|
||||
camera:this.modeCamera,
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
17
JisolGameCocos/assets/script/battle/modes/GMode.ts
Normal file
17
JisolGameCocos/assets/script/battle/modes/GMode.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { Vec2 } from "cc";
|
||||
import GBaseMode from "../GBaseMode";
|
||||
import GRoleBase from "../base/role/GRoleBase";
|
||||
import { Camera } from "cc";
|
||||
|
||||
export interface GModeHitInfo{
|
||||
mode:GBaseMode<{},{}>, //模式
|
||||
role:GRoleBase<{}>, //宠物
|
||||
hit:number, //受击
|
||||
world:Vec2, //世界坐标
|
||||
camera:Camera, //相机
|
||||
}
|
||||
|
||||
export enum GModeEvent{
|
||||
//受击通知
|
||||
HIT = "ModeRenderEvent_HIT"
|
||||
}
|
9
JisolGameCocos/assets/script/battle/modes/GMode.ts.meta
Normal file
9
JisolGameCocos/assets/script/battle/modes/GMode.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "b9fffb62-4b14-48cb-85fe-51ab780f49c0",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -15,7 +15,7 @@ import { TD, app } from "../../App";
|
||||
import { v3 } from "cc";
|
||||
import { v2 } from "cc";
|
||||
import GFSMOnHookMode from "./OnHook/GFSMOnHookMode";
|
||||
import { TB } from "../../config/data/schema";
|
||||
import { TB, TbGEntity } from "../../config/data/schema";
|
||||
import PlayerTacticalData, { PlayerTacticalEvent } from "../../data/PlayerTacticalData";
|
||||
import GRoleOnHookPlayerExpand from "../base/role/expand/OnHook/GRoleOnHookPlayerExpand";
|
||||
import PlayerPetData from "../../data/PlayerPetData";
|
||||
@@ -23,10 +23,10 @@ import { GUI } from "../../ui/UIConfig";
|
||||
import { GOnHookPet, GOnHookPets } from "../../../../extensions/ngame/assets/ngame/message/proto";
|
||||
import GOnHookManager, { GOnHookManagerEvent } from "../../manager/battle/mode/GOnHookManager";
|
||||
import GRoleOnHookCreepsExpand from "../base/role/expand/OnHook/GRoleOnHookCreepsExpand";
|
||||
import { ModeRenderEvent } from "../../ui/Consts/Game/ModeRender";
|
||||
import GPetAttribute from "../base/values/attribute/role/GPetAttribute";
|
||||
import GDefaultMode from "./default/GDefaultMode";
|
||||
import GOnHookData from "../../data/GOnHookData";
|
||||
import { GModeEvent, GModeHitInfo } from "./GMode";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
//挂机模式状态
|
||||
@@ -262,7 +262,7 @@ export default class GOnHookMode extends GDefaultMode<{},{}>{
|
||||
petId:0,
|
||||
petPlayerId:0,
|
||||
petTbId:creeps.petTbId,
|
||||
petLevel:0,
|
||||
petLevel:creeps.petLevel,
|
||||
petStar:0,
|
||||
petStarExp:0,
|
||||
}));
|
||||
@@ -357,7 +357,13 @@ export default class GOnHookMode extends GDefaultMode<{},{}>{
|
||||
//获取敌人
|
||||
let creeps = GOnHookManager.getIns().getNextCreeps();
|
||||
if(!creeps) return; //没有获取到野怪则返回
|
||||
this.onGenCreeps(2,creeps);
|
||||
|
||||
let sign = TD.TbGOnHookMaps.get(GOnHookData.getIns().info.onHookMap).sign;
|
||||
let table:{data:TbGEntity.TOnHookLevel} = TD[sign].get(GOnHookData.getIns().info.levelId);
|
||||
|
||||
for (let index = 0; index < table.data.petSize; index++) {
|
||||
this.onGenCreeps(index + 1,creeps);
|
||||
}
|
||||
// this.enemyInfo.roles.forEach((info,index) => this.onGenRole(GOnHookModePlayerEnum.ENEMY,index + 1,info));
|
||||
}
|
||||
|
||||
@@ -385,7 +391,13 @@ export default class GOnHookMode extends GDefaultMode<{},{}>{
|
||||
if(!role.get()) return;
|
||||
|
||||
//添加受击显示
|
||||
app.event.emit(ModeRenderEvent.HIT,role.v2World.clone(),hit);
|
||||
app.event.emit(GModeEvent.HIT,{
|
||||
mode:this,
|
||||
role:role,
|
||||
hit:hit,
|
||||
world:role.v2World,
|
||||
camera:this.camera,
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
@@ -11,10 +11,10 @@ import { TB } from "../../config/data/schema";
|
||||
import JNFrameTime from "../../../../extensions/ngame/assets/ngame/sync/frame/game/time/JNFrameTime";
|
||||
import GBattleModeManager from "../GBattleModeManager";
|
||||
import { app, TD } from "../../App";
|
||||
import { ModeRenderEvent } from "../../ui/Consts/Game/ModeRender";
|
||||
import { GPVPStart } from "../../action/PVPAction";
|
||||
import { PlayerPetOV } from "../../consts/API";
|
||||
import GPetAttribute from "../base/values/attribute/role/GPetAttribute";
|
||||
import { GModeEvent } from "./GMode";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
//PVP 角色
|
||||
@@ -241,7 +241,13 @@ export default class GPVPMode extends GBaseMode<{},GPVPStart>{
|
||||
if(!role.get()) return;
|
||||
|
||||
//添加受击显示
|
||||
app.event.emit(ModeRenderEvent.HIT,role.v2World.clone(),hit);
|
||||
app.event.emit(GModeEvent.HIT,{
|
||||
mode:this,
|
||||
role:role,
|
||||
hit:hit,
|
||||
world:role.v2World,
|
||||
camera:this.camera,
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user