mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
update
This commit is contained in:
@@ -12,6 +12,7 @@ import GRole from "../../entity/GRole";
|
||||
import { app } from "../../../App";
|
||||
import { TableGRoleAttack } from "../../../../resources/config/ts/TableGRoleAttack";
|
||||
import { GAttack, GAttackBase } from "../attack/GAttack";
|
||||
import { GRoleType } from "./GRoleType";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
export enum GRoleAnimEvent{
|
||||
@@ -27,6 +28,9 @@ export default abstract class GRoleBase<T> extends GObject<T>{
|
||||
//角色
|
||||
role:GRole
|
||||
|
||||
//角色类型
|
||||
type:GRoleType;
|
||||
|
||||
//状态机
|
||||
fsm:GFSMBattle;
|
||||
|
||||
@@ -57,6 +61,10 @@ export default abstract class GRoleBase<T> extends GObject<T>{
|
||||
blood:number = 100;
|
||||
fullBlood:number = 100;
|
||||
|
||||
//能量
|
||||
energy:number = 0;
|
||||
fullEnergy:number = 100;
|
||||
|
||||
//是否死亡
|
||||
_isDie:boolean = false;
|
||||
get isDie(){ return this._isDie}
|
||||
@@ -150,11 +158,14 @@ export default abstract class GRoleBase<T> extends GObject<T>{
|
||||
//敌人扣血
|
||||
let info = TableGRoleAttack.getConfig(this.role.id);
|
||||
(new GAttack[info.attackWay]()).attack(this,info);
|
||||
|
||||
//每一次攻击 则 增加能量条
|
||||
this.energy += 10;
|
||||
}
|
||||
|
||||
//受击
|
||||
onHit(){
|
||||
this.blood-=50;
|
||||
this.blood -= 10;
|
||||
//检测是否死亡
|
||||
if(this.blood <= 0){
|
||||
//关闭状态机
|
||||
@@ -169,13 +180,13 @@ export default abstract class GRoleBase<T> extends GObject<T>{
|
||||
|
||||
console.log("onFly");
|
||||
let vWorld = this.node.worldPosition;
|
||||
let vEndWorld = this.getWorldBackLen(v2(800,500));
|
||||
let vEndWorld = this.getWorldBackLen(v2(1000,500));
|
||||
this.JTween(vWorld)
|
||||
.to({x:vEndWorld.x},600)
|
||||
.to({x:vEndWorld.x},800)
|
||||
.onUpdate(pos => this.node.worldPosition = vWorld)
|
||||
.start();
|
||||
this.JTween(vWorld)
|
||||
.to({y:vEndWorld.y},600)
|
||||
.to({y:vEndWorld.y},800)
|
||||
.easing(JEasing.Circular.Out)
|
||||
.onUpdate(pos => this.node.worldPosition = vWorld)
|
||||
.start();
|
||||
|
@@ -0,0 +1,8 @@
|
||||
|
||||
//角色类型
|
||||
export enum GRoleType{
|
||||
PLAYER = "PLAYER",
|
||||
ENMEY = "ENMEY",
|
||||
PVP1 = "PVP1",
|
||||
PVP2 = "PVP2",
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "04262003-45a4-4d9d-a1d3-83c11146c891",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -28,6 +28,10 @@ export default class GRolePVPEntity extends GRoleBase<GDemoMessage>{
|
||||
@property(ProgressBar)
|
||||
bloodVolume:ProgressBar;
|
||||
|
||||
//能量条
|
||||
@property(ProgressBar)
|
||||
energyVolume:ProgressBar;
|
||||
|
||||
onSyncLoad(){
|
||||
super.onSyncLoad();
|
||||
}
|
||||
@@ -45,8 +49,9 @@ export default class GRolePVPEntity extends GRoleBase<GDemoMessage>{
|
||||
}
|
||||
}
|
||||
|
||||
//更新血量显示
|
||||
//更新显示
|
||||
this.bloodVolume.progress = this.blood / this.fullBlood;
|
||||
this.energyVolume.progress = this.energy / this.fullBlood;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user