dd
This commit is contained in:
@@ -82,7 +82,7 @@ export class Boss extends ecs.Entity {
|
||||
bs.atk_dis = smc.monsters[uuid].atk_dis;
|
||||
bs.power = smc.monsters[uuid].power;
|
||||
bs.power_max = smc.monsters[uuid].power_max;
|
||||
|
||||
bs.skill = smc.monsters[uuid].skill_uuid;
|
||||
bs.type = smc.monsters[uuid].type;
|
||||
bs.scale = -1;
|
||||
bs.Tpos = v3(0,0,0);
|
||||
|
||||
@@ -9,7 +9,7 @@ import { Vec3, v3,_decorator ,Collider2D,Contact2DType,Label,Node,Prefab,instant
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { BossSpine } from "./BossSpine";
|
||||
import {BoxSet} from "../common/config/BoxSet"
|
||||
import {BoxSet, GameSet} from "../common/config/BoxSet"
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { SkillCom } from "../skills/SkillCom";
|
||||
import { Skill } from "../skills/Skill";
|
||||
@@ -19,7 +19,8 @@ import { RandomManager } from "../../../../extensions/oops-plugin-framework/asse
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { MoveToComp } from "../common/ecs/position/MoveTo";
|
||||
import { Tooltip } from "../skills/Tooltip";
|
||||
import { MonViewComp } from "../mon/MonViewComp";
|
||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 角色显示组件 */
|
||||
@@ -82,7 +83,7 @@ export class BossViewComp extends CCComp {
|
||||
shield_max:number = 200;
|
||||
shield_time:number = 0; //护盾持续时间
|
||||
|
||||
box_group:number = BoxSet.HERO;
|
||||
box_group:number = BoxSet.MONSTER;
|
||||
atk_range:number = 150;
|
||||
private timer:Timer = new Timer(0.1); //计时器
|
||||
is_dead:boolean = false; //是否摧毁
|
||||
@@ -92,6 +93,7 @@ export class BossViewComp extends CCComp {
|
||||
onLoad() {
|
||||
// this.BoxRang = this.node.getChildByName("range_box");
|
||||
this.as = this.node.getComponent(BossSpine);
|
||||
console.log(this.as)
|
||||
|
||||
}
|
||||
start () {
|
||||
@@ -175,37 +177,38 @@ export class BossViewComp extends CCComp {
|
||||
this.in_stop(dt);
|
||||
this.atk_time += dt;
|
||||
this.in_atk();
|
||||
// this.move();
|
||||
this.check_enemys()
|
||||
this.move(dt);
|
||||
this.check_enemy_alive()
|
||||
}
|
||||
check_enemys(){
|
||||
let enemys=ecs.query(ecs.allOf(MonViewComp));
|
||||
if(enemys.length > 0){
|
||||
let x= 720
|
||||
for (let i = 0; i < enemys.length; i++) {
|
||||
let enemy:any = enemys[i];
|
||||
if(!enemy.MonView) continue
|
||||
let node=enemy.MonView.node
|
||||
if(node.isValid){
|
||||
if(node.position.x < x){
|
||||
x=node.position.x
|
||||
this.enemy = node.position;
|
||||
}
|
||||
}
|
||||
check_enemy_alive(){
|
||||
let dir = 320
|
||||
for (let i = 0; i < GameSet.ATK_LINES; i++) {
|
||||
let hero:any = smc.hero_pos[i];
|
||||
let x=Math.abs(hero.x-this.node.position.x)
|
||||
let y = Math.abs(hero.y-this.node.position.y)
|
||||
let squaredDistance =x*x+y*y
|
||||
let distance = Math.sqrt(squaredDistance);
|
||||
if(distance < dir){
|
||||
dir = distance
|
||||
this.enemy = hero
|
||||
}
|
||||
|
||||
}
|
||||
if(dir < this.atk_dis){
|
||||
this.is_atking=true
|
||||
}else{
|
||||
this.enemy = v3(720,this.node.position.y);
|
||||
this.is_atking=false
|
||||
}
|
||||
}
|
||||
move(){
|
||||
move(dt:number){
|
||||
if(this.stop_cd > 0){
|
||||
return
|
||||
}
|
||||
if(this.enemy){
|
||||
this.move_to(this.enemy.position)
|
||||
}else{
|
||||
this.move_to(v3(0,0));
|
||||
if(this.scale===-1&&this.node.position.x <= BoxSet.HERO_START){
|
||||
return;
|
||||
}
|
||||
// this.set_diry()
|
||||
this.node.setPosition(this.node.position.x+dt*this.speed*this.scale, this.node.position.y+dt*this.dir_y, this.node.position.z);
|
||||
}
|
||||
move_to(enemy:Vec3){
|
||||
// console.log("move to ",enemy);
|
||||
@@ -222,7 +225,7 @@ export class BossViewComp extends CCComp {
|
||||
shoot(skill_uuid:number,y:number=0,x:number=0){
|
||||
// console.log("mon shoot");
|
||||
let skill = ecs.getEntity<Skill>(Skill);
|
||||
let atk = smc.skills[skill_uuid].atk+this.atk+this.buff_atk+this.mission_atk;
|
||||
let atk = smc.skills[skill_uuid].atk+this.atk+this.buff_atk;
|
||||
let {pos,t_pos}=this.get_enemy_pos()
|
||||
pos.y=pos.y + y
|
||||
pos.x=pos.x + x
|
||||
@@ -241,16 +244,7 @@ export class BossViewComp extends CCComp {
|
||||
}
|
||||
return {pos,t_pos}
|
||||
}
|
||||
check_enemy_alive(){
|
||||
if(this.enemy){
|
||||
if(!this.enemy.isValid){
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}else{
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
in_atk() {
|
||||
if(this.atk_time >= this.atk_cd){
|
||||
// if(this.is_atking&&this.check_enemy_alive()){
|
||||
|
||||
@@ -67,7 +67,7 @@ export class MapMonsterComp extends CCComp {
|
||||
this.refresh_timer= new Timer(smc.vm_data.gold.cd*5);
|
||||
this.monster_refresh()
|
||||
this.load_role()
|
||||
// this.load_boss()
|
||||
this.load_boss()
|
||||
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ export class MapMonsterComp extends CCComp {
|
||||
load_boss(){
|
||||
let bs:any = RandomManager.instance.getRandomByObjectList(this.boss_list[this.monster_level],1)
|
||||
var scene = smc.map.MapView.scene;
|
||||
let pos:Vec3 = v3(400,BoxSet.GAME_LINE-50)
|
||||
let pos:Vec3 = v3(260,BoxSet.GAME_LINE-50)
|
||||
let layer = scene.entityLayer!.node!
|
||||
let b = ecs.getEntity<Boss>(Boss);
|
||||
let scale = -1
|
||||
|
||||
Reference in New Issue
Block a user