mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
update
This commit is contained in:
@@ -8,16 +8,14 @@ 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{
|
||||
|
||||
@@ -26,7 +24,6 @@ export default class GAttackParabolicRemote implements GAttackBase{
|
||||
let enemy = role.fsm.enemy;
|
||||
if(!enemy) return;
|
||||
|
||||
//[子弹图片]
|
||||
let image:SpriteFrame = app.role.bullets[info.attackArgs[0]];
|
||||
let bang = {
|
||||
ske: app.role.effects[info.attackArgs[1]],
|
||||
|
@@ -149,14 +149,17 @@ export default abstract class GFSMBattle extends GFSMBase{
|
||||
this.player.fsmAnim.isAttack = true;
|
||||
//如果有敌人则攻击 没有 则 重置
|
||||
if(this.enemy){
|
||||
// if(){
|
||||
// //如果可以释放大招
|
||||
// }else{
|
||||
// //不可以则普攻
|
||||
//朝向敌人
|
||||
this.player.onTowardsTarget(this.enemy);
|
||||
return GFSMProcessEnum.Wait;
|
||||
// }
|
||||
|
||||
//是否可释放技能
|
||||
if(this.player.isReleaseSkill()){
|
||||
//则释放技能
|
||||
return ProcessEnum.ReleaseSkills;
|
||||
}else{
|
||||
return GFSMProcessEnum.Wait;
|
||||
}
|
||||
|
||||
}else{
|
||||
return ProcessEnum.SeekEnemy;
|
||||
}
|
||||
@@ -165,6 +168,21 @@ export default abstract class GFSMBattle extends GFSMBase{
|
||||
//释放技能
|
||||
onReleaseSkillsProcess(){
|
||||
|
||||
//如果正在释放则等待
|
||||
if(this.player.isReleasingSkill()){
|
||||
return GFSMProcessEnum.Wait;
|
||||
}
|
||||
|
||||
//释放技能
|
||||
if(this.player.isReleaseSkill()){
|
||||
//如果可以释放技能则释放
|
||||
this.player.onReleaseSkill();
|
||||
return GFSMProcessEnum.Wait;
|
||||
}else{
|
||||
//不可以则回到攻击
|
||||
return ProcessEnum.AttackEnemy;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,5 +1,8 @@
|
||||
import { sp } from "cc";
|
||||
import GFSMBase, { GFSMProcessEnum, GFSMProcessInfo, GFSMProcessMode } from "../../GFSMBase";
|
||||
import GRoleBase from "../../../role/GRoleBase";
|
||||
import GRolePVPEntity from "../../../role/PVP/GRolePVPEntity";
|
||||
import GObject from "../../../GObject";
|
||||
|
||||
//角色动画名称枚举
|
||||
export enum GFSMBattleAminEnum {
|
||||
@@ -63,7 +66,8 @@ export class GFSMBattleAmin extends GFSMBase{
|
||||
this.trackIndex = trackIndex || 0;
|
||||
//设置监听
|
||||
this.spine.setEventListener(this.onEventListener.bind(this));
|
||||
this.spine.setStartListener(this.onStartListener.bind(this));
|
||||
//因为SpineBUG所以不使用Spine监听 采用自己调用
|
||||
// this.spine.setStartListener(this.onStartListener.bind(this));
|
||||
}
|
||||
|
||||
//添加事件监听
|
||||
@@ -176,8 +180,9 @@ export class GFSMBattleAmin extends GFSMBase{
|
||||
|
||||
//播放动画
|
||||
if(!info.track){
|
||||
console.log("播放动画",info);
|
||||
console.log(`播放动画-${this.spine.getComponent(GObject).nId}-`,info);
|
||||
info.track = this.spine.setAnimation(this.trackIndex,info.animName,info.isLoop);
|
||||
this.onStartListener(info.track);
|
||||
}
|
||||
|
||||
return to;
|
||||
|
@@ -13,7 +13,7 @@ import { TableGRoleAttack } from "../../../../resources/config/ts/TableGRoleAtta
|
||||
import { GAttack, GAttackBase } from "../attack/GAttack";
|
||||
import { TableGRole } from "../../../../resources/config/ts/TableGRole";
|
||||
import { TableGRoleSkill } from "../../../../resources/config/ts/TableGRoleSkill";
|
||||
import { GSkill, GSkillBase } from "../../skill/GSkill";
|
||||
import { GSkill, GSkillBase, GSkillState } from "../../skill/GSkill";
|
||||
import JNSkeleton from "../../../../../extensions/ngame/assets/ngame/sync/frame/game/spine/JNFrameSkeleton";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -131,9 +131,8 @@ export default abstract class GRoleBase<T> extends GObject<T>{
|
||||
this.fsm && this.fsm.onUpdate(dt / 1000);
|
||||
this.fsmAnim && this.fsmAnim.onUpdate(dt / 1000);
|
||||
|
||||
if(frame.index == 100){
|
||||
this.skills[0] && this.skills[0].release();
|
||||
}
|
||||
//更新技能
|
||||
this.skills.forEach(skill => skill.onUpdate(dt));
|
||||
|
||||
}
|
||||
|
||||
@@ -227,12 +226,13 @@ export default abstract class GRoleBase<T> extends GObject<T>{
|
||||
//击飞
|
||||
onFly(){
|
||||
|
||||
console.log("onFly");
|
||||
if(this.nId == 1)
|
||||
console.log("onFly");
|
||||
let vWorld = this.node.worldPosition;
|
||||
let vEndWorld = this.getWorldBackLen(v2(1000,500));
|
||||
this.JTween(vWorld)
|
||||
.to({x:vEndWorld.x},800)
|
||||
.onUpdate(pos => this.node.worldPosition = vWorld)
|
||||
.onUpdate(pos => this.node.worldPosition = pos)
|
||||
.start();
|
||||
this.JTween(vWorld)
|
||||
.to({y:vEndWorld.y},800)
|
||||
@@ -252,6 +252,37 @@ export default abstract class GRoleBase<T> extends GObject<T>{
|
||||
return roles.filter(role => role.type != this.type);
|
||||
}
|
||||
|
||||
//判断是否可以释放技能
|
||||
isReleaseSkill():boolean{
|
||||
for (const skill of this.skills) {
|
||||
if(skill.isRelease()){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//释放技能
|
||||
onReleaseSkill():boolean{
|
||||
for (const skill of this.skills) {
|
||||
if(skill.isRelease()){
|
||||
skill.release();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//是否正在释放技能
|
||||
isReleasingSkill():boolean {
|
||||
for (const skill of this.skills) {
|
||||
if(skill.state() == GSkillState.Releasing){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@@ -51,6 +51,10 @@ export default class GRolePVPEntity extends GRoleBase<GDemoMessage>{
|
||||
|
||||
//更新显示
|
||||
this.bloodVolume.progress = this.blood / this.fullBlood;
|
||||
//显示第一个技能进度条
|
||||
if(this.skills[0]){
|
||||
this.energyVolume.progress = this.skills[0].getProgress();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -24,6 +24,12 @@ export interface GSkillBase {
|
||||
//技能状态
|
||||
state():GSkillState;
|
||||
|
||||
//技能更新
|
||||
onUpdate(dt:number);
|
||||
|
||||
//返回进度条
|
||||
getProgress():number;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
29
JisolGameCocos/assets/script/battle/skill/GSkillAngerBase.ts
Normal file
29
JisolGameCocos/assets/script/battle/skill/GSkillAngerBase.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { TableGRoleSkill } from "../../../resources/config/ts/TableGRoleSkill";
|
||||
import GRoleBase from "../base/role/GRoleBase";
|
||||
import { GSkillBase, GSkillState } from "./GSkill";
|
||||
|
||||
|
||||
//怒气冷却
|
||||
export default abstract class GSkillAngerBase implements GSkillBase {
|
||||
|
||||
bind(role: GRoleBase<{}>, info: TableGRoleSkill): GSkillBase {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
isRelease(): boolean {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
release(): boolean {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
state(): GSkillState {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
onUpdate(dt: number) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
getProgress(): number {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "e648aeed-c49c-4f10-b24f-6aef45fc14f5",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -7,33 +7,61 @@ import { GSkillBase, GSkillState } from "./GSkill";
|
||||
export default abstract class GSkillCDBase implements GSkillBase {
|
||||
|
||||
//冷却总时间
|
||||
cdTatal:number;
|
||||
cdTatal:number = 0;
|
||||
//冷却时间
|
||||
cdTime:number;
|
||||
cdTime:number = 0;
|
||||
|
||||
bind(role:GRoleBase<{}>,info: TableGRoleSkill):GSkillCDBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
//是否可以释放技能
|
||||
isRelease(): boolean {
|
||||
//冷却时间小于等于0可释放
|
||||
return this.cdTime <= 0;
|
||||
return this.cdTime >= this.cdTatal;
|
||||
}
|
||||
|
||||
//释放技能
|
||||
release():boolean {
|
||||
// //是否可以释放技能
|
||||
// if(!this.isRelease()) return false;
|
||||
//是否可以释放技能
|
||||
if(!this.isRelease()) return false;
|
||||
this.cdTime = 0;
|
||||
return this.onRelease();
|
||||
}
|
||||
|
||||
//子类实现释放
|
||||
abstract onRelease():boolean;
|
||||
|
||||
//查询状态
|
||||
state(): GSkillState {
|
||||
if(this.isRelease())
|
||||
|
||||
if(this.isReleasing()){
|
||||
return GSkillState.Releasing
|
||||
}
|
||||
|
||||
if(this.isRelease())
|
||||
return GSkillState.Releasable
|
||||
else
|
||||
return GSkillState.NoRelease
|
||||
|
||||
}
|
||||
|
||||
//是否正在释放技能
|
||||
isReleasing(): boolean{
|
||||
return false;
|
||||
}
|
||||
|
||||
//更新
|
||||
onUpdate(dt:number){
|
||||
|
||||
if(this.state() == GSkillState.NoRelease){
|
||||
this.cdTime += (dt / 1000);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//返回进度
|
||||
getProgress():number{
|
||||
return this.cdTime / this.cdTatal;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -20,7 +20,6 @@ export default class GSkillCrazySquirrel extends GSkillCDBase{
|
||||
info: TableGRoleSkill;
|
||||
|
||||
bind(role:GRoleBase<{}>,info: TableGRoleSkill):GSkillCrazySquirrel {
|
||||
|
||||
//技能冷却
|
||||
this.cdTatal = parseInt(info.skillArgs[0]);
|
||||
this.role = role;
|
||||
|
Reference in New Issue
Block a user