ddd
This commit is contained in:
@@ -108,6 +108,7 @@ export class RoleViewComp extends CCComp {
|
||||
// this.orginalFlashMaterial = this.sprite.getRenderMaterial(0);
|
||||
// 注册单个碰撞体的回调函数
|
||||
let collider = this.getComponent(Collider2D);
|
||||
smc.vm_data.role.atk_time=smc.vm_data.role.atk_cd;
|
||||
collider.group = this.box_group;
|
||||
if (collider) {
|
||||
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
|
||||
@@ -181,7 +182,7 @@ export class RoleViewComp extends CCComp {
|
||||
this.check_buff_atks(dt)
|
||||
this.in_shield(dt);
|
||||
this.in_stop(dt);
|
||||
this.atk_time += dt;
|
||||
smc.vm_data.role.atk_time -= dt;
|
||||
this.in_atk();
|
||||
this.skill_cds(dt);
|
||||
this.move(dt);
|
||||
@@ -197,27 +198,27 @@ export class RoleViewComp extends CCComp {
|
||||
if(this.skill1.cd <= 0){
|
||||
this.handle_skill(this.skill1.uuid);
|
||||
this.skill1.cd=this.skill1.cd_max
|
||||
console.log("shoot uuid :"+this.skill1.uuid);
|
||||
console.log("shoot skill1 uuid :"+this.skill1.uuid);
|
||||
}
|
||||
if(this.skill2.cd <= 0){
|
||||
this.handle_skill(this.skill2.uuid);
|
||||
this.skill2.cd=this.skill2.cd_max
|
||||
console.log("shoot uuid :"+this.skill2.uuid);
|
||||
console.log("shoot skill2 uuid :"+this.skill2.uuid);
|
||||
}
|
||||
if(this.skill3.cd <= 0){
|
||||
this.handle_skill(this.skill3.uuid);
|
||||
this.skill3.cd=this.skill3.cd_max
|
||||
console.log("shoot uuid :"+this.skill3.uuid);
|
||||
console.log("shoot skill3 uuid :"+this.skill3.uuid);
|
||||
}
|
||||
if(this.skill4.cd <= 0){
|
||||
this.handle_skill(this.skill4.uuid);
|
||||
this.skill4.cd=this.skill4.cd_max
|
||||
console.log("shoot uuid :"+this.skill4.uuid);
|
||||
console.log("shoot skill4 uuid :"+this.skill4.uuid);
|
||||
}
|
||||
if(this.skill5.cd <= 0){
|
||||
this.handle_skill(this.skill5.uuid);
|
||||
this.skill5.cd=this.skill5.cd_max
|
||||
console.log("shoot uuid :"+this.skill5.uuid);
|
||||
console.log("shoot skill5 uuid :"+this.skill5.uuid);
|
||||
}
|
||||
// this.skills.forEach((e:any) => {
|
||||
// if(e.cd > 0&&e.alive){
|
||||
@@ -235,7 +236,7 @@ export class RoleViewComp extends CCComp {
|
||||
// console.log("handle_skill uuid:"+uuid);
|
||||
this.as.max();
|
||||
this.scheduleOnce(()=>{
|
||||
this.shoot(this.skill);
|
||||
this.shoot(uuid);
|
||||
},0.3)
|
||||
}
|
||||
// check_enemys(){
|
||||
@@ -294,16 +295,19 @@ export class RoleViewComp extends CCComp {
|
||||
return {pos,t_pos}
|
||||
}
|
||||
check_enemy_alive(){
|
||||
let dir = 320
|
||||
let dir = 360
|
||||
this.enemy = v3(720,this.node.position.y)
|
||||
for (let i = 0; i < GameSet.ATK_LINES; i++) {
|
||||
let mon:any = smc.enemy_pos[i];
|
||||
let x=Math.abs(mon.x-this.node.position.x)
|
||||
let y = Math.abs(mon.y-this.node.position.y)
|
||||
let squaredDistance =x*x+y*y
|
||||
let distance = Math.sqrt(squaredDistance);
|
||||
if(distance < dir){
|
||||
dir = distance
|
||||
// let x=Math.abs(mon.x-this.node.position.x)
|
||||
// let y = Math.abs(mon.y-this.node.position.y)
|
||||
// let squaredDistance =x*x+y*y
|
||||
// let distance = Math.sqrt(squaredDistance);
|
||||
// if(distance < dir){
|
||||
// dir = distance
|
||||
// this.enemy = mon
|
||||
// }
|
||||
if(mon.x < this.enemy.x){
|
||||
this.enemy = mon
|
||||
}
|
||||
}
|
||||
@@ -314,16 +318,16 @@ export class RoleViewComp extends CCComp {
|
||||
}
|
||||
}
|
||||
in_atk() {
|
||||
if(this.atk_time >= this.atk_cd){
|
||||
if(smc.vm_data.role.atk_time <= 0 ){
|
||||
if(this.is_atking){
|
||||
this.atk_time = 0;
|
||||
// console.log("atk_cd:"+this.atk_cd);
|
||||
smc.vm_data.role.atk_time = smc.vm_data.role.atk_cd;
|
||||
console.log("atk_cd:"+smc.vm_data.role.atk_cd);
|
||||
this.as.atk();
|
||||
this.scheduleOnce(()=>{
|
||||
this.shoot(this.skill,-30);
|
||||
this.shoot(this.skill,0,30);
|
||||
},0.4)
|
||||
}
|
||||
// this.atk_time = 0;
|
||||
// smc.vm_data.role.atk_time = 0;
|
||||
// this.as.atk();
|
||||
// this.scheduleOnce(()=>{
|
||||
// this.shoot(this.skill,-30,45);
|
||||
|
||||
@@ -23,7 +23,11 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
/** 游戏地图 */
|
||||
map: GameMap = null!;
|
||||
cards: any = [
|
||||
{uuid:9001,type:1},{uuid:9002,type:1},{uuid:9011,type:1},{uuid:9021,type:1},{uuid:9031,type:1},{uuid:9041,type:1}
|
||||
{uuid:9001,type:1},{uuid:9002,type:1},{uuid:9011,type:1},{uuid:9021,type:1},{uuid:9031,type:1},
|
||||
{uuid:9003,type:1},{uuid:9004,type:1},{uuid:9005,type:1},
|
||||
{uuid:9012,type:1},{uuid:9013,type:1},
|
||||
{uuid:9022,type:1},{uuid:9023,type:1},
|
||||
{uuid:9032,type:1},{uuid:9033,type:1},
|
||||
];
|
||||
item_list: any = [
|
||||
{uuid:6005,type:2},{uuid:6006,type:2},{uuid:6101,type:2},{uuid:6102,type:2}, {uuid:6210,type:2},{uuid:6211,type:2},{uuid:6212,type:2},
|
||||
@@ -131,12 +135,14 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
hero_num:12,
|
||||
hp:300,
|
||||
hp_max:300,
|
||||
speed:40,
|
||||
speed:0,
|
||||
atk:10,
|
||||
atk_dis:100,
|
||||
atk_dis:700,
|
||||
buff_atk:0,
|
||||
mission_atk:0,
|
||||
atk_time:0,
|
||||
atk_cd:1,
|
||||
atk_base_cd:1,
|
||||
atk_cd_up:0,
|
||||
mission_atk_cd_up:0,
|
||||
atk_range:400,
|
||||
@@ -144,9 +150,9 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
exp:0,
|
||||
next_exp:100,
|
||||
power:300,
|
||||
skill:9001,
|
||||
skill1:{uuid:1001,cd:3,cd_max:3,alive:true },
|
||||
skill2:{uuid:1001,cd:3,cd_max:3,alive:false},
|
||||
skill:1004,
|
||||
skill1:{uuid:1004,cd:3,cd_max:3,alive:true },
|
||||
skill2:{uuid:1002,cd:3,cd_max:3,alive:true},
|
||||
skill3:{uuid:1001,cd:3,cd_max:3,alive:false},
|
||||
skill4:{uuid:1001,cd:3,cd_max:3,alive:false},
|
||||
skill5:{uuid:1001,cd:3,cd_max:3,alive:false},
|
||||
@@ -184,14 +190,6 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
monster:{
|
||||
gold_add:1,
|
||||
},
|
||||
/** 当前等级 */
|
||||
cards:{
|
||||
level:1,
|
||||
level_max:4,
|
||||
eid:0,
|
||||
ref_cost:1,
|
||||
up_cost:4,
|
||||
},
|
||||
gold: {
|
||||
min: 200,
|
||||
max: 200,
|
||||
|
||||
@@ -1,25 +1,62 @@
|
||||
|
||||
export const HeroSet = {
|
||||
9001: {
|
||||
uuid: 9001, path: "k3", type: 1, level: 1,cost:2, name: "骑士", atk: 10, hp: 100, atk_dis: 100, atk_cd: 1, power: 0, power_max: 20, speed: 40,
|
||||
skill_uuid: 9001, max_skill_uuid: 2002, atktype: 1,
|
||||
uuid: 9001, path: "k3", type: 1, level: 1,cost:2, name: "骑士", atk: 10, hp: 100, atk_dis: 100, atk_cd: 1, power: 0, power_max: 15, speed: 40,
|
||||
skill_uuid: 9001, max_skill_uuid: 2002, atktype: 1,
|
||||
},
|
||||
9002: {
|
||||
uuid: 9002, path: "k1", type: 1, level: 1,cost:2, name: "战士", atk: 20, hp: 50, atk_dis: 100, atk_cd: 1, power: 0, power_max: 20, speed: 40,
|
||||
skill_uuid: 9001, max_skill_uuid: 2003, atktype: 1,
|
||||
uuid: 9002, path: "k1", type: 1, level: 1,cost:2, name: "战士", atk: 20, hp: 50, atk_dis: 100, atk_cd: 1, power: 0, power_max: 15, speed: 40,
|
||||
skill_uuid: 9001, max_skill_uuid: 2003, atktype: 1,
|
||||
},
|
||||
9003: {
|
||||
uuid: 9003, path: "kk1", type: 1, level: 1,cost:2, name: "骑士", atk: 10, hp: 100, atk_dis: 100, atk_cd: 1, power: 0, power_max: 15, speed: 40,
|
||||
skill_uuid: 9001, max_skill_uuid: 2002, atktype: 1,
|
||||
},
|
||||
9004: {
|
||||
uuid: 9004, path: "kk2", type: 1, level: 1,cost:2, name: "战士", atk: 20, hp: 50, atk_dis: 100, atk_cd: 1, power: 0, power_max: 15, speed: 40,
|
||||
skill_uuid: 9001, max_skill_uuid: 2003, atktype: 1,
|
||||
},
|
||||
9005: {
|
||||
uuid: 9005, path: "kk3", type: 1, level: 1,cost:2, name: "战士", atk: 20, hp: 50, atk_dis: 100, atk_cd: 1, power: 0, power_max: 15, speed: 40,
|
||||
skill_uuid: 9001, max_skill_uuid: 2003, atktype: 1,
|
||||
},
|
||||
9011: {
|
||||
uuid: 9004, path: "m1", type: 3, level: 1,cost:2, name: "冰法", atk: 25, hp: 50, atk_dis: 260, atk_cd: 2.5, power: 0, power_max: 20, speed: 20,
|
||||
uuid: 9011, path: "m1", type: 3, level: 1,cost:2, name: "冰法", atk: 25, hp: 50, atk_dis: 260, atk_cd: 2.5, power: 0, power_max: 15, speed: 20,
|
||||
skill_uuid: 9002, max_skill_uuid: 1002, atktype: 1,
|
||||
},
|
||||
9012: {
|
||||
uuid: 9012, path: "i2", type: 3, level: 1,cost:2, name: "冰法", atk: 25, hp: 50, atk_dis: 260, atk_cd: 2.5, power: 0, power_max: 15, speed: 20,
|
||||
skill_uuid: 9002, max_skill_uuid: 1002, atktype: 1,
|
||||
},
|
||||
9013: {
|
||||
uuid: 9013, path: "i3", type: 3, level: 1,cost:2, name: "冰法", atk: 25, hp: 50, atk_dis: 260, atk_cd: 2.5, power: 0, power_max: 15, speed: 20,
|
||||
skill_uuid: 9002, max_skill_uuid: 1002, atktype: 1,
|
||||
},
|
||||
9021: {
|
||||
uuid: 9006, path: "m3", type: 3, level: 1,cost:2, name: "火法", atk: 20, hp: 50, atk_dis: 260, atk_cd: 2, power: 0, power_max: 20, speed: 20,
|
||||
skill_uuid: 9002, max_skill_uuid: 1001, atktype: 2
|
||||
uuid: 9021, path: "m3", type: 3, level: 1,cost:2, name: "火法", atk: 20, hp: 50, atk_dis: 260, atk_cd: 2, power: 0, power_max: 15, speed: 20,
|
||||
skill_uuid: 9002, max_skill_uuid: 1001, atktype: 2
|
||||
},
|
||||
9022: {
|
||||
uuid: 9022, path: "f2", type: 3, level: 1,cost:2, name: "火法", atk: 20, hp: 50, atk_dis: 260, atk_cd: 2, power: 0, power_max: 15, speed: 20,
|
||||
skill_uuid: 9002, max_skill_uuid: 1001, atktype: 2
|
||||
},
|
||||
9023: {
|
||||
uuid: 9023, path: "f3", type: 3, level: 1,cost:2, name: "火法", atk: 20, hp: 50, atk_dis: 260, atk_cd: 2, power: 0, power_max: 15, speed: 20,
|
||||
skill_uuid: 9002, max_skill_uuid: 1001, atktype: 2
|
||||
},
|
||||
9031: {
|
||||
uuid: 9005, path: "m2", type: 3, level: 1,cost:2, name: "牧师", atk: 10, hp: 50, atk_dis: 260, atk_cd: 2, power: 1, power_max: 1, speed: 20,
|
||||
skill_uuid: 9002, max_skill_uuid: 2001, atktype: 2
|
||||
uuid: 9031, path: "m2", type: 3, level: 1,cost:2, name: "牧师", atk: 10, hp: 50, atk_dis: 260, atk_cd: 2, power: 1, power_max: 10, speed: 20,
|
||||
skill_uuid: 9002, max_skill_uuid: 2001, atktype: 2
|
||||
},
|
||||
9032: {
|
||||
uuid: 9032, path: "h2", type: 3, level: 1,cost:2, name: "牧师", atk: 10, hp: 50, atk_dis: 260, atk_cd: 2, power: 1, power_max: 10, speed: 20,
|
||||
skill_uuid: 9002, max_skill_uuid: 2001, atktype: 2
|
||||
},
|
||||
9033: {
|
||||
uuid: 9033, path: "h3", type: 3, level: 1,cost:2, name: "牧师", atk: 10, hp: 50, atk_dis: 260, atk_cd: 2, power: 1, power_max: 10, speed: 20,
|
||||
skill_uuid: 9002, max_skill_uuid: 2001, atktype: 2
|
||||
},
|
||||
|
||||
9041: {
|
||||
uuid: 9009, path: "arc1", type: 2, level: 1,cost:2, name: "弓箭手", atk: 15, hp: 50, atk_dis: 200, atk_cd: 1.5, power: 0, power_max: 20, speed: 30,
|
||||
skill_uuid: 9003, max_skill_uuid: 1003, atktype: 2
|
||||
|
||||
@@ -199,9 +199,7 @@ export class CardControllerComp extends CCComp {
|
||||
this.node.getChildByName("bar").getChildByName("mission_btn").getChildByName("bg").active=true
|
||||
this.node.getChildByName("bar").getChildByName("hero_btn").getChildByName("bg").active=false
|
||||
this.node.getChildByName("bar").getChildByName("home_btn").getChildByName("bg").active=false
|
||||
this.node.getChildByName("bar").getChildByName("mission_btn").setScale(1.2,1.2)
|
||||
this.node.getChildByName("bar").getChildByName("hero_btn").setScale(1,1)
|
||||
this.node.getChildByName("bar").getChildByName("home_btn").setScale(1,1)
|
||||
|
||||
}
|
||||
mission_start(){
|
||||
this.node.getChildByName("bar").active=false;
|
||||
@@ -217,9 +215,7 @@ export class CardControllerComp extends CCComp {
|
||||
this.node.getChildByName("bar").getChildByName("mission_btn").getChildByName("bg").active=false
|
||||
this.node.getChildByName("bar").getChildByName("hero_btn").getChildByName("bg").active=false
|
||||
this.node.getChildByName("bar").getChildByName("home_btn").getChildByName("bg").active=true
|
||||
this.node.getChildByName("bar").getChildByName("mission_btn").setScale(1,1)
|
||||
this.node.getChildByName("bar").getChildByName("hero_btn").setScale(1,1)
|
||||
this.node.getChildByName("bar").getChildByName("home_btn").setScale(1.2,1.2)
|
||||
|
||||
}
|
||||
to_hero(){
|
||||
this.node.getChildByName("mission_home").active=false
|
||||
@@ -228,9 +224,7 @@ export class CardControllerComp extends CCComp {
|
||||
this.node.getChildByName("bar").getChildByName("mission_btn").getChildByName("bg").active=false
|
||||
this.node.getChildByName("bar").getChildByName("hero_btn").getChildByName("bg").active=true
|
||||
this.node.getChildByName("bar").getChildByName("home_btn").getChildByName("bg").active=false
|
||||
this.node.getChildByName("bar").getChildByName("mission_btn").setScale(1,1)
|
||||
this.node.getChildByName("bar").getChildByName("hero_btn").setScale(1.2,1.2)
|
||||
this.node.getChildByName("bar").getChildByName("home_btn").setScale(1,1)
|
||||
|
||||
}
|
||||
/** 视图对象通过 ecs.Entity.remove(ControllerComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
|
||||
@@ -24,7 +24,7 @@ export class HeroHomeComp extends CCComp {
|
||||
}
|
||||
start() {
|
||||
|
||||
this.load_talents()
|
||||
// this.load_talents()
|
||||
console.log("hero_home start")
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user