新hero 基本完成

This commit is contained in:
2024-09-11 08:02:49 +08:00
parent a10e2a43be
commit 0f7f2ad49b
21 changed files with 722 additions and 1796 deletions

View File

@@ -2,11 +2,34 @@
CardList type: 1:精灵 2:技能 3:装备
*/
export const CardList=[
// {uuid:1101,type:1},{uuid:1102,type:1},{uuid:1103,type:1},{uuid:1104,type:1},{uuid:1105,type:1},{uuid:1106,type:1},{uuid:1107,type:1},
// {uuid:1108,type:1},{uuid:1109,type:1},{uuid:1110,type:1},{uuid:1113,type:1},{uuid:1114,type:1},{uuid:1115,type:1},{uuid:1116,type:1},
export const CardList={
1:[
{uuid:9001,type:1},{uuid:9002,type:1},{uuid:9003,type:1},{uuid:9004,type:1},{uuid:9005,type:1},{uuid:9006,type:1},
// {uuid:9007,type:1},{uuid:9008,type:1},{uuid:9009,type:1},{uuid:9010,type:1},{uuid:9011,type:1},{uuid:9012,type:1},
],
2:[
{uuid:9001,type:1},{uuid:9002,type:1},{uuid:9003,type:1},{uuid:9004,type:1},{uuid:9005,type:1},{uuid:9006,type:1},
// {uuid:9007,type:1},{uuid:9008,type:1},{uuid:9009,type:1},{uuid:9010,type:1},{uuid:9011,type:1},{uuid:9012,type:1},
],
3:[
{uuid:9001,type:1},{uuid:9002,type:1},{uuid:9003,type:1},{uuid:9004,type:1},{uuid:9005,type:1},{uuid:9006,type:1},
// {uuid:9007,type:1},{uuid:9008,type:1},{uuid:9009,type:1},{uuid:9010,type:1},{uuid:9011,type:1},{uuid:9012,type:1},
],
4:[
{uuid:1001,type:2},{uuid:1002,type:2},{uuid:4011,type:2},{uuid:4012,type:2},
{uuid:6001,type:3},{uuid:6004,type:3},{uuid:6101,type:3},{uuid:6002,type:3},{uuid:6003,type:3},{uuid:6005,type:3},{uuid:6006,type:3},{uuid:6102,type:3},{uuid:6103,type:3},
{uuid:6210,type:3},{uuid:6213,type:3},{uuid:6216,type:3},{uuid:6211,type:3},{uuid:6212,type:3},{uuid:6214,type:3},{uuid:6215,type:3},{uuid:6217,type:3},{uuid:6218,type:3},
]
{uuid:6001,type:3},{uuid:6004,type:3},{uuid:6101,type:3},{uuid:6002,type:3},{uuid:6003,type:3},{uuid:6005,type:3},{uuid:6006,type:3},
{uuid:6102,type:3},{uuid:6103,type:3}, {uuid:6210,type:3},{uuid:6213,type:3},{uuid:6216,type:3},{uuid:6211,type:3},{uuid:6212,type:3},
{uuid:6214,type:3},{uuid:6215,type:3},{uuid:6217,type:3},{uuid:6218,type:3},
],
5:[
{uuid:9001,type:1},{uuid:9002,type:1},{uuid:9003,type:1},{uuid:9004,type:1},{uuid:9005,type:1},{uuid:9006,type:1},
// {uuid:9007,type:1},{uuid:9008,type:1},{uuid:9009,type:1},{uuid:9010,type:1},{uuid:9011,type:1},{uuid:9012,type:1},
],
6:[
{uuid:1001,type:2},{uuid:1002,type:2},{uuid:4011,type:2},{uuid:4012,type:2},
{uuid:6001,type:3},{uuid:6004,type:3},{uuid:6101,type:3},{uuid:6002,type:3},{uuid:6003,type:3},{uuid:6005,type:3},{uuid:6006,type:3},
{uuid:6102,type:3},{uuid:6103,type:3}, {uuid:6210,type:3},{uuid:6213,type:3},{uuid:6216,type:3},{uuid:6211,type:3},{uuid:6212,type:3},
{uuid:6214,type:3},{uuid:6215,type:3},{uuid:6217,type:3},{uuid:6218,type:3},
],
}

View File

@@ -1,31 +1,22 @@
export const HeroSet={
1101:{uuid: 1101,path: 1101,type: 1,level: 1,name: "守护犬",atk: 4,hp: 24,atk_cd: 2,power: 50,speed: 30,
9001:{uuid: 9001,path: "k1",type: 1,level: 1,name: "战士1",atk: 4,hp: 24,atk_cd: 2,power: 50,speed: 30,
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001,word: "守护",info: "自身护盾", atktype: "攻击型",mon: "狗"},
1102:{uuid: 1102,path: 1102,type: 2,level: 1,name: "羊咩咩",atk: 2,hp: 48,atk_cd: 2,power: 50,speed: 30,
9002:{uuid: 9002,path: "k2",type: 2,level: 1,name: "战士2",atk: 2,hp: 48,atk_cd: 2,power: 50,speed: 30,
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001,word: "守护",info: "自身护盾", atktype: "血量型",mon: "绵羊"},
1103:{uuid: 1103,path: 1103,type: 1,level: 1,name: "战斗蚁",atk: 4,hp: 24,atk_cd: 2,power: 50,speed: 30,
9003:{uuid: 9003,path: "k3",type: 1,level: 1,name: "战士3",atk: 4,hp: 24,atk_cd: 2,power: 50,speed: 30,
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001, atktype: "攻击型",mon: "蚂蚁"},
1104:{uuid: 1104,path: 1104,type: 1,level: 1,name: "搬运蚁",atk: 4,hp: 24,atk_cd: 2,power: 50,speed: 30,
9004:{uuid: 9004,path: "m1",type: 1,level: 1,name: "魔法师1",atk: 4,hp: 24,atk_cd: 2,power: 50,speed: 30,
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001, atktype: "攻击型",mon: "蚂蚁"},
1105:{uuid: 1105,path: 1105,type: 3,level: 1,name: "闪电鼠",atk: 3,hp: 18,atk_cd: 1,power: 50,speed: 30,
9005:{uuid: 9005,path: "m2",type: 3,level: 1,name: "魔法师2",atk: 3,hp: 18,atk_cd: 1,power: 50,speed: 30,
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001, atktype: "攻速型",mon: "鼠"},
1106:{uuid: 1106,path: 1106,type: 3,level: 1,name: "闪电喵",atk: 3,hp: 18,atk_cd: 2,power: 50,speed: 30,
9006:{uuid: 9006,path: "m3",type: 3,level: 1,name: "魔法师3",atk: 3,hp: 18,atk_cd: 2,power: 50,speed: 30,
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001,word: "守护",info: "自身护盾", atktype: "攻速型",mon: "猫"},
1107:{uuid: 1107,path: 1107,type: 3,level: 1,name: "灵巧松鼠",atk: 3,hp: 18,atk_cd: 1,power: 50,speed: 30,
9007:{uuid: 9007,path: "arc1",type: 3,level: 1,name: "弓箭手1",atk: 3,hp: 18,atk_cd: 1,power: 50,speed: 30,
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001,word: "狂暴",info: "全体攻击", atktype: "攻速型",mon: "松鼠"},
1108:{uuid: 1108,path: 1108,type: 3,level: 2,name: "机械蜜",atk: 4,hp: 27,atk_cd: 1,power: 50,speed: 30,
9008:{uuid: 9008,path: "arc2",type: 3,level: 2,name: "弓箭手2",atk: 4,hp: 27,atk_cd: 1,power: 50,speed: 30,
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001, atktype: "攻速型",mon: "机械蜜蜂"},
1109:{uuid: 1109,path: 1109,type: 1,level: 2,name: "猎鹰",atk: 6,hp: 36,atk_cd: 2,power: 50,speed: 30,
9009:{uuid: 9009,path: "arc3",type: 1,level: 2,name: "弓箭手3",atk: 6,hp: 36,atk_cd: 2,power: 50,speed: 30,
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001, atktype: "攻击型",mon: "鹰"},
1110:{uuid: 1110,path: 1110,type: 2,level: 3,name: "憨憨猪",atk: 5,hp: 108,atk_cd: 2,power: 50,speed: 30,
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001, atktype: "血量型",mon: "野猪"},
1113:{uuid: 1113,path: 1113,type: 3,level: 3,name: "憨憨猪",atk: 6,hp: 45,atk_cd: 1,power: 50,speed: 30,
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001, atktype: "攻速型",mon: "狮子"},
1114:{uuid: 1114,path: 1114,type: 2,level: 4,name: "黑耀犀牛",atk: 7,hp: 162,atk_cd: 2,power: 50,speed: 30,
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001,word: "雷暴",info: "雷暴", atktype: "血量型",mon: "犀牛"},
1115:{uuid: 1115,path: 1115,type: 6,level: 5,name: "雷暴犀牛",atk: 15,hp: 180,atk_cd: 1,power: 50,speed: 30,
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001, atktype: "精英型",mon: "雷电犀牛"},
1116:{uuid: 1116,path: 1116,type: 6,level: 5,name: "雷暴鼠",atk: 15,hp: 180,atk_cd: 1,power: 50,speed: 30,
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001, atktype: "精英型",mon: "闪电鼠"},
}

View File

@@ -41,7 +41,9 @@ export class Hero extends ecs.Entity {
/** 加载角色 */
load(pos: Vec3 = Vec3.ZERO,scale:number = -1,uuid:number=1001,layer:Node=smc.map.MapView.scene.entityLayer!.node!) {
var path = "game/monster/"+MonSet[uuid].path;
console.log("加载角色",uuid,smc.heros[uuid]);
var path = "game/hero/"+smc.heros[uuid].path;
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
node.parent=layer
@@ -50,11 +52,11 @@ export class Hero extends ecs.Entity {
// node.setScale(node.scale.x*scale*ratio, node.scale.y*ratio, 0);
node.setPosition(pos)
this.hero_init(uuid,node)
oops.message.dispatchEvent("mon_load",this)
oops.message.dispatchEvent("hero_load",this)
}
set_ratio(uuid:number){
let ratio=1;
switch (MonSet[uuid].level) {
switch (smc.heros[uuid].level) {
case 2:
ratio=1.05
break;
@@ -76,18 +78,18 @@ export class Hero extends ecs.Entity {
var mv = node.getComponent(HeroViewComp)!;
var buff =node.getComponent(HeroBuffComp)!;
// console.log("hero_init",buff)
mv.speed =mv.ospeed = smc.monsters[uuid].speed;
mv.hero_name= smc.monsters[uuid].name;
buff.group=mv.box_group= BoxSet.MONSTER;
mv.hp= mv.hp_max = smc.monsters[uuid].hp;
mv.level = smc.monsters[uuid].level;
mv.atk = smc.monsters[uuid].atk;
mv.atk_cd = smc.monsters[uuid].atk_cd;
mv.power = smc.monsters[uuid].power;
mv.type = smc.monsters[uuid].type;
mv.speed =mv.ospeed = smc.heros[uuid].speed;
mv.hero_name= smc.heros[uuid].name;
buff.group=mv.box_group= BoxSet.HERO;
mv.hp= mv.hp_max = smc.heros[uuid].hp;
mv.level = smc.heros[uuid].level;
mv.atk = smc.heros[uuid].atk;
mv.atk_cd = smc.heros[uuid].atk_cd;
mv.power = smc.heros[uuid].power;
mv.type = smc.heros[uuid].type;
mv.skill_uuid = 9001;
mv.max_skill_uuid = smc.monsters[uuid].max_skill_uuid;
mv.scale = -1;
mv.max_skill_uuid = smc.heros[uuid].max_skill_uuid;
mv.scale = 1;
mv.Tpos = v3(0,0,0);
this.add(mv);
this.add(buff);

View File

@@ -172,7 +172,7 @@ export class HeroViewComp extends CCComp {
this.in_shield();
this.in_stop(dt);
this.in_act(dt);
// this.move(dt);
this.move(dt);
// if(this.m_timer.update(dt)){
// this.move_to()
// }
@@ -189,9 +189,9 @@ export class HeroViewComp extends CCComp {
if(this.scale===-1&&this.node.position.x <= BoxSet.HERO_START){
return;
}
// if(this.enemy){
// return
// }
if(this.enemy){
return
}
this.node.setPosition(this.node.position.x+dt*this.speed*this.scale, this.node.position.y, this.node.position.z);
}
move_to(){

View File

@@ -81,7 +81,6 @@ export class CardControllerComp extends CCComp {
// }
// }
touch1(event: EventTouch) {
console.log("touch 1");
this.in_touch=true
if(this.in_load)return
if(!this.cards[1].alive)return
@@ -89,7 +88,6 @@ export class CardControllerComp extends CCComp {
}
touch2(event: EventTouch) {
console.log("touch 2");
this.in_touch=true
if(this.in_load)return
if(!this.cards[2].alive)return
@@ -97,7 +95,6 @@ export class CardControllerComp extends CCComp {
}
touch3(event: EventTouch) {
console.log("touch 3");
this.in_touch=true
if(this.in_load)return
if(!this.cards[3].alive)return
@@ -105,7 +102,6 @@ export class CardControllerComp extends CCComp {
}
touch4(event: EventTouch) {
console.log("touch 4");
this.in_touch=true
if(this.in_load)return
if(!this.cards[4].alive)return
@@ -113,7 +109,6 @@ export class CardControllerComp extends CCComp {
}
touch5(event: EventTouch) {
console.log("touch 5");
this.in_touch=true
if(this.in_load)return
if(!this.cards[5].alive)return
@@ -121,44 +116,37 @@ export class CardControllerComp extends CCComp {
}
touch6(event: EventTouch) {
console.log("touch 6");
this.in_touch=true
if(this.in_load)return
if(!this.cards[6].alive)return
this.show_info(this.cards[6].uuid,this.cards[6].type)
}
end1(event: EventTouch) {
console.log("end1 1");
this.onTouchEnd(1)
}
end2(event: EventTouch) {
console.log("end2 2");
this.onTouchEnd(2)
}
end3(event: EventTouch) {
console.log("end3 3");
this.onTouchEnd(3)
}
end4(event: EventTouch) {
console.log("end4 4");
this.onTouchEnd(4)
}
end5(event: EventTouch) {
console.log("end5 5");
this.onTouchEnd(5)
}
end6(event: EventTouch) {
console.log("end6 6");
this.onTouchEnd(6)
}
show_info(uuid:number,type:number){
console.log("show_info",uuid)
// console.log("show_info",uuid)
let node =this.node.getChildByName("item_box")
if(type == 2){
smc.vm_data.item_box.info = SkillSet[uuid].info
@@ -170,7 +158,6 @@ export class CardControllerComp extends CCComp {
node.active=true
}
if(type == 3){
console.log(SkillSet[uuid])
smc.vm_data.item_box.info = SkillSet[uuid].info
smc.vm_data.item_box.name = SkillSet[uuid].name
smc.vm_data.item_box.skillcd = SkillSet[uuid].cd
@@ -243,11 +230,16 @@ export class CardControllerComp extends CCComp {
smc.vm_data.shuaxin.min = 0
}
}
get_card_list(li:number){
let list = RandomManager.instance.getRandomByObjectList(CardList[li], 1);
return list
}
load_cards() {
this.in_load = true
let card:any=null
for (let index = 1; index <= 6; index++) {
card=RandomManager.instance.getRandomByObjectList(CardList, 1);
card=RandomManager.instance.getRandomByObjectList(CardList[index], 1);
this.cards[index].uuid=card[0].uuid
this.cards[index].type=card[0].type
@@ -258,8 +250,8 @@ export class CardControllerComp extends CCComp {
let { uuid, type } = card[0];
switch (type) {
case 1:
url = "game/heros/heros";
({ path: pathName, name, level } = smc.heros[uuid]);
url = "game/hero/hero_icon";
({ uuid: pathName, name, level } = smc.heros[uuid]);
break;
case 2:
url = "game/heros/skill";
@@ -271,7 +263,6 @@ export class CardControllerComp extends CCComp {
({ path: pathName, name, level } = smc.skills[uuid]);
}
this.cards[index].lv=level
console.log("load_cards:",url,pathName,name,level)
let node=this.node.getChildByName('cards').getChildByName('card'+index)
node.getChildByName('cost').getComponent(Label).string=level.toString()
node.getChildByName('name').getComponent(Label).string=name
@@ -352,10 +343,6 @@ export class CardControllerComp extends CCComp {
}
}
get_card_list(){
let list = RandomManager.instance.getRandomByObjectList(CardList, 1);
return list
}
/** 视图对象通过 ecs.Entity.remove(ControllerComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {

View File

@@ -10,10 +10,9 @@ import { MapViewScene } from "./view/MapViewScene";
import { MissionSet,MissionNum,MonsetList } from "../common/config/MissionSet";
import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
import { Role } from "../Role/Role";
import { Hero } from "../monster/Hero";
import { HeroModelComp } from "../monster/HeroModelComp";
import { Hero } from "../hero/Hero";
import { HeroModelComp } from "../hero/HeroModelComp";
import { MonsterModelComp } from "../monster/MonsterModelComp";
import { MonsterViewComp } from "../monster/MonsterViewComp";
import { Mon } from "../mon/Mon";
const { ccclass, property } = _decorator;