This commit is contained in:
PC-20230316NUNE\Administrator 2023-12-13 10:51:31 +08:00
parent 7e36704e54
commit 5bc3f1d954
6 changed files with 75 additions and 22 deletions

View File

@ -101,6 +101,17 @@ export class GTactical{
return null;
}
//获取XY的位置
getPosXYPosition(x:number,y:number,father:Vec2 = this.offset){
return this.getPosition(this.getPosXY(x,y),father);
}
//获取XY的 Index
getPosXY(x:number,y:number):number{
return this.tactical[y][x];
}
//返回我在第几排
getRow(index:number):number{
let pos;

View File

@ -10,6 +10,8 @@ import GRoleCGCrystal from "../base/role/CampGuardian/GRoleCGCrystal";
import { TD } from "../../App";
import { GTowards } from "../base/GObject";
import GRoleBase from "../base/role/GRoleBase";
import { GTactical } from "../entity/GTactical";
import JNFrameTime from "../../../../extensions/ngame/assets/ngame/sync/frame/game/time/JNFrameTime";
const { ccclass, property } = _decorator;
//阵营守护 角色
@ -51,6 +53,11 @@ export default class GCampGuardianMode extends GBaseMode<{},{}>{
this.onGenCrystal(GCampGuardianEnum.PLAYER);
this.onGenCrystal(GCampGuardianEnum.ENEMY);
//定时器生成
JNFrameTime.getInstance().setInterval(() => {
// this.onGenRole(GCampGuardianEnum.PLAYER,TD.TbGRole.get());
},1000)
}
//生成水晶
@ -72,35 +79,43 @@ export default class GCampGuardianMode extends GBaseMode<{},{}>{
}
// //生成宠物
// onGenRole(type:GCampGuardianEnum,info:TB.TbGRole):GRoleDefault {
//生成宠物
onGenRole(type:GCampGuardianEnum,info:TB.TbGRole):GRoleDefault {
// let tactical = this.getInfo(type).tactical;
// let pos:Vec2 = this.getInfo(type).tactical.getPosition(index);
// if(!pos) return;
// let role = instantiate(this.rolePrefab);
let tactical = GTactical.getTactical();
let pos:Vec2;
// let entity = role.getComponent(GRoleDefault);
// //初始化
// entity.onInit(type,info,tactical,index);
switch(type){
case GCampGuardianEnum.PLAYER:
pos = tactical.getPosXYPosition(1,1,this.playerPos);
break;
case GCampGuardianEnum.ENEMY:
pos = tactical.getPosXYPosition(1,1,this.enemyPos);
break;
}
// //绑定寻敌
// entity.onQueryEunmy = () => {
// return this.getEnumy(entity,type);
// }
// //绑定死亡回调
// entity.addKillBackEvent(this.onRoleKillBack.bind(this))
// //绑定受击回调
// entity.addHitCallback(this.onHitBack.bind(this));
if(!pos) return;
let role = instantiate(this.petPrefab);
// this.addGObject(entity,tactical.getPosition(index));
let entity = role.getComponent(GRoleDefault);
//初始化
entity.onInit(type,info,tactical,tactical.getPosXY(1,1));
// this.getOnesRole(type).push(entity);
// //绑定寻敌
// entity.onQueryEunmy = () => {
// return this.getEnumy(entity,type);
// }
// return entity;
// //绑定死亡回调
// entity.addKillBackEvent(this.onRoleKillBack.bind(this))
// //绑定受击回调
// entity.addHitCallback(this.onHitBack.bind(this));
// }
this.addGObject(entity,pos);
return entity;
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "469e759f-b689-40d4-96f2-a1747cd8e508",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,9 @@
export enum GPet {
= 10001,
= 10002,
= 10003,
= 10004,
= 10005,
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "618335e2-2da9-4c75-aefc-04e07e161128",
"files": [],
"subMetas": {},
"userData": {}
}

@ -1 +1 @@
Subproject commit b8a23be6dffa05a2e8e46fbf0b27e859372ac3be
Subproject commit 8797aaedf9707027df90d0b304b952aa6afa3a30