This commit is contained in:
walkpan
2025-02-01 00:14:25 +08:00
parent c5c01c6cf4
commit bffbb9077e
91 changed files with 2067 additions and 1327 deletions

View File

@@ -0,0 +1,34 @@
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
/** Module_001 模块 */
@ecs.register(`Module_001`)
export class Module_001 extends ecs.Entity {
/** ---------- 数据层 ---------- */
// Module_001Model!: Module_001ModelComp;
/** ---------- 业务层 ---------- */
// Module_001Bll!: Module_001BllComp;
/** ---------- 视图层 ---------- */
// Module_001View!: Module_001ViewComp;
/** 实始添加的数据层组件 */
protected init() {
// this.addComponents<ecs.Comp>();
}
/** 模块资源释放 */
destroy() {
// 注: 自定义释放逻辑,视图层实现 ecs.IComp 接口的 ecs 组件需要手动释放
super.destroy();
}
}
/** Module_001 模块业务逻辑系统组件,如无业务逻辑处理可删除此对象 */
export class EcsModule_001System extends ecs.System {
constructor() {
super();
// this.add(new ecs.ComblockSystem());
}
}

View File

@@ -2,7 +2,7 @@
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "118ca580-773a-458b-8544-ab6c3cb2b376",
"uuid": "f3b2b36f-bb80-4a29-9ff9-99b0d95dfd64",
"files": [],
"subMetas": {},
"userData": {}

View File

@@ -0,0 +1,24 @@
import { ecs } from "../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
/** 业务层对象 */
@ecs.register('ModuleBll')
export class ModuleBllComp extends ecs.Comp {
/** 业务层组件移除时,重置所有数据为默认值 */
reset() {
}
}
/** 业务层业务逻辑处理对象 */
export class ModuleBllSystem extends ecs.ComblockSystem implements ecs.IEntityEnterSystem {
filter(): ecs.IMatcher {
return ecs.allOf(ModuleBllComp);
}
entityEnter(e: ecs.Entity): void {
// 注:自定义业务逻辑
e.remove(ModuleBllComp);
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "14d41483-d32e-4fd4-8942-ef879316a4bc",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,26 @@
import { ecs } from "../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { VM } from "../../../../../extensions/oops-plugin-framework/assets/libs/model-view/ViewModel";
/** 数据层对象 */
@ecs.register('ModuleModel')
export class ModuleModelComp extends ecs.Comp {
/** 提供 MVVM 组件使用的数据 */
private vm: any = {};
/** 显示数据添加到 MVVM 框架中监视 */
vmAdd() {
VM.add(this.vm, "ModuleModel");
}
/** 显示数据从 MVVM 框架中移除 */
vmRemove() {
VM.remove("ModuleModel");
}
/** 数据层组件移除时,重置所有数据为默认值 */
reset() {
for (var key in this.vm) {
delete this.vm[key];
}
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "f90b89ec-548a-42cd-87c0-a65863491af3",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,23 @@
import { JsonUtil } from "../../../../../extensions/oops-plugin-framework/assets/core/utils/JsonUtil";
/** 策划 Excel 导出的 Json 静态数据 */
export class ModuleTable {
static TableName: string = "配置表文件名";
/** 静态表中一条数据 */
private data: any;
init(id: number) {
var table = JsonUtil.get(ModuleTable.TableName);
this.data = table[id];
this.id = id;
}
/** 数据唯一编号 */
id: number = 0;
/** 数据 */
// get test(): number {
// return this.data.test;
// }
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "60c52974-9781-4174-80c1-ee4aff34a504",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,29 @@
import { _decorator } from "cc";
import { ecs } from "../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@ccclass('ModuleViewComp')
@ecs.register('ModuleView', false)
export class ModuleViewComp extends CCComp {
/** 视图层逻辑代码分离演示 */
start() {
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
// this.on(ModuleEvent.Cmd, this.onHandler, this);
}
/** 全局消息逻辑处理 */
// private onHandler(event: string, args: any) {
// switch (event) {
// case ModuleEvent.Cmd:
// break;
// }
// }
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.destroy();
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "3d3a257d-5259-434a-bfa3-6af80203fad2",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -1,112 +0,0 @@
import { instantiate, Node, Prefab, Vec3 ,v3,resources,SpriteFrame,Sprite,SpriteAtlas} from "cc";
import { UICallbacks } from "../../../../extensions/oops-plugin-framework/assets/core/gui/layer/Defines";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { UIID } from "../common/config/GameUIConfig";
import { smc } from "../common/SingletonModuleComp";
import { HeroModelComp } from "./HeroModelComp";
import { HeroSpine } from "./HeroSpine";
import { HeroViewComp } from "./HeroViewComp";
import { BoxSet } from "../common/config/BoxSet";
import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
import { HeroInfo } from "../common/config/heroSet";
import { MoveToComp } from "../common/ecs/position/MoveTo";
import { Talents } from "../common/config/TalentSet";
import { MonModelComp } from "./MonModelComp";
/** 角色实体 */
@ecs.register(`Hero`)
export class Hero extends ecs.Entity {
// 数据层
HeroModel!: HeroModelComp;
// 视图层
HeroView!: HeroViewComp;
protected init() {
}
destroy(): void {
this.remove(HeroViewComp);
this.remove(MoveToComp);
super.destroy();
}
/** 加载角色 */
load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001,is_call:boolean=false,lv:number=1) {
scale = 1
let box_group=BoxSet.HERO
this.addComponents<ecs.Comp>( HeroModelComp);
var path = "game/heros/"+HeroInfo[uuid].path;
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
var scene = smc.map.MapView.scene;
node.parent = scene.entityLayer!.node!
node.setPosition(pos)
this.hero_init(uuid,node,scale,box_group,is_call,lv)
oops.message.dispatchEvent("hero_load",this)
}
hero_init(uuid:number=1001,node:Node,scale:number=1,box_group=BoxSet.HERO,is_call:boolean=false,lv:number=1){
var hv = node.getComponent(HeroViewComp)!;
// console.log("hero_init",buff)
let hero= HeroInfo[uuid] // 共用英雄数据
let role =smc.heros[uuid]
if(is_call){
role={slv:0,lv:lv}
}
let talents=Talents;
hv.scale = scale;
hv.box_group = box_group;
hv.hero_uuid= uuid;
hv.hero_name= hero.name;
hv.speed =hv.ospeed = hero.speed;
hv.dis = hero.dis;
hv.pw = hero.pw;
hv.pwm= hero.pwm;
hv.pws= hero.pws
hv.apw=hero.apw;
hv.uapw=hero.uapw;
hv.cpw=hero.cpw;
hv.dpw=hero.dpw;
hv.dopw=hero.dopw;
hv.lv = role.lv;
hv.type = hero.type;
let slv= Math.floor(( hv.lv) / 5);
let sklv=slv
if(sklv >= 5) sklv=5;
hv.sk1 = hero.sk1[sklv]
hv.sk2 = hero.sk2[sklv]
hv.sk3 = hero.sk3[sklv]
hv.akc = hero.akc[sklv]
hv.uac = hero.uac[sklv]
hv.crc = hero.crc[sklv]
hv.dgc = hero.dgc[sklv]
hv.akr = hero.akr[sklv]
hv.uar = hero.uar[sklv]
hv.crr = hero.crr[sklv]
hv.dgr = hero.dgr[sklv]
hv.rhp_max=hv.hp= hv.hp_max =(hero.hp+hero.hp_up*hv.lv)*(1+hero.shp_up/100*slv)
hv.ap = (hero.ap+hero.ap_up*hv.lv) *(1+hero.sap_up/100*slv);
hv.def= (hero.def+hero.def_up*hv.lv)*(1+hero.sdef_up/100*slv);
hv.cd = hero.a_cd
hv.crit = hero.crit //暴击率
hv.crit_add = hero.crit_add;//暴击伤害加成
hv.dodge = hero.dodge //闪避率
hv.aexp=hero.aexp
hv.uaexp=hero.uaexp
hv.cexp=hero.cexp
hv.doexp=hero.doexp
hv.dexp=hero.dexp
this.add(hv);
}
}
/** Module 模块业务逻辑系统组件,如无业务逻辑处理可删除此对象 */
export class EcsModuleSystem extends ecs.System {
constructor() {
super();
// this.add(new ecs.ComblockSystem());
}
}

View File

@@ -1 +0,0 @@
{"ver":"4.0.23","importer":"typescript","imported":true,"uuid":"31289da2-91ea-4ffe-85f3-879a3ac7641d","files":[],"subMetas":{},"userData":{}}

View File

@@ -0,0 +1,13 @@
import { Vec3 } from 'cc';
export enum HeroDefault {
DEFAULT_UUID = 1001,
BASE_SCALE = 1,
INIT_LEVEL = 1
}
// 将位置常量作为普通常量导出
export const HERO_POSITION = Vec3.ZERO;
// 路径作为独立常量
export const HERO_PREFAB_PATH = "game/heros/";

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "39ff7cef-ab22-47d4-aa35-f307385ffa99",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,23 @@
import { _decorator, Component, Node, sp, tween, v3, Vec3 } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('HeroController')
export class HeroController extends Component {
@property(sp.Skeleton)
spine: sp.Skeleton = null!; // 绑定spine组件
@property
moveSpeed: number = 200; // 可配置移动速度
// 初始化动画
init(spineData: sp.SkeletonData) {
this.spine.skeletonData = spineData;
this.spine.setAnimation(0, 'Idle', true);
}
// 播放动画方法
playAnimation(name: string, loop: boolean = true) {
this.spine.setAnimation(0, name, loop);
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "f85a719e-f1e0-48ac-920b-121036144be5",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,18 @@
import { _decorator, Component, Node, instantiate, Prefab, resources } from 'cc';
export class HeroManager {
static async createHero(parent: Node) {
const prefab = await this.loadPrefab('prefabs/Hero');
const hero = instantiate(prefab);
parent.addChild(hero);
return hero;
}
private static loadPrefab(path: string): Promise<Prefab> {
return new Promise((resolve, reject) => {
resources.load(path, Prefab, (err, prefab) => {
err ? reject(err) : resolve(prefab!);
});
});
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "7cf87b0a-58f4-4643-8fe0-a19a74737ab9",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -1,23 +0,0 @@
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
/**
* 角色属性数据
*/
@ecs.register('HeroModel')
export class HeroModelComp extends ecs.Comp {
/** 角色编号 */
id: number = -1;
/** 角色名 */
name: string = "mon";
/** speed */
// speed: number = 0;
/** 动画名资源 */
anim: string = "mon";
reset() {
this.id = -1;
// this.speed = 0;
this.name = "";
}
}

View File

@@ -1 +0,0 @@
{"ver":"4.0.23","importer":"typescript","imported":true,"uuid":"c9121e83-b457-492d-aa56-2119d79a3360","files":[],"subMetas":{},"userData":{}}

View File

@@ -1,906 +0,0 @@
/*
* @Author: dgflash
* @Date: 2021-11-18 17:42:59
* @LastEditors: dgflash
* @LastEditTime: 2022-08-17 12:36:18
*/
import { Vec3, _decorator , v3,Collider2D,Contact2DType,Label,RigidBody2D ,Node,Prefab,instantiate,ProgressBar, Component, Material, Sprite, math, clamp, Game, tween} from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { HeroSpine } from "./HeroSpine";
import { HeroModelComp } from "./HeroModelComp";
import { BoxSet, GameSet } from "../common/config/BoxSet";
import { smc } from "../common/SingletonModuleComp";
import { Skill } from "../skills/Skill";
import { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer";
import { SkillCom } from "../skills/SkillCom";
import { SkillSet, SkTG, SkType } from "../common/config/SkillSet";
import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
import { HeroSet } from "../common/config/heroSet";
import { BuffComp } from "./BuffComp";
import { MonModelComp } from "./MonModelComp";
import { getMonsterDrops, MonsterType } from "../common/config/RewardSet";
const { ccclass, property } = _decorator;
/** 角色显示组件 */
@ccclass('HeroViewComp') // 定义为 Cocos Creator 组件
@ecs.register('HeroView', false) // 定义为 ECS 组件
export class HeroViewComp extends CCComp {
BUFFCOMP:BuffComp=null!
enemy_pos:Vec3=null!
// enemy:any=null!;
as: HeroSpine = null!
anm_timer:Timer = new Timer(0.3);
anm_name="idle"
status:String = "idle"
hero_uuid:number = 1001;
hero_name : string = "hero";
lv:number =1;
slv:number =1;
scale: number = 1; /** 角色阵营 1hero -1 :mon */
type: number = 0; /**角色类型 0近战 1 远程 2 辅助 */
box_group:number = BoxSet.HERO;
atk_range:number = 150;
is_dead:boolean = false; //是否摧毁
is_stop:boolean = false;
is_atking:boolean = false;
is_boss:boolean = false;
is_big_boss:boolean = false;
hp: number = 100; /** 血量 */
hp_max: number = 100; /** 最大血量 */
rhp_max: number = 100;
hp_speed: number = 0; //每秒回复量
pw: number = 0; /**能量**/
pwm: number = 15; /** 能量最大值 */
pws: number = 1; //能量回复速度每0.1秒回复量
apw:number=0;
uapw:number=0;
cpw:number=0;
dopw:number=0;
dpw:number=0;
pwt:Timer = new Timer(1); //计时器
sk1:number = 9001;
sk2:number = 1001;
sk3:number = 1001;
akr:number=0; //攻击触发机率
uar:number=0; //受伤触发机率
dgr:number=0; //闪避触发机率
crr:number=0; //暴击触发机率
akc:number=0; //攻击次数触发
uac:number=0; //受伤次数触发
dgc:number=0; //闪避次数触发
crc:number=0; //暴击次数触发
aexp:number=0; //攻击经验
uaexp:number=0; //受伤经验
cexp:number=0; //暴击经验 */
doexp:number=0; //闪避经验 */
dexp:number=0; //死亡经验 */
ap: number = 10; /**攻击力 */
ap_max: number = 0;
ap_buff: number = 0;
ap_buffs:any = [];
// atk_speed: number = 1;
cd: number = 1.3; /**攻击速度 攻击间隔 */
dis: number = 80;
at: number = 0; /** 冷却时间 */
def: number = 0; //防御
def_max: number = 0;
vun: number = 0; //易伤
crit: number = 0; //暴击率
crit_max: number = 0;
crit_add: number = 0;//暴击伤害加成
dodge: number = 10; //闪避率
dodge_max: number = 10; //闪避率
shield:number = 0; //护盾,免伤1次减1
speed: number = 100; /** 角色移动速度 */
ospeed: number = 100; /** 角色初始速度 */
atk_count: number = 0;
atked_count: number = 0;
dodge_count: number = 0;
crit_count: number = 0;
stop_cd: number = 0; /*停止倒计时*/
yun_cd: number = 0; //眩晕倒计时
ice_cd: number = 0; //冰冻倒计时
dir_y:number = 0;
speek_time:number = 0;
onLoad() {
this.as = this.getComponent(HeroSpine);
} /** 视图层逻辑代码分离演示 */
start () {
this.as.idle()
this.BUFFCOMP=this.node.getComponent(BuffComp);
/** 方向 */
this.node.setScale(this.scale,1);
this.node.getChildByName("top").setScale(this.scale,1);
if(this.is_boss){
this.node.setScale(this.node.scale.x*1.5,this.node.scale.y*1.5);
this.node.getChildByName("top").getChildByName("sboss").active = true;
}
/** 显示角色血量 */
this.node.getChildByName("top").getChildByName("hp").active = true;
// this.node.getChildByName("shielded").active = false;
// this.node.getChildByName("top").setScale(this.scale,1);
// this.node.getChildByName("atk").setScale(this.scale,1);
// this.node.getChildByName("atk").getComponent(Label).string = this.ap.toString();
// this.node.getChildByName("hp_max").setScale(this.scale,1);
// this.node.getChildByName("hp_max").getComponent(Label).string=this.hp_max.toString();
// 注册单个碰撞体的回调函数
let collider = this.getComponent(Collider2D);
collider.group = this.box_group;
// console.log("hero collider ",this.scale,collider);
if (collider) {
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
// collider.on(Contact2DType.END_CONTACT, this.onEndContact, this);
collider.on(Contact2DType.PRE_SOLVE, this.onPreSolve, this);
// collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);
}
}
onBeginContact (seCol: Collider2D, oCol: Collider2D) {
if(oCol.tag==BoxSet.SKILL_TAG&&seCol.group != oCol.group){
let skill = oCol.node.getComponent(SkillCom)!;
// console.log(Date.now()+this.hero_name+":"+this.uuid+' onBeginContact: '+skill.s_name+skill.uuid);
if(this.hp <= 0 ) return
if(skill.tg< 3) return
this.check_uatk(skill);
}
}
onEndContact (seCol: Collider2D, oCol: Collider2D) {
}
onPreSolve (seCol: Collider2D, oCol: Collider2D) {
let se_x = seCol.node.position.x;
let ot_x = oCol.node.position.x;
let oCom= oCol.node.getComponent(HeroViewComp)
if(seCol.group == oCol.group&&seCol.tag==oCol.tag){
if(seCol.group==BoxSet.HERO){
if(oCom.type == this.type&&oCom.yun_cd<=0&&oCom.ice_cd<=0 && se_x < ot_x && Math.abs(ot_x-se_x) < 40 ){
// this.node.setSiblingIndex(oCol.node.getSiblingIndex()-10)
this.stop_cd = 0.1;
}
}
if(seCol.group==BoxSet.MONSTER){
if(oCom.type == this.type&&oCom.yun_cd<=0&&oCom.ice_cd<=0 && se_x > ot_x && Math.abs(ot_x-se_x) < 40 ){
// this.node.setSiblingIndex(oCol.node.getSiblingIndex()-10)
this.stop_cd = 0.1;
}
}
}
if(seCol.group != oCol.group&&oCol.tag == 0){
this.stop_cd = 0.1;
this.is_atking=true
}
}
onPostSolve (seCol: Collider2D, oCol: Collider2D) {
}
update(dt: number){
if(!smc.mission.play||smc.mission.pause) return
if(this.is_dead) {
if(!this.in_grave()) this.to_grave()
return
}
if (this.pwt.update(dt)) {
this.pw+=this.pws
}
this.check_power()
this.check_atk_counts()
this.check_enemy_alive()
this.check_mission_buff()
this.hp_show()
if(this.ice_cd > 0){
this.ice_cd -=dt;
return
}
if(this.yun_cd > 0){
this.yun_cd -=dt;
return
}
this.at += dt;
this.in_stop(dt);
this.in_atk(dt);
this.move(dt);
}
hp_show(){
let hp_progress= this.hp/this.rhp_max;
this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
if(this.is_boss) return
if(this.hp == this.rhp_max){
this.node.getChildByName("top").getChildByName("hp").active = false;
} else{
this.node.getChildByName("top").getChildByName("hp").active = true;
}
}
//移动
move(dt: number){
if(this.stop_cd > 0||smc.mission.is_victory||smc.mission.is_defeat){
this.status_change("idle")
return
}
if (this.node.position.x >= 300 && this.scale==1) {
return;
}
if(this.scale===-1&&this.node.position.x <= -300){
return;
}
this.status_change("move")
// if(this.enemy){
// return
// }
this.node.setPosition(this.node.position.x+dt*this.speed*this.scale, this.node.position.y+dt*this.dir_y, this.node.position.z);
}
check_mission_buff(){
this.ap_max=(100+smc.vmdata.mission.ap)/100*this.ap
this.crit_max=(100+smc.vmdata.mission.crit)/100*this.crit
this.def_max=(100+smc.vmdata.mission.def)/100*this.def
this.dodge_max=(100+smc.vmdata.mission.dodge)/100*this.dodge
this.rhp_max=(100+smc.vmdata.mission.hp)/100*this.hp_max
if(this.box_group == BoxSet.MONSTER){
this.ap_max=(100+smc.vmdata.mission.map)/100*this.ap
this.crit_max=(100+smc.vmdata.mission.mcrit)/100*this.crit
this.def_max=(100+smc.vmdata.mission.mdef)/100*this.def
this.dodge_max=(100+smc.vmdata.mission.mdodge)/100*this.dodge
this.rhp_max=(100+smc.vmdata.mission.mhp)/100*this.hp_max
}
}
check_enemy_alive(){
// let dir = 720
// let enemys=smc.enemy_pos
// this.enemy = v3(720,this.node.position.y)
// if(this.box_group == BoxSet.MONSTER){
// enemys=smc.hero_pos
// // console.log("MONSTER enemys",enemys);
// this.enemy=v3(-720,this.node.position.y)
// }
// for (let i = 0; i < enemys.length; i++) {
// let ho:any = enemys[i];
// let x=Math.abs(ho.x-this.node.position.x)
// if(x < dir){
// dir = x
// this.enemy = ho
// }
// }
let dir = Math.abs(smc.mon_front_x-this.node.position.x)
if(this.box_group == BoxSet.MONSTER){
dir = Math.abs(smc.hero_front_x-this.node.position.x)
}
if(dir < this.dis){
this.is_atking=true
if(this.dis-dir > 80 &&this.type > 0 ) this.stop_cd = 0.1
if(dir < 65 &&this.type == 0 ) this.stop_cd = 0.1
}else{
this.is_atking=false
}
}
//状态切换
status_change(type:string){
this.status=type
if(type == "idle"){
this.as.idle()
// this.as.change_default("idle")
}
if(type == "move"){
this.as.move()
// this.as.change_default("move")
}
}
//受伤判断
check_uatk(skill:any){
if(this.check_dodge()) return
this.in_atked();
let l_hp=this.check_less(skill.ap,skill.is_crit,skill.crit_add)
this.check_debuff(skill,l_hp)
if(this.shield > 0){
this.shield -=1
if(this.shield == 0) this.BUFFCOMP.show_shield(false)
l_hp = 0
}
this.hp_less(l_hp,skill.is_crit);
}
check_less(ap:number,is_crit:boolean,crit_add:number=0){
let d=this.def_max/ap
if(d > 1) d = 1
let l_hp=ap*(1-d*GameSet.DEF_RATE) //防御最高减免伤害比率计算
if(is_crit){
l_hp = l_hp * (150+crit_add)/100
}
let luck = RandomManager.instance.getRandomInt(-10,10)
l_hp=l_hp*(100+luck)/100
return Math.ceil(l_hp)
}
/**
* 检查并处理英雄受到的减益效果debuff
* 根据技能的不同减益类型,执行相应的逻辑,如冰冻、燃烧等。
*
* @param skill - 包含减益效果信息的技能对象
* @param l_hp - 可选参数表示英雄的当前生命值默认为0
*/
check_debuff(skill:any,l_hp:number=0){
// console.log(this.hero_name+this.uuid+": skillname: "+skill.s_name+" :check_debuff "+skill.debuff);
if(skill.debuff == 0) return
let num=RandomManager.instance.getRandomInt(0,100)
switch (skill.debuff){
case 1:
// console.log(this.hero_name+":"+this.uuid+"冰冻触判断: i="+num+":rate="+skill.rate);
if(num > skill.depb) return
// console.log(this.hero_name+":"+this.uuid+"冰冻触成功: i="+num+":debtime="+skill.debtime);
this.ice_cd = skill.debtime
this.BUFFCOMP.in_iced(skill.debtime)
break;
case 2:
if(num > skill.depb) return
// console.log(this.hero_name+":"+this.uuid+"debuff触发成功 i="+num+":debtime="+skill.debtime+":l_hp="+l_hp);
this.BUFFCOMP.in_fired(skill.debtime,l_hp*skill.derate/100)
break;
case 3:
if(num > skill.depb) return
this.yun_cd = skill.debtime
this.BUFFCOMP.in_yun(skill.debtime)
break;
case 4:
if(num > skill.depb) return
this.BUFFCOMP.buff_get("deap")
this.ap = this.ap-Math.floor(l_hp*skill.derate/100)
break;
case 5:
if(num > skill.depb) return
break;
case 6:
if(num > skill.depb) return
break;
case 7:
if(num > skill.depb) return
break;
case 8:
if(num > skill.depb) return
if(this.node.position.x > 300||this.node.position.x < -300) return
tween(this.node).to( 0.1,
{ position: new Vec3(this.node.position.x-this.scale*50,this.node.position.y) },
{ }
).start();
break;
}
}
//暴击判断
/**
* 检查是否触发暴击,并执行相应的暴击效果。
* @returns {boolean} 如果触发暴击则返回 true否则返回 false。
* 该方法首先通过 RandomManager 获取一个随机数如果该随机数小于当前暴击最大值crit_max
* 则触发暴击效果,包括显示暴击提示、增加暴击计数、增加暴击经验以及增加暴击威力。
* 如果未触发暴击,则直接返回 false。
*/
check_crit():boolean
{
let i = RandomManager.instance.getRandomInt(0,100,3)
if(i < this.crit_max){
// this.BUFFCOMP.tooltip(5,"*会心一击*");
this.crit_count += 1
this.exp_add(this.cexp) // 暴击经验
this.power_add(this.cpw)
return true
}else{
return false
}
}
//闪避判断
/**
* 检查并处理角色的闪避逻辑。
* 生成一个随机数,如果小于角色的最大闪避值,则触发闪避效果,增加经验、能量,并更新闪避计数。
* @returns {boolean} 如果触发闪避则返回true否则返回false。
*/
check_dodge():boolean
{
let i = RandomManager.instance.getRandomInt(0,100,3)
if(this.dodge_max > GameSet.DODGE_MAX) this.dodge_max = GameSet.DODGE_MAX
if(i < this.dodge_max){
// console.log("闪避触发: i="+i+":dodge="+dodge);
this.BUFFCOMP.tooltip(5,"闪避");
this.exp_add(this.doexp) // 闪避经验
this.power_add(this.dopw)
this.dodge_count += 1
return true
}else{
return false
}
}
/**
* 检查并处理角色的攻击、闪避、暴击和受伤计数。
* 当计数达到一定值时,会触发相应的技能效果,并重置计数。
* 触发效果包括激活名为"max"的节点并在0.8秒后关闭。
* 使用do_skill方法处理触发的技能。
*/
check_atk_counts() {
if (this.atk_count >= this.akc) {
this.atk_count = 0
// console.log("atk_count 清零:"+this.atk_count);
let i = RandomManager.instance.getRandomInt(0,100,3)
// console.log("攻击判断: i="+i+":akr="+this.akr);
if(i < this.akr){
// console.log("攻击触发: i="+i+":akr="+this.akr);
// this.BUFFCOMP.max_show()
this.do_skill(this.sk3)
}
}
if(this.dodge_count >= this.dgc){
this.dodge_count = 0
// console.log("dodge_count 清零:"+this.dodge_count);
let i = RandomManager.instance.getRandomInt(0,100,3)
// console.log("闪避判断: i="+i+":dgr="+this.dgr);
if(i < this.dgr){
// console.log("闪避触发: i="+i+":dgr="+this.dgr);
// this.BUFFCOMP.max_show()
this.do_skill(this.sk3)
}
}
if(this.crit_count >= this.crc){
this.crit_count = 0
// console.log("crit_count 清零:"+this.crit_count);
let i = RandomManager.instance.getRandomInt(0,100,3)
// console.log("暴击判断: i="+i+":crr="+this.crr);
if(i < this.crr){
// console.log("暴击触发: i="+i+":crr="+this.crr);
// this.BUFFCOMP.max_show()
this.do_skill(this.sk3)
}
}
if(this.atked_count >= this.uac){
this.atked_count = 0
let i = RandomManager.instance.getRandomInt(0,100,3)
// console.log("受伤判断i="+i+":akr="+this.uar);
if(i < this.uar){
// console.log("受伤触发: i="+i+":uar="+this.uar);
// this.BUFFCOMP.max_show()
this.do_skill(this.sk3)
}
}
}
in_atk(dt: number) {
if(this.at >= this.cd){
if(this.is_atking){
this.at = 0;
this.atk_count++
this.exp_add(this.aexp) //攻击经验
this.power_add(this.apw)
// console.log("cd:"+this.cd);
this.as.atk();
this.scheduleOnce(()=>{
this.shoot_enemy(this.sk1)
},0.3)
}
}
}
//能量判断
check_power(){
if(this.pw >= this.pwm){
this.pw = 0
this.BUFFCOMP.max_show()
this.do_skill(this.sk2)
return true
}else{
return false
}
}
//使用max_skill
do_skill(skill:number){
// this.at = 0; //共享普攻攻击cd
this.BUFFCOMP.tooltip(3,SkillSet[skill].name,skill);
if(SkillSet[skill].flash){
this.as.max()
this.scheduleOnce(()=>{
this.BUFFCOMP.show_do_buff(SkillSet[skill].fname)
},0.1)
}
switch (SkillSet[skill].tg) {
case SkTG.self: //自己
this.do_add_buff(this.node.getComponent(HeroViewComp),skill)
break;
case SkTG.friend: //伙伴
if(this.box_group == BoxSet.HERO) this.check_other_hero_buff(skill)
if(this.box_group == BoxSet.MONSTER) this.check_other_mon_buff(skill)
break;
case SkTG.team: //自己和伙伴
this.do_all_buff(skill)
break;
case SkTG.enemy: //敌人
this.shoot_enemy(skill)
break;
case SkTG.all: //敌人和自己
this.do_add_buff(this.node.getComponent(HeroViewComp),skill)
this.shoot_enemy(skill)
break;
}
}
shoot_enemy(sk:number,y:number=0,x:number=0){
// console.log("mon shoot_enemy");
let skill = ecs.getEntity<Skill>(Skill);
let t_pos=v3(smc.mon_front_x,BoxSet.GAME_LINE) //最前排目标
if(this.box_group==BoxSet.MONSTER){
t_pos=v3(smc.hero_front_x,BoxSet.GAME_LINE)
}
switch(SkillSet[sk].type){
case SkType.leastHealth: //血量最少单体
t_pos=this.check_heros().l_hero.node.position
if(this.box_group==BoxSet.MONSTER) t_pos=this.check_mons().l_hero.node.position
break;
case SkType.highestHealth: //血量最多单体
t_pos=this.check_heros().m_hero.node.position
if(this.box_group==BoxSet.MONSTER) t_pos=this.check_mons().m_hero.node.position
break;
case SkType.backRow: //最后排
t_pos=v3(smc.mon_back_x,BoxSet.GAME_LINE)
if(this.box_group==BoxSet.MONSTER){
t_pos=v3(smc.hero_back_x,BoxSet.GAME_LINE)
}
break;
}
let pos =this.node.position
let is_crit=this.check_crit()
this.to_console(this.scale+this.hero_name+"使用技能:"+sk+SkillSet[sk].name+" pos:"+pos+" t_pos:"+t_pos+" box:"+this.box_group,);
skill.load(pos,this.box_group,this.node,sk,this.ap_max,t_pos,is_crit,this.crit_add,this.rhp_max);
}
check_heros(){
let heros:any = ecs.query(ecs.allOf(HeroModelComp));
let l_hp:number=0
let h_hp:number=9999999999
let right_x:number=360
let left_x:number=-360
let f_hero:any= null
let b_hero:any= null
let l_hero:any= null
let m_hero:any= null
let r_hero:any= null
let i = RandomManager.instance.getRandomInt(0,heros.length-1,3)
while(!heros[i].HeroView){
i = RandomManager.instance.getRandomInt(0,heros.length-1,3)
if(!heros[i].HeroView.in_grave){
r_hero= heros[i].HeroView
break
}
}
for (let i = 0; i < heros.length; i++) {
let hero:any = heros[i].HeroView;
if (hero.in_grave) continue
if((hero.rhp_max-hero.hp) > l_hp){
l_hp = (hero.rhp_max-hero.hp)
l_hero = hero
}
if((hero.rhp_max-hero.hp) < h_hp){
h_hp = (hero.rhp_max-hero.hp)
m_hero = hero
}
if(hero.node.position.x > left_x){
left_x = hero.node.position.x
f_hero = hero
}
if(hero.node.position.x < right_x){
right_x = hero.node.position.x
b_hero = hero
}
}
return {l_hero,m_hero,f_hero,b_hero,r_hero}
}
check_mons(){
let heros:any=ecs.query(ecs.allOf(MonModelComp))
let l_hp:number=0
let h_hp:number=9999999999
let right_x:number=360
let left_x:number=-360
let f_hero:any= null
let b_hero:any= null
let l_hero:any= null
let m_hero:any= null
let r_hero:any= null
let i = RandomManager.instance.getRandomInt(0,heros.length-1,3)
while(!heros[i].HeroView){
i = RandomManager.instance.getRandomInt(0,heros.length-1,3)
if(!heros[i].HeroView.in_grave){
r_hero= heros[i].HeroView
break
}
}
for (let i = 0; i < heros.length; i++) {
let hero:any = heros[i].HeroView;
if (hero.in_grave) continue
if((hero.rhp_max-hero.hp) > l_hp){
l_hp = (hero.rhp_max-hero.hp)
l_hero = hero
}
if((hero.rhp_max-hero.hp) < h_hp){
h_hp = (hero.rhp_max-hero.hp)
m_hero = hero
}
if(hero.node.position.x < right_x){
right_x = hero.node.position.x
f_hero = hero
}
if(hero.node.position.x > left_x){
left_x = hero.node.position.x
b_hero = hero
}
}
return {l_hero,m_hero,f_hero,b_hero,r_hero}
}
check_other_hero_buff(skill:number){
switch(SkillSet[skill].type){
case SkType.random:
this.do_add_buff(this.check_heros().r_hero,skill)
break;
case SkType.leastHealth: //血量最少单体
this.do_add_buff(this.check_heros().l_hero,skill)
break;
case SkType.highestHealth: //血量最多单体
this.do_add_buff(this.check_heros().m_hero,skill)
break;
case SkType.frontRow: //最前排
this.do_add_buff(this.check_heros().f_hero,skill)
break;
case SkType.backRow: //最后排
this.do_add_buff(this.check_heros().b_hero,skill)
break;
}
}
check_other_mon_buff(skill:number){
switch(SkillSet[skill].type){
case SkType.random:
this.do_add_buff(this.check_mons().r_hero,skill)
break;
case SkType.leastHealth: //血量最少单体
this.do_add_buff(this.check_mons().l_hero,skill)
break;
case SkType.highestHealth: //血量最多单体
this.do_add_buff(this.check_mons().m_hero,skill)
break;
case SkType.frontRow: //最前排
this.do_add_buff(this.check_mons().f_hero,skill)
break;
case SkType.backRow: //最后排
this.do_add_buff(this.check_mons().b_hero,skill)
break;
}
}
do_all_buff(sk:number){
let skill = ecs.getEntity<Skill>(Skill);
let pos=v3(0,0)
let t_pos = pos
// this.to_console("to_all_buff:"+sk)
let is_crit=this.check_crit()
skill.load(pos,this.box_group,this.node,sk,this.ap_max,t_pos,is_crit,this.crit_add,this.rhp_max);
// this.to_console("使用buff:"+sk+" t_pos:"+t_pos+" box:"+this.box_group);
}
do_add_buff(hero:any,sk:number){
let skill = ecs.getEntity<Skill>(Skill);
let t_pos=hero.node.position
let pos = this.node.position
// this.to_console("do_add_buff:"+hero.hero_name+" "+sk);
let is_crit=this.check_crit()
skill.load(pos,this.box_group,this.node,sk,this.ap_max,t_pos,is_crit,this.crit_add,this.rhp_max);
// this.to_console(this.scale+this.hero_name+"使用buff:"+sk+SkillSet[sk].name+" t_pos:"+t_pos+" box:"+this.box_group,);
}
exp_add(exp:number=0){
if(this.box_group==BoxSet.HERO){
smc.vmdata.mission.exp +=exp
}
if(this.box_group==BoxSet.MONSTER){
smc.vmdata.mission.mexp +=exp
}
}
power_add(p:number){
this.pw+= p
}
add_shield(shield:number){
this.shield =shield
if(this.shield>0) this.BUFFCOMP.show_shield(true)
}
// add_cd(cd: number){
// this.cd += this.cd*((100-cd)/100);
// this.BUFFCOMP.buff_get("cd")
// }
/**
* 增加英雄的攻击AP
* @param ap 要增加的攻击。
*/
add_ap(ap: number){
this.ap += Math.floor(ap);
this.BUFFCOMP.buff_get("ap")
}
de_ap(ap: number){
this.ap -= Math.floor(ap);
this.BUFFCOMP.buff_get("deap")
}
add_def(def: number){
this.def += Math.floor(def);
this.BUFFCOMP.buff_get("def")
}
de_def(def: number){
this.def -= Math.floor(def);
this.BUFFCOMP.buff_get("dedef")
}
/**
* 增加英雄的暴击率。
* @param crit 要增加的暴击率。
*/
add_crit(critRate: number) {
this.crit += Math.floor(critRate);
this.BUFFCOMP.buff_get("crit");
}
de_crit(critRate: number) {
this.crit += Math.floor(critRate);
this.BUFFCOMP.buff_get("decrit");
}
/**
* 增加英雄的闪避率。
* @param dodge 要增加的闪避率。
*/
add_dodge(dodgeRate: number) {
this.dodge += Math.floor(dodgeRate);
this.BUFFCOMP.buff_get("dodge");
}
de_dodge(dodgeRate: number) {
this.dodge += Math.floor(dodgeRate);
this.BUFFCOMP.buff_get("dedodge");
}
add_hp_max(hprate: number=0){
this.BUFFCOMP.buff_get("hp")
this.hp_max += Math.floor(hprate/100*this.rhp_max) ;
this.add_hp2(hprate)
}
de_hp_max(hprate: number=0){
this.BUFFCOMP.buff_get("dehp")
this.hp_max -= Math.floor(hprate/100*this.rhp_max) ;
}
add_hp(hp: number = 0) {
this.BUFFCOMP.heathed();
this.hp+=Math.floor(hp);
if(this.hp > this.rhp_max){
this.hp = this.rhp_max;
}
this.BUFFCOMP.tooltip(2,hp.toFixed(0));
}
add_hp2(hprate: number=0){
this.hp += Math.floor(hprate/100*this.hp_max) ;
}
hp_less(hp: number,is_crit:boolean=false){
if(this.is_dead) return
hp=Math.floor(hp)
this.hp -= hp
if(is_crit){
this.BUFFCOMP.tooltip(4,hp.toFixed(0),250);
}else{
this.BUFFCOMP.tooltip(1,hp.toFixed(0),250);
}
if(this.hp > this.rhp_max){
this.hp = this.rhp_max;
}
if(this.hp <= 0){
this.dead();
this.to_grave()
this.is_dead = true;
}
}
/** 静止时间 */
in_stop (dt: number) {
if(this.stop_cd > 0){
this.stop_cd -= dt;
if(this.stop_cd <= 0){
this.stop_cd = 0;
this.is_atking = false;
}
}
}
in_atked() {
this.BUFFCOMP.in_atked()
// this.as.atked();
this.atked_count++;
this.exp_add(this.uaexp)
this.power_add(this.uapw)
}
dead(){
this.BUFFCOMP.dead()
this.exp_add(this.dexp)
this.power_add(this.dpw)
this.to_drop()
}
//掉落物品
to_drop(){
let Drops = getMonsterDrops(1, MonsterType.Normal, 1.2);
if(this.is_boss) Drops =getMonsterDrops(1, MonsterType.Elite, 1.2);
if(this.is_big_boss) Drops =getMonsterDrops(1, MonsterType.Boss, 1.2);
// console.log("掉落物品:",Drops);
//根据掉落类型和uuid 写入用户数据文件SingletonModuleComp =smc英雄碎片对应smc.heros[uuid].num,smc.heros[uuid].x1 记录本局掉落的数量,也需要添加对应值
//金币uuid=9001 对应smc.vmdata.gold.num,宝箱uuid1003,对应smc.vmdata.box.num smc.itmes[9001].x1,smc.itmes[1003].x1 记录本局
for (let i = 0; i < Drops.length; i++) {
const drop = Drops[i];
if(drop.type == 1 ){ //英雄碎片
smc.heros[drop.uuid].num += drop.num
smc.heros[drop.uuid].x1 += drop.num
}
if(drop.type==2){
if(drop.uuid == 9001){
smc.vmdata.gold.num+=drop.num
smc.items[9001].x1+=drop.num
}
if(drop.uuid == 1003){
smc.vmdata.box.num+=drop.num
smc.items[1003].x1+=drop.num
}
}
}
}
//进入墓地
to_grave(){
let pos =v3(-999,this.node.position.y)
if(this.box_group == BoxSet.MONSTER){
pos =v3(999,this.node.position.y)
smc.vmdata.mission.mdead +=1
}else{
smc.vmdata.mission.dead +=1
}
this.node.setPosition(pos)
}
//是否在墓地
in_grave(){
return this.node.position.x < -900 || this.node.position.x > 900;
}
to_alive(){
let pos =v3(HeroSet.StartPos[this.type],this.node.position.y,this.node.position.z)
this.node.setPosition(pos)
}
to_console(value:any,value2:any=null,value3:any=null){
console.log("["+this.scale+this.hero_name+']'+value,value2,value3)
}
reset() {
this.is_dead = false;
this.node.destroy();
}
}

View File

@@ -1 +0,0 @@
{"ver":"4.0.23","importer":"typescript","imported":true,"uuid":"873f877e-4a89-4c12-8f03-8934f1651878","files":[],"subMetas":{},"userData":{}}

View File

@@ -1,133 +0,0 @@
/*
* @Author: dgflash
* @Date: 2021-11-18 17:47:56
* @LastEditors: dgflash
* @LastEditTime: 2022-08-04 15:43:04
*/
import { instantiate, Node, Prefab, Vec3 ,v3,resources,SpriteFrame,Sprite,SpriteAtlas} from "cc";
import { UICallbacks } from "../../../../extensions/oops-plugin-framework/assets/core/gui/layer/Defines";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { UIID } from "../common/config/GameUIConfig";
import { smc } from "../common/SingletonModuleComp";
import { HeroModelComp } from "./HeroModelComp";
import { HeroSpine } from "./HeroSpine";
import { HeroViewComp } from "./HeroViewComp";
import { BoxSet } from "../common/config/BoxSet";
import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
import { HeroInfo } from "../common/config/heroSet";
import { MoveToComp } from "../common/ecs/position/MoveTo";
import { Talents } from "../common/config/TalentSet";
import { MonModelComp } from "./MonModelComp";
/** 角色实体 */
@ecs.register(`Monster`)
export class Monster extends ecs.Entity {
// 数据层
MonModelComp!: MonModelComp;
// 视图层
HeroView!: HeroViewComp;
protected init() {
}
destroy(): void {
this.remove(HeroViewComp);
this.remove(MoveToComp);
super.destroy();
}
/** 加载角色 */
load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001,is_boss:boolean=false,is_call:boolean=false,lv:number=1) {
scale=-1
let box_group=BoxSet.MONSTER
console.log("mon load",uuid)
this.addComponents<ecs.Comp>( MonModelComp);
var path = "game/heros/"+HeroInfo[uuid].path;
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
var scene = smc.map.MapView.scene;
node.parent = scene.entityLayer!.node!
node.setPosition(pos)
this.hero_init(uuid,node,scale,box_group,is_boss,is_call,lv)
oops.message.dispatchEvent("monster_load",this)
}
hero_init(uuid:number=1001,node:Node,scale:number=1,box_group=BoxSet.HERO,is_boss:boolean=false,is_call:boolean=false,lv:number=1) {
var hv = node.getComponent(HeroViewComp)!;
// console.log("hero_init",buff)
let hero= HeroInfo[uuid] // 共用英雄数据
let talent= smc.vmdata.talent //角色英雄数据
let talents=Talents;
hv.scale = scale;
hv.is_boss = is_boss;
hv.box_group = box_group;
hv.hero_uuid= uuid;
hv.hero_name= hero.name;
hv.speed =hv.ospeed = hero.speed;
hv.dis = hero.dis;
hv.pw = hero.pw;
hv.pwm= hero.pwm;
hv.pws= hero.pws
hv.apw=hero.apw;
hv.uapw=hero.uapw;
hv.cpw=hero.cpw;
hv.dpw=hero.dpw;
hv.dopw=hero.dopw;
hv.lv = lv;
let slv= Math.floor(( hv.lv) / 5);
let sklv=slv
if(sklv >= 5) sklv=5;
hv.type = hero.type;
hv.sk1 = hero.sk1[sklv];
hv.sk2 = hero.sk2[sklv];
hv.sk3 = hero.sk3[sklv];
hv.akc = hero.akc[sklv];
hv.uac = hero.uac[sklv];
hv.crc = hero.crc[sklv];
hv.dgc = hero.dgc[sklv];
hv.akr = hero.akr[sklv];
hv.uar = hero.uar[sklv];
hv.crr = hero.crr[sklv];
hv.dgr = hero.dgr[sklv];
hv.rhp_max=hv.hp= hv.hp_max =(hero.hp+hero.hp_up*hv.lv)*(1+hero.shp_up/100*slv);
hv.ap = (hero.ap+hero.ap_up*hv.lv) *(1+hero.sap_up/100*slv);
hv.def= (hero.def+hero.def_up*hv.lv)*(1+hero.sdef_up/100*slv);
hv.cd = hero.a_cd
hv.crit = hero.crit; //暴击率
hv.crit_add = hero.crit_add;//暴击伤害加成
hv.dodge = hero.dodge; //闪避率
hv.aexp=hero.aexp;
hv.uaexp=hero.uaexp;
hv.cexp=hero.cexp
hv.doexp=hero.doexp
hv.dexp=hero.dexp;
this.add(hv);
}
set_ratio(uuid:number){
let ratio=1;
switch (HeroInfo[uuid].level) {
case 2:
ratio=1.05
break;
case 3:
ratio=1.1
break;
case 4:
ratio=1.15
break;
case 5:
ratio=1.2
break;
default:
ratio=1
}
return ratio;
}
}

View File

@@ -1 +0,0 @@
{"ver":"4.0.23","importer":"typescript","imported":true,"uuid":"c1d7128f-5af5-4f7c-b4a1-6bb6fd4f12e0","files":[],"subMetas":{},"userData":{}}

View File

@@ -1,29 +0,0 @@
/*
* @Author: dgflash
* @Date: 2021-11-18 15:56:01
* @LastEditors: dgflash
* @LastEditTime: 2022-08-17 13:43:25
*/
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
/**
* 角色属性数据
*/
@ecs.register('MonModel')
export class MonModelComp extends ecs.Comp {
/** 角色编号 */
id: number = -1;
/** 角色名 */
name: string = "mon";
/** speed */
// speed: number = 0;
/** 动画名资源 */
anim: string = "mon";
reset() {
this.id = -1;
// this.speed = 0;
this.name = "";
}
}