mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 03:14:47 +00:00
提交
This commit is contained in:
parent
8c4d80ea8a
commit
c61e1b576b
@ -186,7 +186,7 @@
|
|||||||
},
|
},
|
||||||
"_fillStart": 0,
|
"_fillStart": 0,
|
||||||
"_fillRange": 0,
|
"_fillRange": 0,
|
||||||
"_isTrimmedMode": true,
|
"_isTrimmedMode": false,
|
||||||
"_useGrayscale": false,
|
"_useGrayscale": false,
|
||||||
"_atlas": null,
|
"_atlas": null,
|
||||||
"_id": ""
|
"_id": ""
|
||||||
@ -322,7 +322,7 @@
|
|||||||
},
|
},
|
||||||
"_fillStart": 0,
|
"_fillStart": 0,
|
||||||
"_fillRange": 0,
|
"_fillRange": 0,
|
||||||
"_isTrimmedMode": true,
|
"_isTrimmedMode": false,
|
||||||
"_useGrayscale": false,
|
"_useGrayscale": false,
|
||||||
"_atlas": null,
|
"_atlas": null,
|
||||||
"_id": ""
|
"_id": ""
|
||||||
|
@ -281,7 +281,7 @@
|
|||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
"x": 0,
|
"x": 0,
|
||||||
"y": -86.34900000000005,
|
"y": -640,
|
||||||
"z": 0
|
"z": 0
|
||||||
},
|
},
|
||||||
"_lrot": {
|
"_lrot": {
|
||||||
@ -527,7 +527,7 @@
|
|||||||
"_left": 0,
|
"_left": 0,
|
||||||
"_right": 0,
|
"_right": 0,
|
||||||
"_top": 0,
|
"_top": 0,
|
||||||
"_bottom": 553.651,
|
"_bottom": 0,
|
||||||
"_horizontalCenter": 0,
|
"_horizontalCenter": 0,
|
||||||
"_verticalCenter": 0,
|
"_verticalCenter": 0,
|
||||||
"_isAbsLeft": true,
|
"_isAbsLeft": true,
|
||||||
@ -661,7 +661,7 @@
|
|||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
"x": 0,
|
"x": 0,
|
||||||
"y": 279.365,
|
"y": 0,
|
||||||
"z": 0
|
"z": 0
|
||||||
},
|
},
|
||||||
"_lrot": {
|
"_lrot": {
|
||||||
|
@ -30,10 +30,10 @@ import { Component } from "cc";
|
|||||||
|
|
||||||
// let APIPath = `http://localhost:8080`
|
// let APIPath = `http://localhost:8080`
|
||||||
// let WsPath = `ws://localhost:8080/websocket`
|
// let WsPath = `ws://localhost:8080/websocket`
|
||||||
let APIPath = `http://192.168.1.23:8080`
|
// let APIPath = `http://192.168.1.23:8080`
|
||||||
let WsPath = `ws://192.168.1.23:8080/websocket`
|
// let WsPath = `ws://192.168.1.23:8080/websocket`
|
||||||
// let APIPath = `http://192.168.0.122:8080`
|
let APIPath = `http://192.168.0.122:8080`
|
||||||
// let WsPath = `ws://192.168.0.122:8080/websocket`
|
let WsPath = `ws://192.168.0.122:8080/websocket`
|
||||||
// let APIPath = `https://api.pet.jisol.cn`
|
// let APIPath = `https://api.pet.jisol.cn`
|
||||||
// let WsPath = `wss://api.pet.jisol.cn/websocket`
|
// let WsPath = `wss://api.pet.jisol.cn/websocket`
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ export default class GDetection{
|
|||||||
rect.x -= rect.width / 2;
|
rect.x -= rect.width / 2;
|
||||||
rect.y -= rect.height / 2;
|
rect.y -= rect.height / 2;
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
return PhysicsSystem2D.instance.testAABB(rect).map(item => item.getComponent(GRoleBase<any>));
|
return PhysicsSystem2D.instance.testAABB(rect).map(item => item.getComponent(GRoleBase<any>)).filter(role => !!role);
|
||||||
}
|
}
|
||||||
//检测角色
|
//检测角色
|
||||||
static testPointRole(pos:Vec2){
|
static testPointRole(pos:Vec2){
|
||||||
|
@ -11,6 +11,10 @@ import { TB } from "../../../config/data/schema";
|
|||||||
import GRoleValues, { GRoleAttackType } from "../values/GRoleValues";
|
import GRoleValues, { GRoleAttackType } from "../values/GRoleValues";
|
||||||
import GAttributeBase from "../values/attribute/GAttributeBase";
|
import GAttributeBase from "../values/attribute/GAttributeBase";
|
||||||
import { GPetAminEnum } from "../anim/GPetAnim";
|
import { GPetAminEnum } from "../anim/GPetAnim";
|
||||||
|
import NOV2DSimple from "../../../../../extensions/ngame/assets/ngame/util/collide/OV/NOV2DSimple";
|
||||||
|
import NOVBase from "../../../../../extensions/ngame/assets/ngame/util/collide/OV/NOVBase";
|
||||||
|
import { BoxCollider2D } from "cc";
|
||||||
|
import { Vec3 } from "cc";
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
export enum GRoleAnimEvent{
|
export enum GRoleAnimEvent{
|
||||||
@ -74,6 +78,9 @@ export default abstract class GRoleBase<T> extends GObject<T>{
|
|||||||
this._values = value;
|
this._values = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//添加避障
|
||||||
|
ov:NOVBase;
|
||||||
|
|
||||||
get():this{
|
get():this{
|
||||||
if(this.isDie) return null;
|
if(this.isDie) return null;
|
||||||
return this;
|
return this;
|
||||||
@ -81,6 +88,9 @@ export default abstract class GRoleBase<T> extends GObject<T>{
|
|||||||
|
|
||||||
onSyncLoad(){
|
onSyncLoad(){
|
||||||
|
|
||||||
|
//避障
|
||||||
|
this.ov = new NOV2DSimple(this.node.getComponent(BoxCollider2D));
|
||||||
|
|
||||||
if(!this.spine) this.spine = this.node.getComponent(JNSkeleton);
|
if(!this.spine) this.spine = this.node.getComponent(JNSkeleton);
|
||||||
//如果没有生成则直接销毁
|
//如果没有生成则直接销毁
|
||||||
if(!this.spine) {
|
if(!this.spine) {
|
||||||
@ -135,16 +145,23 @@ export default abstract class GRoleBase<T> extends GObject<T>{
|
|||||||
|
|
||||||
|
|
||||||
if(Vec2.len(normal) >= Vec2.len(mins)){
|
if(Vec2.len(normal) >= Vec2.len(mins)){
|
||||||
this.node.setWorldPosition(Object.assign(v3(),target.clone()));
|
this.setWorldPosition(Object.assign(v3(),target.clone()));
|
||||||
return true;
|
return true;
|
||||||
}else{
|
}else{
|
||||||
//移动
|
//移动
|
||||||
this.node.worldPosition = this.node.worldPosition.subtract(v3(normal.x*dt*this.moveSpeed,normal.y*dt*this.moveSpeed,0))
|
this.setWorldPosition(this.node.worldPosition.subtract(v3(normal.x*dt*this.moveSpeed,normal.y*dt*this.moveSpeed,0)));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//设置世界坐标
|
||||||
|
setWorldPosition(worldPos:Vec3){
|
||||||
|
if(this.ov.moveTo(worldPos)){
|
||||||
|
this.node.setWorldPosition(worldPos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//朝向目标
|
//朝向目标
|
||||||
onTowardsTarget(role:GRoleBase<{}>){
|
onTowardsTarget(role:GRoleBase<{}>){
|
||||||
//获取两个坐标差值向量
|
//获取两个坐标差值向量
|
||||||
|
Loading…
x
Reference in New Issue
Block a user