mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
update 添加松鼠角色
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { math } from "cc";
|
||||
import { PhysicsSystem2D } from "cc";
|
||||
import GRoleBase from "../role/GRoleBase";
|
||||
import { Vec2 } from "cc";
|
||||
|
||||
|
||||
//检测工具类
|
||||
export default class GDetection{
|
||||
|
||||
//检测角色
|
||||
static testAABBRole(rect:math.Rect):GRoleBase<{}>[]{
|
||||
//@ts-ignore
|
||||
return PhysicsSystem2D.instance.testAABB(rect).map(item => item.getComponent(GRoleBase<any>));
|
||||
}
|
||||
//检测角色
|
||||
static testPointRole(pos:Vec2){
|
||||
//@ts-ignore
|
||||
console.log(PhysicsSystem2D.instance.testPoint(pos));
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "a2cdfca5-479c-4e51-9245-29dd3626cbc2",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
63
JisolGameCocos/assets/script/battle/base/common/GSpine.ts
Normal file
63
JisolGameCocos/assets/script/battle/base/common/GSpine.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
import { sp } from "cc";
|
||||
import GRoleBase from "../role/GRoleBase";
|
||||
import JNSkeleton from "../../../../../extensions/ngame/assets/ngame/sync/frame/game/spine/JNFrameSkeleton";
|
||||
import { Node } from "cc";
|
||||
import GBaseMode from "../../GBaseMode";
|
||||
import { Vec2 } from "cc";
|
||||
|
||||
|
||||
//Spine 工具
|
||||
export default class GSpine{
|
||||
|
||||
//保存当前Spine 播放新 Spine 结束后还原
|
||||
static onPlayAnotherSpine(role:GRoleBase<{}>,spine:sp.SkeletonData,play:string,fun:{
|
||||
start?:(ske:JNSkeleton) => void,
|
||||
end?:() => void,
|
||||
} = {}):JNSkeleton{
|
||||
|
||||
//关闭当前角色原本的Spine
|
||||
role.spine.enabled = false;
|
||||
//添加新的spine
|
||||
let spineNode = new Node();
|
||||
role.node.addChild(spineNode);
|
||||
let another = spineNode.addComponent(JNSkeleton);
|
||||
another.skeletonData = spine;
|
||||
fun.start && fun.start(another);
|
||||
another.setCompleteListener(() => {
|
||||
//还原
|
||||
role.spine.enabled = true;
|
||||
spineNode.destroy();
|
||||
fun.end && fun.end();
|
||||
});
|
||||
another.setAnimation(0,play,false);
|
||||
// another.setAnimation(0,play,false);
|
||||
return another;
|
||||
|
||||
}
|
||||
|
||||
//创建一个Spine
|
||||
static onCreateSpine(spine:sp.SkeletonData):JNSkeleton{
|
||||
|
||||
let spineNode = new Node();
|
||||
let another = spineNode.addComponent(JNSkeleton);
|
||||
another.premultipliedAlpha = false;
|
||||
another.skeletonData = spine;
|
||||
return another;
|
||||
|
||||
}
|
||||
|
||||
// 创建一个 Spine 并且 播放 销毁
|
||||
static onPlaySceneSpine(scene:GBaseMode<{}>,pos:Vec2,spine:sp.SkeletonData,play:string):JNSkeleton{
|
||||
|
||||
let create = this.onCreateSpine(spine);
|
||||
scene.addGNode(create.node,pos);
|
||||
create.setCompleteListener(() => {
|
||||
//销毁
|
||||
create.node.destroy();
|
||||
});
|
||||
create.setAnimation(0,play);
|
||||
return create;
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "ded09977-91f1-4932-aba7-c9c5d8489859",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
Reference in New Issue
Block a user