mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
update
This commit is contained in:
@@ -64,5 +64,14 @@ export default class GObject<T> extends JNGSyncProtoBase<T>{
|
||||
}
|
||||
}
|
||||
|
||||
//镜像值处理
|
||||
getMirrorValue(value:number){
|
||||
if(this.isMirror){
|
||||
return value * -1;
|
||||
}else{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -15,6 +15,9 @@ import { Vec2 } from "cc";
|
||||
export default class GAttackParabolicRemote implements GAttackBase{
|
||||
|
||||
attack(role: GRoleBase<{}>, info: TableGRoleAttack): void {
|
||||
|
||||
let enemy = role.fsm.enemy;
|
||||
|
||||
//[子弹图片]
|
||||
let image:SpriteFrame = app.role.bullets[info.attackArgs[0]];
|
||||
let scale:number = info.attackArgs[1] as unknown as number;
|
||||
@@ -25,27 +28,29 @@ export default class GAttackParabolicRemote implements GAttackBase{
|
||||
scale:scale,
|
||||
});
|
||||
role.mode.addGObject(bullet);
|
||||
let world2 = role.node.worldPosition.clone().add(v3(bone.worldX,bone.worldY,0))
|
||||
let world2 = role.node.worldPosition.clone().add(v3(role.getMirrorValue(bone.worldX),bone.worldY,0))
|
||||
|
||||
//设置子弹位置
|
||||
bullet.node.setWorldPosition(v3(world2.x,world2.y,world2.z))
|
||||
|
||||
//子弹移动
|
||||
let start = bullet.v2World;
|
||||
let end = role.fsm.enemy.v2World;
|
||||
let end = enemy.v2World;
|
||||
let center = v2(((start.x + end.x) / 2),((start.y + end.y) / 2) + (Math.abs((start.x - end.x)) / 2));
|
||||
// start.rotate(90).normalize().multiplyScalar(50);
|
||||
|
||||
bullet.JTween({})
|
||||
.to({},Vec2.distance(start,end)*3)
|
||||
.onUpdate((data,elapsed) => {
|
||||
// console.log(data,elapsed,bezier(0,6,12,1,elapsed),bezier(0,6,12,1,elapsed))
|
||||
bullet.node.setWorldPosition(v3(
|
||||
bezier(start.x,center.x,center.x,end.x,elapsed),
|
||||
bezier(start.y,center.y,center.y,end.y,elapsed),
|
||||
0
|
||||
))
|
||||
})
|
||||
.onComplete(() => {
|
||||
enemy.onHit();
|
||||
bullet.node.removeFromParent();
|
||||
})
|
||||
.start();
|
||||
|
||||
|
||||
|
@@ -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