mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-11-07 23:06:03 +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();
|
||||
|
||||
Reference in New Issue
Block a user