mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
更新
This commit is contained in:
@@ -3,29 +3,77 @@ import GDefaultMode from "./default/GDefaultMode";
|
||||
import { TB } from "../../../resources/config/data/schema";
|
||||
import GRoleDefault from "../base/role/GRoleDefault";
|
||||
import { _decorator } from "cc";
|
||||
import GBaseMode from "../GBaseMode";
|
||||
import { Prefab } from "cc";
|
||||
import { instantiate } from "cc";
|
||||
import GRoleCGCrystal from "../base/role/CampGuardian/GRoleCGCrystal";
|
||||
import { TD } from "../../App";
|
||||
import { GTowards } from "../base/GObject";
|
||||
import GRoleBase from "../base/role/GRoleBase";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
//阵营守护 角色
|
||||
export enum GCampGuardianEnum{
|
||||
PLAYER, //玩家
|
||||
ENEMY, //敌人
|
||||
}
|
||||
|
||||
//阵营守护
|
||||
//玩家派兵攻击对方阵营 游戏参考
|
||||
@ccclass('GCampGuardianMode')
|
||||
export default class GCampGuardianMode extends GDefaultMode<{},{}>{
|
||||
export default class GCampGuardianMode extends GBaseMode<{},{}>{
|
||||
|
||||
//玩家水晶位置
|
||||
playerPos: Vec2 = new Vec2(-400,0);
|
||||
playerPos: Vec2 = new Vec2(-600,0);
|
||||
//敌方水晶位置
|
||||
enemyPos: Vec2 = new Vec2(400,0);
|
||||
enemyPos: Vec2 = new Vec2(600,0);
|
||||
|
||||
//我方水晶
|
||||
|
||||
//敌方水晶
|
||||
|
||||
//水晶预制体
|
||||
@property(Prefab)
|
||||
crystalPrefab: Prefab;
|
||||
|
||||
//角色预制体
|
||||
@property(Prefab)
|
||||
petPrefab: Prefab;
|
||||
|
||||
//玩家宠物
|
||||
playerRoles: GRoleBase<{}>[] = [];
|
||||
//敌方宠物
|
||||
enemyRoles: GRoleBase<{}>[] = [];
|
||||
|
||||
onSyncInitSuccess(){
|
||||
|
||||
|
||||
//生成水晶
|
||||
this.onGenCrystal(GCampGuardianEnum.PLAYER);
|
||||
this.onGenCrystal(GCampGuardianEnum.ENEMY);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//生成水晶
|
||||
onGenCrystal(type:GCampGuardianEnum){
|
||||
|
||||
let crystalNode = instantiate(this.crystalPrefab);
|
||||
let crystal = crystalNode.getComponent(GRoleCGCrystal);
|
||||
crystal.init(TD.TbGRole.get(10005));
|
||||
|
||||
switch(type){
|
||||
case GCampGuardianEnum.PLAYER:
|
||||
this.addGObject(crystal,this.playerPos)
|
||||
break;
|
||||
case GCampGuardianEnum.ENEMY:
|
||||
crystal.setTowards(GTowards.LEFT)
|
||||
this.addGObject(crystal,this.enemyPos)
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// //生成宠物
|
||||
// onGenRole(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);
|
||||
|
Reference in New Issue
Block a user