mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交妙蛙种子
This commit is contained in:
@@ -54,6 +54,10 @@ export default class GFSMBase{
|
||||
this.isClose = true;
|
||||
}
|
||||
|
||||
open(){
|
||||
this.isClose = false;
|
||||
}
|
||||
|
||||
//执行流程
|
||||
execute(process:GFSMProcessInfo,dt:number){
|
||||
if(!process) return;
|
||||
|
@@ -10,7 +10,6 @@ export enum GFSMBattleAminEnum {
|
||||
Walk = "walk", //移动
|
||||
Attack = "atk", //攻击
|
||||
Fly = "jifei", //击飞
|
||||
Skill = "jifei", //技能
|
||||
}
|
||||
|
||||
//动画流程信息
|
||||
|
@@ -75,6 +75,16 @@ export default abstract class GRoleBase<T> extends GObject<T>{
|
||||
this.fsmAnim.isDie = value;
|
||||
}
|
||||
|
||||
//受击回调
|
||||
hitCallbacks:Function[] = [];
|
||||
//添加受击回调
|
||||
addHitCallback(fun:Function){this.hitCallbacks.push(fun)};
|
||||
|
||||
//攻击回调
|
||||
attackCallbacks:Function[] = [];
|
||||
//添加受击回调
|
||||
addAttackCallback(fun:Function){this.attackCallbacks.push(fun)};
|
||||
|
||||
get():GRoleBase<T>{
|
||||
if(this.isDie) return null;
|
||||
return this;
|
||||
@@ -180,9 +190,11 @@ export default abstract class GRoleBase<T> extends GObject<T>{
|
||||
|
||||
//攻击
|
||||
onAttack(){
|
||||
if(!this.fsm.enemy) return;
|
||||
//敌人扣血
|
||||
let info = TableGRoleAttack.getConfig(this.role.id);
|
||||
(new GAttack[info.attackWay]()).attack(this,info);
|
||||
this.attackCallbacks.forEach(fun => fun());
|
||||
}
|
||||
|
||||
//释放技能 每一次只能释放一次
|
||||
@@ -203,6 +215,7 @@ export default abstract class GRoleBase<T> extends GObject<T>{
|
||||
onHit(){
|
||||
// return;
|
||||
this.blood -= 10;
|
||||
this.hitCallbacks.forEach(fun => fun());
|
||||
//检测是否死亡
|
||||
if(this.blood <= 0){
|
||||
//关闭状态机
|
||||
|
@@ -59,7 +59,7 @@ export default class GPVPMode extends GBaseMode<{}>{
|
||||
console.log("GPVPMode 模式初始化");
|
||||
|
||||
this.playerInfo = { tactical: GTactical.getTactical(), roles: GRoleUtil.getGRoles([10001,10001,10001,10001,10003,10003]) };
|
||||
this.enemyInfo = { tactical: GTactical.getTactical(true), roles: GRoleUtil.getGRoles([10002,10002,10002,10001,10001,10003]) };
|
||||
this.enemyInfo = { tactical: GTactical.getTactical(true), roles: GRoleUtil.getGRoles([10002,10002,10002,10001,10004,10003]) };
|
||||
|
||||
//生成玩家
|
||||
this.playerInfo.roles.forEach((info,index) => this.onGenRole(GPVPModePlayerEnum.PLAYER,index+1,info))
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import { TableGRoleSkill } from "../../../resources/config/ts/TableGRoleSkill";
|
||||
import GRoleBase from "../base/role/GRoleBase";
|
||||
import GSkillCrazySquirrel from "./RoleSkill/GSkillCrazySquirrel";
|
||||
import GSkillCrazySquirrel from "./RoleSkill/疯狂松鼠/GSkillCrazySquirrel";
|
||||
import GSkillBulbasaurDoubleHit from "./RoleSkill/妙蛙种子/GSkillBulbasaurDoubleHit";
|
||||
|
||||
//技能状态
|
||||
export enum GSkillState{
|
||||
@@ -36,5 +37,6 @@ export interface GSkillBase {
|
||||
//技能方式
|
||||
export const GSkill:{[key:string]:(new () => GSkillBase)} = {
|
||||
["GSkillCrazySquirrel"]:GSkillCrazySquirrel,
|
||||
["GSkillBulbasaurDoubleHit"]:GSkillBulbasaurDoubleHit,
|
||||
}
|
||||
|
||||
|
@@ -6,23 +6,50 @@ import { GSkillBase, GSkillState } from "./GSkill";
|
||||
//怒气冷却
|
||||
export default abstract class GSkillAngerBase implements GSkillBase {
|
||||
|
||||
//怒气值
|
||||
anger:number = 0;
|
||||
//怒气最大值
|
||||
angerMax:number = 0;
|
||||
|
||||
bind(role: GRoleBase<{}>, info: TableGRoleSkill): GSkillBase {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
isRelease(): boolean {
|
||||
throw new Error("Method not implemented.");
|
||||
return this.anger >= this.angerMax;
|
||||
}
|
||||
release(): boolean {
|
||||
throw new Error("Method not implemented.");
|
||||
//是否可以释放技能
|
||||
if(!this.isRelease()) return false;
|
||||
this.anger = 0;
|
||||
return this.onRelease();
|
||||
}
|
||||
|
||||
//子类实现释放
|
||||
abstract onRelease():boolean;
|
||||
|
||||
|
||||
//是否正在释放技能
|
||||
isReleasing(): boolean{
|
||||
return false;
|
||||
}
|
||||
|
||||
state(): GSkillState {
|
||||
throw new Error("Method not implemented.");
|
||||
|
||||
if(this.isReleasing()){
|
||||
return GSkillState.Releasing
|
||||
}
|
||||
|
||||
if(this.isRelease())
|
||||
return GSkillState.Releasable
|
||||
else
|
||||
return GSkillState.NoRelease
|
||||
|
||||
}
|
||||
onUpdate(dt: number) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
//返回进度条
|
||||
getProgress(): number {
|
||||
throw new Error("Method not implemented.");
|
||||
return this.anger / this.angerMax;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "43c206f9-e341-454d-8975-d4db0a7410f0",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,47 @@
|
||||
import { TableGRoleSkill } from "../../../../../resources/config/ts/TableGRoleSkill";
|
||||
import GRoleBase from "../../../base/role/GRoleBase";
|
||||
import GSkillAngerBase from "../../GSkillAngerBase";
|
||||
|
||||
export default class GSkillBulbasaurDoubleHit extends GSkillAngerBase{
|
||||
|
||||
role:GRoleBase<{}>;
|
||||
info: TableGRoleSkill;
|
||||
|
||||
bind(role:GRoleBase<{}>,info: TableGRoleSkill):GSkillBulbasaurDoubleHit {
|
||||
//技能冷却
|
||||
this.role = role;
|
||||
this.info = info;
|
||||
this.angerMax = parseInt(info.skillArgs[0]);
|
||||
this.role.addAttackCallback(this.addAnger.bind(this))
|
||||
return this;
|
||||
|
||||
}
|
||||
|
||||
onRelease(): boolean {
|
||||
|
||||
let enemy = this.role.fsm.enemy;
|
||||
//关闭动画管理器
|
||||
this.role.fsmAnim.close();
|
||||
|
||||
//监听伤害
|
||||
this.role.fsmAnim.addEventListener("skill1Attack",() => {
|
||||
if(!enemy.isDie){
|
||||
enemy.onHit();
|
||||
}
|
||||
})
|
||||
//播放妙蛙种子技能
|
||||
this.role.spine.setTrackCompleteListener(this.role.spine.setAnimation(0,"skill1",false),() => {
|
||||
this.role.fsmAnim.open();
|
||||
});
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
//添加怒气
|
||||
addAnger(){
|
||||
this.anger++;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "7445290b-5e86-4a89-a281-f901aed6312e",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "009f6889-ea1e-4b90-a1a0-d54b0c027189",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -1,13 +1,13 @@
|
||||
import { v2 } from "cc";
|
||||
import { JTween } from "../../../../../extensions/ngame/assets/ngame/sync/frame/game/tween/JNFrameTween";
|
||||
import { TableGRoleSkill } from "../../../../resources/config/ts/TableGRoleSkill";
|
||||
import { app } from "../../../App";
|
||||
import GSpine from "../../base/common/GSpine";
|
||||
import GRoleBase from "../../base/role/GRoleBase";
|
||||
import GSkillCDBase from "../GSkillCDBase";
|
||||
import { JTween } from "../../../../../../extensions/ngame/assets/ngame/sync/frame/game/tween/JNFrameTween";
|
||||
import { TableGRoleSkill } from "../../../../../resources/config/ts/TableGRoleSkill";
|
||||
import { app } from "../../../../App";
|
||||
import GSpine from "../../../base/common/GSpine";
|
||||
import GRoleBase from "../../../base/role/GRoleBase";
|
||||
import GSkillCDBase from "../../GSkillCDBase";
|
||||
import { v3 } from "cc";
|
||||
import GBaseMode from "../../GBaseMode";
|
||||
import GDetection from "../../base/common/GDetection";
|
||||
import GBaseMode from "../../../GBaseMode";
|
||||
import GDetection from "../../../base/common/GDetection";
|
||||
import { rect } from "cc";
|
||||
|
||||
/**
|
@@ -2,7 +2,7 @@
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "7d3fd1cc-d849-4139-8926-689129416a29",
|
||||
"uuid": "d06a5892-0787-4634-b84a-9d23804f016e",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
Reference in New Issue
Block a user