攻击距离设定
This commit is contained in:
@@ -63,6 +63,7 @@ export class RoleViewComp extends CCComp {
|
||||
atk: number = 10; /**攻击力 */
|
||||
// atk_speed: number = 1;
|
||||
atk_cd: number = 1.3; /**攻击速度 攻击间隔 */
|
||||
atk_dis: number = 800;
|
||||
atk_time: number = 0; /** 冷却时间 */
|
||||
|
||||
speed: number = 100; /** 角色移动速度 */
|
||||
|
||||
@@ -112,7 +112,6 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
|
||||
};
|
||||
vmAdd() {
|
||||
console.log("smc vm_data vmAdd");
|
||||
VM.add(this.vm_data, "data");
|
||||
|
||||
}
|
||||
|
||||
@@ -16,13 +16,13 @@ export const CardList={
|
||||
// {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:9001,type:1},{uuid:9002,type:1},{uuid:9003,type:1},{uuid:9004,type:1},{uuid:9005,type:1},{uuid:9006,type:1},
|
||||
],
|
||||
5:[
|
||||
{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},
|
||||
],
|
||||
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:[
|
||||
@@ -31,5 +31,8 @@ export const CardList={
|
||||
{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},
|
||||
],
|
||||
7:[
|
||||
|
||||
],
|
||||
|
||||
}
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
|
||||
export const MonSet={
|
||||
1001:{uuid: 1001,path: "ge1",type: 1,level: 1,name: "战斗哥",atk: 4,hp: 24,atk_cd: 2,power: 50,speed: 30,
|
||||
1001:{uuid: 1001,path: "ge1",type: 1,level: 1,name: "战斗哥",atk: 4,hp: 24,atk_dis:40,atk_cd: 2,power: 50,speed: 30,
|
||||
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001,word: "守护",info: "自身护盾", atktype: "攻击型",mon: "orc"},
|
||||
1002:{uuid: 1002,path: "ge2",type: 1,level: 1,name: "墨西哥",atk: 4,hp: 24,atk_cd: 2,power: 50,speed: 30,
|
||||
1002:{uuid: 1002,path: "ge2",type: 1,level: 1,name: "墨西哥",atk: 4,hp: 24,atk_dis:40,atk_cd: 2,power: 50,speed: 30,
|
||||
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001,word: "守护",info: "自身护盾", atktype: "攻击型",mon: "orc"},
|
||||
1003:{uuid: 1003,path: "ge3",type: 1,level: 1,name: "铁头哥",atk: 4,hp: 24,atk_cd: 2,power: 50,speed: 30,
|
||||
1003:{uuid: 1003,path: "ge3",type: 1,level: 1,name: "铁头哥",atk: 4,hp: 24,atk_dis:40,atk_cd: 2,power: 50,speed: 30,
|
||||
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001,word: "守护",info: "自身护盾", atktype: "攻击型",mon: "orc"},
|
||||
1011:{uuid: 1011,path: "orc1",type: 1,level: 1,name: "森林兽人",atk: 4,hp: 24,atk_cd: 2,power: 50,speed: 30,
|
||||
1011:{uuid: 1011,path: "orc1",type: 1,level: 1,name: "森林兽人",atk: 4,hp: 24,atk_dis:40,atk_cd: 2,power: 50,speed: 30,
|
||||
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001,word: "守护",info: "自身护盾", atktype: "攻击型",mon: "orc"},
|
||||
1012:{uuid: 1012,path: "orc2",type: 1,level: 1,name: "荒野兽人",atk: 4,hp: 24,atk_cd: 2,power: 50,speed: 30,
|
||||
1012:{uuid: 1012,path: "orc2",type: 1,level: 1,name: "荒野兽人",atk: 4,hp: 24,atk_dis:40,atk_cd: 2,power: 50,speed: 30,
|
||||
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001,word: "守护",info: "自身护盾", atktype: "攻击型",mon: "orc"},
|
||||
1013:{uuid: 1013,path: "orc3",type: 1,level: 1,name: "兽人战士",atk: 4,hp: 24,atk_cd: 2,power: 50,speed: 30,
|
||||
1013:{uuid: 1013,path: "orc3",type: 1,level: 1,name: "兽人战士",atk: 4,hp: 24,atk_dis:40,atk_cd: 2,power: 50,speed: 30,
|
||||
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001,word: "守护",info: "自身护盾", atktype: "攻击型",mon: "orc"},
|
||||
1021:{uuid: 1021,path: "gou1",type: 1,level: 1,name: "黄皮豺狼",atk: 4,hp: 24,atk_cd: 2,power: 50,speed: 30,
|
||||
1021:{uuid: 1021,path: "gou1",type: 1,level: 1,name: "黄皮豺狼",atk: 4,hp: 24,atk_dis:40,atk_cd: 2,power: 50,speed: 30,
|
||||
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001,word: "守护",info: "自身护盾", atktype: "攻击型",mon: "gou"},
|
||||
1022:{uuid: 1022,path: "gou2",type: 1,level: 1,name: "白皮豺狼",atk: 4,hp: 24,atk_cd: 2,power: 50,speed: 30,
|
||||
1022:{uuid: 1022,path: "gou2",type: 1,level: 1,name: "白皮豺狼",atk: 4,hp: 24,atk_dis:40,atk_cd: 2,power: 50,speed: 30,
|
||||
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001,word: "守护",info: "自身护盾", atktype: "攻击型",mon: "gou"},
|
||||
1023:{uuid: 1023,path: "gou3",type: 1,level: 1,name: "灰皮豺狼",atk: 4,hp: 24,atk_cd: 2,power: 50,speed: 30,
|
||||
1023:{uuid: 1023,path: "gou3",type: 1,level: 1,name: "灰皮豺狼",atk: 4,hp: 24,atk_dis:40,atk_cd: 2,power: 50,speed: 30,
|
||||
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001,word: "守护",info: "自身护盾", atktype: "攻击型",mon: "gou"},
|
||||
1031:{uuid: 1031,path: "gou1",type: 1,level: 1,name: "独眼巨人",atk: 4,hp: 24,atk_cd: 2,power: 50,speed: 30,
|
||||
1031:{uuid: 1031,path: "gou1",type: 1,level: 1,name: "独眼巨人",atk: 4,hp: 24,atk_dis:40,atk_cd: 2,power: 50,speed: 30,
|
||||
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001,word: "守护",info: "自身护盾", atktype: "攻击型",mon: "gou"},
|
||||
1032:{uuid: 1032,path: "gou2",type: 1,level: 1,name: "狂暴独眼",atk: 4,hp: 24,atk_cd: 2,power: 50,speed: 30,
|
||||
1032:{uuid: 1032,path: "gou2",type: 1,level: 1,name: "狂暴独眼",atk: 4,hp: 24,atk_dis:40,atk_cd: 2,power: 50,speed: 30,
|
||||
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001,word: "守护",info: "自身护盾", atktype: "攻击型",mon: "gou"},
|
||||
1033:{uuid: 1033,path: "gou3",type: 1,level: 1,name: "独眼首领",atk: 4,hp: 24,atk_cd: 2,power: 50,speed: 30,
|
||||
1033:{uuid: 1033,path: "gou3",type: 1,level: 1,name: "独眼首领",atk: 4,hp: 24,atk_dis:40,atk_cd: 2,power: 50,speed: 30,
|
||||
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001,word: "守护",info: "自身护盾", atktype: "攻击型",mon: "gou"},
|
||||
1041:{uuid: 1041,path: "ys1",type: 1,level: 1,name: "火元素",atk: 4,hp: 24,atk_cd: 2,power: 50,speed: 30,
|
||||
1041:{uuid: 1041,path: "ys1",type: 1,level: 1,name: "火元素",atk: 4,hp: 24,atk_dis:400,atk_cd: 2,power: 50,speed: 30,
|
||||
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001,word: "守护",info: "自身护盾", atktype: "攻击型",mon: "gou"},
|
||||
1042:{uuid: 1042,path: "ys2",type: 1,level: 1,name: "冰元素",atk: 4,hp: 24,atk_cd: 2,power: 50,speed: 30,
|
||||
1042:{uuid: 1042,path: "ys2",type: 1,level: 1,name: "冰元素",atk: 4,hp: 24,atk_dis:400,atk_cd: 2,power: 50,speed: 30,
|
||||
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001,word: "守护",info: "自身护盾", atktype: "攻击型",mon: "ys"},
|
||||
1043:{uuid: 1043,path: "ys3",type: 1,level: 1,name: "气元素",atk: 4,hp: 24,atk_cd: 2,power: 50,speed: 30,
|
||||
1043:{uuid: 1043,path: "ys3",type: 1,level: 1,name: "气元素",atk: 4,hp: 24,atk_dis:400,atk_cd: 2,power: 50,speed: 30,
|
||||
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001,word: "守护",info: "自身护盾", atktype: "攻击型",mon: "ys"},
|
||||
}
|
||||
@@ -1,22 +1,22 @@
|
||||
|
||||
export const HeroSet={
|
||||
9001:{uuid: 9001,path: "k1",type: 1,level: 1,name: "战士1",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_dis:40,atk_cd: 2,power: 50,speed: 30,
|
||||
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001,word: "守护",info: "自身护盾", atktype: "攻击型",mon: "狗"},
|
||||
9002:{uuid: 9002,path: "k2",type: 2,level: 1,name: "战士2",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_dis:40,atk_cd: 2,power: 50,speed: 30,
|
||||
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001,word: "守护",info: "自身护盾", atktype: "血量型",mon: "绵羊"},
|
||||
9003:{uuid: 9003,path: "k3",type: 1,level: 1,name: "战士3",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_dis:40,atk_cd: 2,power: 50,speed: 30,
|
||||
skill: "base",max_skill: "base",skill_uuid: 9001,max_skill_uuid: 1001, atktype: "攻击型",mon: "蚂蚁"},
|
||||
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: "蚂蚁"},
|
||||
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: "鼠"},
|
||||
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: "猫"},
|
||||
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: "松鼠"},
|
||||
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: "机械蜜蜂"},
|
||||
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: "鹰"},
|
||||
9004:{uuid: 9004,path: "m1",type: 1,level: 1,name: "魔法师1",atk: 4,hp: 24,atk_dis:400,atk_cd: 2,power: 50,speed: 30,
|
||||
skill: "base",max_skill: "base2",skill_uuid: 9001,max_skill_uuid: 1001, atktype: "攻击型",mon: "蚂蚁"},
|
||||
9005:{uuid: 9005,path: "m2",type: 3,level: 1,name: "魔法师2",atk: 3,hp: 18,atk_dis:400,atk_cd: 1,power: 50,speed: 30,
|
||||
skill: "base",max_skill: "base2",skill_uuid: 9001,max_skill_uuid: 1001, atktype: "攻速型",mon: "鼠"},
|
||||
9006:{uuid: 9006,path: "m3",type: 3,level: 1,name: "魔法师3",atk: 3,hp: 18,atk_dis:400,atk_cd: 2,power: 50,speed: 30,
|
||||
skill: "base",max_skill: "base2",skill_uuid: 9001,max_skill_uuid: 1001,word: "守护",info: "自身护盾", atktype: "攻速型",mon: "猫"},
|
||||
9007:{uuid: 9007,path: "arc1",type: 3,level: 1,name: "弓箭手1",atk: 3,hp: 18,atk_dis:500,atk_cd: 1,power: 50,speed: 30,
|
||||
skill: "base",max_skill: "base3",skill_uuid: 9001,max_skill_uuid: 1001,word: "狂暴",info: "全体攻击", atktype: "攻速型",mon: "松鼠"},
|
||||
9008:{uuid: 9008,path: "arc2",type: 3,level: 2,name: "弓箭手2",atk: 4,hp: 27,atk_dis:500,atk_cd: 1,power: 50,speed: 30,
|
||||
skill: "base",max_skill: "base3",skill_uuid: 9001,max_skill_uuid: 1001, atktype: "攻速型",mon: "机械蜜蜂"},
|
||||
9009:{uuid: 9009,path: "arc3",type: 1,level: 2,name: "弓箭手3",atk: 6,hp: 36,atk_dis:500,atk_cd: 2,power: 50,speed: 30,
|
||||
skill: "base",max_skill: "base3",skill_uuid: 9001,max_skill_uuid: 1001, atktype: "攻击型",mon: "鹰"},
|
||||
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
import { _decorator, Component, EventTouch, Node, NodeEventType } from 'cc';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('ShowInfoCom')
|
||||
export class ShowInfoCom extends Component {
|
||||
protected onLoad(): void {
|
||||
this.node.on(NodeEventType.TOUCH_START, this.onTouchMove, this);
|
||||
this.node.on(NodeEventType.TOUCH_MOVE, this.onTouchMove, this);
|
||||
this.node.on(NodeEventType.TOUCH_END, this.onTouchEnd, this);
|
||||
this.node.on(NodeEventType.TOUCH_CANCEL, this.onTouchEnd, this);
|
||||
// oops.message.on("active_card_eid", this.do_active_card_eid, this);
|
||||
}
|
||||
start() {
|
||||
|
||||
}
|
||||
onTouchMove(event: EventTouch) {
|
||||
let delta = event.getDelta();
|
||||
this.node.setPosition(this.node.position.x+delta.x,this.node.position.y+delta.y);
|
||||
this.show_info()
|
||||
}
|
||||
show_info(uuid:number,card_type:number){
|
||||
console.log("show_info",this.card_uid)
|
||||
let parent = this.node.parent.parent
|
||||
let node =parent.getChildByName("item_box")
|
||||
if(this.card_type == 2){
|
||||
smc.vm_data.item_box.info = SkillSet[this.card_uid].info
|
||||
smc.vm_data.item_box.name = SkillSet[this.card_uid].name
|
||||
smc.vm_data.item_box.skillcd = SkillSet[this.card_uid].cd
|
||||
smc.vm_data.item_box.skillsd = SkillSet[this.card_uid].sd
|
||||
smc.vm_data.item_box.atk = SkillSet[this.card_uid].atk
|
||||
smc.vm_data.item_box.hp = SkillSet[this.card_uid].hp
|
||||
node.active=true
|
||||
}
|
||||
if(this.card_type == 3){
|
||||
console.log(SkillSet[this.card_uid])
|
||||
smc.vm_data.item_box.info = SkillSet[this.card_uid].info
|
||||
smc.vm_data.item_box.name = SkillSet[this.card_uid].name
|
||||
smc.vm_data.item_box.skillcd = SkillSet[this.card_uid].cd
|
||||
smc.vm_data.item_box.skillsd = SkillSet[this.card_uid].sd
|
||||
smc.vm_data.item_box.atk = SkillSet[this.card_uid].atk
|
||||
smc.vm_data.item_box.hp = SkillSet[this.card_uid].hp
|
||||
smc.vm_data.item_box.shield = SkillSet[this.card_uid].shield
|
||||
node.active=true
|
||||
if(SkillSet[this.card_uid].shield > 0){
|
||||
node.getChildByName("data").getChildByName("shield").active=true
|
||||
}
|
||||
if(SkillSet[this.card_uid].hp > 0){
|
||||
node.getChildByName("data").getChildByName("hp").active=true
|
||||
}
|
||||
}
|
||||
}
|
||||
onTouchEnd(){
|
||||
if(this.node.position.y-this.pos_y > 150){
|
||||
this.use_card()
|
||||
}else{
|
||||
this.node.setPosition(this.pos_x,this.pos_y);
|
||||
}
|
||||
let parent = this.node.parent.parent
|
||||
let node = parent.getChildByName("item_box")
|
||||
node.active=false
|
||||
node.getChildByName("data").getChildByName("shield").active=false
|
||||
node.getChildByName("data").getChildByName("hp").active=false
|
||||
|
||||
}
|
||||
update(deltaTime: number) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "d612b0f7-dcf2-499a-993f-8b42291faa18",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -63,9 +63,9 @@ export class BoxRangComp extends CCComp {
|
||||
this.HeroViewComp.enemy = otherCollider.node;
|
||||
}
|
||||
}
|
||||
if(Math.abs(other_pos.x-self_pos.x) < this.atk_range){
|
||||
if(Math.abs(other_pos.x-self_pos.x) < this.HeroViewComp.atk_dis){
|
||||
this.HeroViewComp.is_atking = true;
|
||||
// this.HeroViewComp.stop_cd = 0.1
|
||||
this.HeroViewComp.stop_cd = 0.1
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ 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!) {
|
||||
console.log("加载角色",uuid,smc.heros[uuid]);
|
||||
|
||||
var path = "game/hero/"+smc.heros[uuid].path;
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
@@ -85,6 +84,7 @@ export class Hero extends ecs.Entity {
|
||||
mv.level = smc.heros[uuid].level;
|
||||
mv.atk = smc.heros[uuid].atk;
|
||||
mv.atk_cd = smc.heros[uuid].atk_cd;
|
||||
mv.atk_dis = smc.heros[uuid].atk_dis;
|
||||
mv.power = smc.heros[uuid].power;
|
||||
mv.type = smc.heros[uuid].type;
|
||||
mv.skill_uuid = 9001;
|
||||
|
||||
@@ -64,6 +64,7 @@ export class HeroViewComp extends CCComp {
|
||||
atk: number = 10; /**攻击力 */
|
||||
// atk_speed: number = 1;
|
||||
atk_cd: number = 1.3; /**攻击速度 攻击间隔 */
|
||||
atk_dis: number = 80;
|
||||
atk_time: number = 0; /** 冷却时间 */
|
||||
|
||||
speed: number = 100; /** 角色移动速度 */
|
||||
@@ -138,29 +139,29 @@ export class HeroViewComp extends CCComp {
|
||||
onEndContact (selfCollider: Collider2D, otherCollider: Collider2D) { }
|
||||
onPreSolve (selfCollider: Collider2D, otherCollider: Collider2D) {
|
||||
|
||||
if(selfCollider.group != otherCollider.group&&otherCollider.tag == 0){
|
||||
this.is_atking = true;
|
||||
this.stop_cd = 0.1;
|
||||
}
|
||||
// if(selfCollider.group != otherCollider.group&&otherCollider.tag == 0){
|
||||
// this.is_atking = true;
|
||||
// this.stop_cd = 0.1;
|
||||
// }
|
||||
}
|
||||
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D) {
|
||||
if(selfCollider.group == otherCollider.group&&otherCollider.tag == 0&&selfCollider.tag == 0){
|
||||
let self_pos=selfCollider.node.getPosition();
|
||||
let other_pos=otherCollider.node.getPosition();
|
||||
// console.log('mon view group 相同');
|
||||
switch (selfCollider.group) {
|
||||
case BoxSet.HERO:
|
||||
if(self_pos.x < other_pos.x){
|
||||
// this.stop_cd=0.1
|
||||
}
|
||||
break;
|
||||
case BoxSet.MONSTER:
|
||||
if(self_pos.x > other_pos.x){
|
||||
// this.stop_cd=0.1
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
// if(selfCollider.group == otherCollider.group&&otherCollider.tag == 0&&selfCollider.tag == 0){
|
||||
// let self_pos=selfCollider.node.getPosition();
|
||||
// let other_pos=otherCollider.node.getPosition();
|
||||
// // console.log('mon view group 相同');
|
||||
// switch (selfCollider.group) {
|
||||
// case BoxSet.HERO:
|
||||
// if(self_pos.x < other_pos.x){
|
||||
// // this.stop_cd=0.1
|
||||
// }
|
||||
// break;
|
||||
// case BoxSet.MONSTER:
|
||||
// if(self_pos.x > other_pos.x){
|
||||
// // this.stop_cd=0.1
|
||||
// }
|
||||
// break
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@@ -182,11 +183,11 @@ export class HeroViewComp extends CCComp {
|
||||
if(this.stop_cd > 0){
|
||||
return
|
||||
}
|
||||
if (this.scale === 1 && this.node.position.x >= 120) {
|
||||
if (this.scale === 1 && this.node.position.x >= BoxSet.MONSTER_START) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(this.scale===-1&&this.node.position.x <= BoxSet.HERO_START){
|
||||
if(this.scale===-1&&this.node.position.x <= BoxSet.HERO_START-this.atk_cd){
|
||||
return;
|
||||
}
|
||||
if(this.enemy){
|
||||
|
||||
@@ -4,7 +4,7 @@ import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/modu
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { BoxSet } from "../common/config/BoxSet";
|
||||
import { MapViewScene } from "./view/MapViewScene";
|
||||
import { CSkill } from "../monster/CSkill";
|
||||
import { CSkill } from "../skills/CSkill";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
|
||||
@@ -63,9 +63,9 @@ export class BoxRangComp extends CCComp {
|
||||
this.MonViewComp.enemy = otherCollider.node;
|
||||
}
|
||||
}
|
||||
if(Math.abs(other_pos.x-self_pos.x) < this.atk_range){
|
||||
if(Math.abs(other_pos.x-self_pos.x) < this.MonViewComp.atk_dis){
|
||||
this.MonViewComp.is_atking = true;
|
||||
// this.MonViewComp.stop_cd = 0.1
|
||||
this.MonViewComp.stop_cd = 0.1
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -83,6 +83,7 @@ export class Mon extends ecs.Entity {
|
||||
mv.level = smc.monsters[uuid].level;
|
||||
mv.atk = smc.monsters[uuid].atk;
|
||||
mv.atk_cd = smc.monsters[uuid].atk_cd;
|
||||
mv.atk_dis = smc.monsters[uuid].atk_dis;
|
||||
mv.power = smc.monsters[uuid].power;
|
||||
mv.type = smc.monsters[uuid].type;
|
||||
mv.skill_uuid = 9001;
|
||||
|
||||
@@ -64,6 +64,7 @@ export class MonViewComp extends CCComp {
|
||||
atk: number = 10; /**攻击力 */
|
||||
// atk_speed: number = 1;
|
||||
atk_cd: number = 1.3; /**攻击速度 攻击间隔 */
|
||||
atk_dis: number = 80;
|
||||
atk_time: number = 0; /** 冷却时间 */
|
||||
|
||||
speed: number = 100; /** 角色移动速度 */
|
||||
@@ -138,29 +139,29 @@ export class MonViewComp extends CCComp {
|
||||
onEndContact (selfCollider: Collider2D, otherCollider: Collider2D) { }
|
||||
onPreSolve (selfCollider: Collider2D, otherCollider: Collider2D) {
|
||||
|
||||
if(selfCollider.group != otherCollider.group&&otherCollider.tag == 0){
|
||||
this.is_atking = true;
|
||||
this.stop_cd = 0.1;
|
||||
}
|
||||
// if(selfCollider.group != otherCollider.group&&otherCollider.tag == 0){
|
||||
// this.is_atking = true;
|
||||
// this.stop_cd = 0.1;
|
||||
// }
|
||||
}
|
||||
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D) {
|
||||
if(selfCollider.group == otherCollider.group&&otherCollider.tag == 0&&selfCollider.tag == 0){
|
||||
let self_pos=selfCollider.node.getPosition();
|
||||
let other_pos=otherCollider.node.getPosition();
|
||||
// console.log('mon view group 相同');
|
||||
switch (selfCollider.group) {
|
||||
case BoxSet.HERO:
|
||||
if(self_pos.x < other_pos.x){
|
||||
// this.stop_cd=0.1
|
||||
}
|
||||
break;
|
||||
case BoxSet.MONSTER:
|
||||
if(self_pos.x > other_pos.x){
|
||||
// this.stop_cd=0.1
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
// if(selfCollider.group == otherCollider.group&&otherCollider.tag == 0&&selfCollider.tag == 0){
|
||||
// let self_pos=selfCollider.node.getPosition();
|
||||
// let other_pos=otherCollider.node.getPosition();
|
||||
// // console.log('mon view group 相同');
|
||||
// switch (selfCollider.group) {
|
||||
// case BoxSet.HERO:
|
||||
// if(self_pos.x < other_pos.x){
|
||||
// // this.stop_cd=0.1
|
||||
// }
|
||||
// break;
|
||||
// case BoxSet.MONSTER:
|
||||
// if(self_pos.x > other_pos.x){
|
||||
// // this.stop_cd=0.1
|
||||
// }
|
||||
// break
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@@ -186,7 +187,7 @@ export class MonViewComp extends CCComp {
|
||||
return;
|
||||
}
|
||||
|
||||
if(this.scale===-1&&this.node.position.x <= BoxSet.HERO_START){
|
||||
if(this.scale===-1&&this.node.position.x <= BoxSet.HERO_START+this.atk_cd){
|
||||
return;
|
||||
}
|
||||
// if(this.enemy){
|
||||
|
||||
@@ -4,15 +4,12 @@ import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/modu
|
||||
import { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer";
|
||||
import { Skill } from "../skills/Skill";
|
||||
import { SkillSet } from "../common/config/SkillSet";
|
||||
import { Monster } from "./Monster";
|
||||
import { MonsterModelComp } from "./MonsterModelComp";
|
||||
import { MonsterViewComp } from "./MonsterViewComp";
|
||||
import { BoxSet, GameSet } from "../common/config/BoxSet";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { HeroModelComp } from "./HeroModelComp";
|
||||
import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
|
||||
import { MonModelComp } from "../mon/MonModelComp";
|
||||
import { HeroModelComp } from "../hero/HeroModelComp";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
Reference in New Issue
Block a user