This commit is contained in:
2024-08-02 17:06:21 +08:00
parent 52cefb71b4
commit d5f2f65ee6
22 changed files with 920 additions and 75 deletions

View File

@@ -58,7 +58,7 @@ export class MapViewComp extends CCComp {
this.scene.node.active = true
if (smc.monsters.length>0){
let monster = ecs.getEntity<Monster>(Monster);
let pos:Vec3 = v3(BoxSet.RIGHT_END,-60)
let pos:Vec3 = v3(BoxSet.MONSTER_START,BoxSet.GAME_LINE)
let speed =smc.monsters[0].speed
let camp = -1
let prefab_path = smc.monsters[0].prefab_path
@@ -70,7 +70,7 @@ export class MapViewComp extends CCComp {
if(smc.heros.length>0) {
console.log("heros load")
let monster = ecs.getEntity<Monster>(Monster);
let pos = v3(BoxSet.LETF_END,-60)
let pos = v3(BoxSet.HERO_START,BoxSet.GAME_LINE)
let speed =smc.heros[0].speed
let camp = 1
let prefab_path = smc.heros[0].prefab_path

View File

@@ -0,0 +1,56 @@
/*
* @Author: dgflash
* @Date: 2022-08-04 15:22:33
* @LastEditors: dgflash
* @LastEditTime: 2023-05-12 18:04:45
*/
import { Component, Node, Prefab, _decorator ,instantiate} from 'cc';
import { Timer } from '../../../../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer';
import {oops} from "../../../../../../../extensions/oops-plugin-framework/assets/core/Oops";
const { ccclass, property } = _decorator;
/**
* 物体层
* 注:
* 1、这里的深度排序如果有性能问题可考虑修改为非每帧排序
* 2、如果全3D世界显示角色相关显示对象则不需要2D深度排序只引用2D地图上的位置信息
*/
@ccclass('SkillLayer')
export default class SkillLayer extends Component {
private timer: Timer = new Timer(0.2);
@property(Prefab)
light: Prefab = null;
onLoad(){
// 监听全局事件
oops.message.on("monster_load", this.onMonsterLoaded, this);
oops.message.on("hero_load", this.onHeroLoaded, this);
}
onMonsterLoaded(){
const light = instantiate(this.light);
light.setPosition(300,-30,0);
this.node.addChild(light);
}
onHeroLoaded(){
const light = instantiate(this.light);
light.setPosition(-300,-30,0);
this.node.addChild(light);
}
update(dt: number) {
this.timer.update(dt)
// if (this.timer.update(dt))
// this.node.children.sort(this.zIndexSort);
}
// private zIndexSort(a: Node, b: Node) {
// let a_zIndex = a.getComponent(Charactor)!.zIndex;
// let b_zIndex = b.getComponent(Charactor)!.zIndex;
// return a_zIndex - b_zIndex;
// }
public clear() {
this.node.children.forEach(n => {
});
}
}

View File

@@ -0,0 +1 @@
{"ver":"4.0.23","importer":"typescript","imported":true,"uuid":"7852ab4a-120b-4c93-9d76-9b48c382599f","files":[],"subMetas":{},"userData":{"simulateGlobals":[]}}

View File

@@ -0,0 +1,23 @@
import { _decorator, Component, Node, sp } from 'cc';
const { ccclass, property ,} = _decorator;
@ccclass('light')
export class light extends Component {
private spine!: sp.Skeleton;
start() {
}
protected onLoad(): void {
this.spine = this.getComponent(sp.Skeleton)!;
this.spine.setCompleteListener(trackEntry => {
this.node.destroy()
});
}
update(deltaTime: number) {
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "fc960e39-45c0-41bf-8ff8-04a4acca0c38",
"files": [],
"subMetas": {},
"userData": {}
}