假期修改
This commit is contained in:
@@ -55,7 +55,7 @@ export class Role extends ecs.Entity {
|
||||
var rv = node.getComponent(RoleViewComp)!;
|
||||
let role=smc.vm_data.role;
|
||||
rv.hero_uuid=uuid;
|
||||
rv.speed =rv.ospeed = 0;
|
||||
rv.speed =rv.ospeed = role.speed;
|
||||
rv.hero_name= "role";
|
||||
rv.hp= rv.hp_max = role.hp;
|
||||
rv.level = role.lv;
|
||||
|
||||
83
assets/script/game/Role/RoleAnm.ts
Normal file
83
assets/script/game/Role/RoleAnm.ts
Normal file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* @Author: dgflash
|
||||
* @Date: 2022-08-04 15:08:35
|
||||
* @LastEditors: dgflash
|
||||
* @LastEditTime: 2022-08-04 15:26:26
|
||||
*/
|
||||
import { Color, Component, EventTouch, sp, Vec3, _decorator ,Animation, AnimationClip, AnimationState} from "cc";
|
||||
import { LayerUtil } from "../../../../extensions/oops-plugin-framework/assets/core/utils/LayerUtil";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import RoleSpineAnimator from "./RoleSpineAnimator";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/**
|
||||
* RPG SPINE角色模型
|
||||
*/
|
||||
@ccclass('RoleSpine')
|
||||
export class RoleSpine extends Component {
|
||||
@property({ type: Animation, tooltip: '动画控制器' })
|
||||
animator: Animation = null!;
|
||||
atk_clip: AnimationClip = null!;
|
||||
idle_clip: AnimationClip = null!;
|
||||
move_clip: AnimationClip = null!;
|
||||
dead_clip: AnimationClip = null!;
|
||||
private spine!: sp.Skeleton;
|
||||
|
||||
onLoad() {
|
||||
// 角色控制组件
|
||||
|
||||
this.initAnimator();
|
||||
LayerUtil.setNodeLayer(LayerUtil.MAP, this.node);
|
||||
this.atk_clip = this.animator.clips[1];
|
||||
this.idle_clip = this.animator.clips[0];
|
||||
this.move_clip = this.animator.clips[2];
|
||||
this.dead_clip = this.animator.clips[3];
|
||||
let animation = this.animator.getComponent(Animation);
|
||||
animation.on(Animation.EventType.FINISHED, this.onAnimationEvent, this)
|
||||
}
|
||||
|
||||
/** 初始化动画 */
|
||||
protected initAnimator() {
|
||||
this.animator=this.node.getChildByName("hero").getComponent(Animation);
|
||||
// console.log("role view comp init",this.animator);
|
||||
|
||||
}
|
||||
onAnimationEvent(type: Animation.EventType, state: AnimationState){
|
||||
// console.log("onAnimationEvent",type,state);
|
||||
if(type==Animation.EventType.FINISHED){
|
||||
if(state.name==this.atk_clip.name){
|
||||
this.idle();
|
||||
}
|
||||
}
|
||||
}
|
||||
atk() {
|
||||
if(!this.animator.getState(this.atk_clip.name).isPlaying){
|
||||
this.animator.play(this.atk_clip.name);
|
||||
}
|
||||
}
|
||||
|
||||
magic() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
checkTouch(event: EventTouch): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
this.node.destroy();
|
||||
}
|
||||
|
||||
walk() {
|
||||
|
||||
}
|
||||
|
||||
idle() {
|
||||
if(!this.animator.getState(this.idle_clip.name).isPlaying){
|
||||
this.animator.play(this.idle_clip.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
9
assets/script/game/Role/RoleAnm.ts.meta
Normal file
9
assets/script/game/Role/RoleAnm.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "d1d8d0c9-9cff-4d85-a359-628a29fd5191",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -16,68 +16,43 @@ const { ccclass, property } = _decorator;
|
||||
*/
|
||||
@ccclass('RoleSpine')
|
||||
export class RoleSpine extends Component {
|
||||
@property({ type: Animation, tooltip: '动画控制器' })
|
||||
animator: Animation = null!;
|
||||
atk_clip: AnimationClip = null!;
|
||||
idle_clip: AnimationClip = null!;
|
||||
move_clip: AnimationClip = null!;
|
||||
dead_clip: AnimationClip = null!;
|
||||
private loop: boolean = true;
|
||||
private spine!: sp.Skeleton;
|
||||
private default:string = "move";
|
||||
private atk_name: string = "atk";
|
||||
private move_name: string = "move";
|
||||
private max_name: string = "max";
|
||||
private idel_name: string = "idle";
|
||||
start() {
|
||||
this.spine.setAnimation(0, this.default, true);
|
||||
}
|
||||
mixTime:number= 0.2;
|
||||
|
||||
onLoad() {
|
||||
// 角色控制组件
|
||||
|
||||
this.initAnimator();
|
||||
LayerUtil.setNodeLayer(LayerUtil.MAP, this.node);
|
||||
this.atk_clip = this.animator.clips[1];
|
||||
this.idle_clip = this.animator.clips[0];
|
||||
this.move_clip = this.animator.clips[2];
|
||||
this.dead_clip = this.animator.clips[3];
|
||||
let animation = this.animator.getComponent(Animation);
|
||||
animation.on(Animation.EventType.FINISHED, this.onAnimationEvent, this)
|
||||
this.spine = this.node.getChildByName("anm")!.getComponent(sp.Skeleton);
|
||||
this.spine.setEndListener(trackEntry => {
|
||||
var animationName = trackEntry.animation ? trackEntry.animation.name : "";
|
||||
console.log("[track %s][animation %s] end.", trackEntry.trackIndex, animationName);
|
||||
// if (animationName == "atk" || animationName== "max" ) {
|
||||
// this.spine.setAnimation(0, this.default, true);
|
||||
// }
|
||||
});
|
||||
}
|
||||
|
||||
/** 初始化动画 */
|
||||
protected initAnimator() {
|
||||
this.animator=this.node.getChildByName("hero").getComponent(Animation);
|
||||
// console.log("role view comp init",this.animator);
|
||||
|
||||
}
|
||||
onAnimationEvent(type: Animation.EventType, state: AnimationState){
|
||||
// console.log("onAnimationEvent",type,state);
|
||||
if(type==Animation.EventType.FINISHED){
|
||||
if(state.name==this.atk_clip.name){
|
||||
this.idle();
|
||||
}
|
||||
}
|
||||
}
|
||||
atk() {
|
||||
if(!this.animator.getState(this.atk_clip.name).isPlaying){
|
||||
this.animator.play(this.atk_clip.name);
|
||||
}
|
||||
}
|
||||
|
||||
magic() {
|
||||
protected play(animName: string, loop: boolean) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
checkTouch(event: EventTouch): boolean {
|
||||
return false;
|
||||
atk(){
|
||||
|
||||
this.spine.setAnimation(0, this.atk_name, false);
|
||||
}
|
||||
idle(){
|
||||
this.spine.setAnimation(0, this.idel_name, true);
|
||||
}
|
||||
move(){
|
||||
this.spine.setAnimation(0, this.move_name, true);
|
||||
}
|
||||
max(){
|
||||
this.spine.setAnimation(0, this.max_name, false);
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
this.node.destroy();
|
||||
}
|
||||
|
||||
walk() {
|
||||
|
||||
}
|
||||
|
||||
idle() {
|
||||
if(!this.animator.getState(this.idle_clip.name).isPlaying){
|
||||
this.animator.play(this.idle_clip.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* @LastEditTime: 2022-08-17 12:36:18
|
||||
*/
|
||||
|
||||
import { Vec3, v3,_decorator ,Collider2D,Contact2DType,Label,Node,Prefab,instantiate,ProgressBar, Component, Material, Sprite,Animation, director} from "cc";
|
||||
import { Vec3, v3,_decorator ,Collider2D,Contact2DType,Label,Node,Prefab,instantiate,ProgressBar, Component, Material, Sprite,Animation, director, Vertex} 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 { RoleSpine } from "./RoleSpine";
|
||||
@@ -30,6 +30,8 @@ export class RoleViewComp extends CCComp {
|
||||
@property(Material)
|
||||
hitFlashMaterial: Material;
|
||||
orginalFlashMaterial: Material;
|
||||
@property(Material)
|
||||
atkMaterial: Material;
|
||||
sprite: Sprite;
|
||||
/** 角色动画 */
|
||||
@property(Node)
|
||||
@@ -61,7 +63,11 @@ export class RoleViewComp extends CCComp {
|
||||
4:{uuid:8001,cd:2,alive:false},
|
||||
5:{uuid:8001,cd:2,alive:false},
|
||||
}
|
||||
buff_atks:any = [];
|
||||
buff_atk:number = 0;
|
||||
|
||||
atk: number = 10; /**攻击力 */
|
||||
mission_atk:number = 0;//局内攻击
|
||||
// atk_speed: number = 1;
|
||||
atk_cd: number = 1.3; /**攻击速度 攻击间隔 */
|
||||
atk_dis: number = 800;
|
||||
@@ -89,7 +95,7 @@ export class RoleViewComp extends CCComp {
|
||||
|
||||
}
|
||||
start () {
|
||||
this.sprite = this.node.getChildByName("hero").getComponent(Sprite);
|
||||
// this.sprite = this.node.getChildByName("hero").getComponent(Sprite);
|
||||
this.node.getChildByName("top").setScale(this.scale,1);
|
||||
// this.node.getChildByName("atk").setScale(this.scale,1);
|
||||
// this.node.getChildByName("atk").getComponent(Label).string = this.atk.toString();
|
||||
@@ -97,7 +103,9 @@ export class RoleViewComp extends CCComp {
|
||||
// this.node.getChildByName("hp_max").getComponent(Label).string=this.hp_max.toString();
|
||||
|
||||
|
||||
this.orginalFlashMaterial = this.sprite.getRenderMaterial(0);
|
||||
// this.orginalFlashMaterial = this.sprite.getRenderMaterial(0);
|
||||
|
||||
|
||||
|
||||
this.BoxRang.getComponent(RoleRangComp).box_group = this.box_group;
|
||||
this.BoxRang.getComponent(RoleRangComp).atk_range = this.atk_range
|
||||
@@ -129,30 +137,37 @@ export class RoleViewComp 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&&selfCollider.tag==otherCollider.tag){
|
||||
|
||||
if(selfCollider.node.position.y < otherCollider.node.position.y){
|
||||
if(selfCollider.node.getSiblingIndex() < otherCollider.node.getSiblingIndex()){
|
||||
|
||||
selfCollider.node.setSiblingIndex(otherCollider.node.getSiblingIndex()+1)
|
||||
// console.log("onPreSolve b:"+selfCollider.node.uuid+":"+selfCollider.node.getSiblingIndex()+"/"+otherCollider.node.uuid+":"+otherCollider.node.getSiblingIndex());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
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('monster 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('monster 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
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@@ -161,27 +176,40 @@ export class RoleViewComp extends CCComp {
|
||||
|
||||
}
|
||||
this.in_destroy();
|
||||
this.in_shield();
|
||||
this.check_buff_atks(dt)
|
||||
this.in_shield(dt);
|
||||
this.in_stop(dt);
|
||||
this.in_atk(dt);
|
||||
this.move(dt);
|
||||
this.move();
|
||||
|
||||
}
|
||||
|
||||
move(dt: number){
|
||||
move(){
|
||||
if(this.stop_cd > 0){
|
||||
return
|
||||
}
|
||||
if (this.scale === 1 && this.node.position.x >= 120) {
|
||||
return;
|
||||
if(this.enemy){
|
||||
this.move_to(this.enemy.position)
|
||||
}else{
|
||||
this.move_to(v3(0,0));
|
||||
}
|
||||
}
|
||||
move_to(enemy:Vec3){
|
||||
// console.log("move to ",enemy);
|
||||
var move = this.ent.get(MoveToComp) || this.ent.add(MoveToComp);
|
||||
move.target = v3(enemy.x-100,enemy.y);
|
||||
move.node = this.node;
|
||||
move.speed = this.ospeed;
|
||||
if(enemy.x < this.node.position.x){
|
||||
this.node.setScale(-1,1);
|
||||
}else{
|
||||
this.node.setScale(1,1);
|
||||
}
|
||||
this.node.setPosition(this.node.position.x+dt*this.speed*this.scale, this.node.position.y, this.node.position.z);
|
||||
}
|
||||
|
||||
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;
|
||||
let atk = smc.skills[skill_uuid].atk+this.atk+this.buff_atk+this.mission_atk;
|
||||
let {pos,t_pos}=this.get_enemy_pos()
|
||||
pos.y=pos.y + y
|
||||
pos.x=pos.x + x
|
||||
@@ -227,9 +255,6 @@ export class RoleViewComp extends CCComp {
|
||||
}else{
|
||||
this.atk_time += dt;
|
||||
}
|
||||
}
|
||||
in_shield(){
|
||||
|
||||
}
|
||||
hp_change(hp: number){
|
||||
if(this.is_dead){
|
||||
@@ -249,18 +274,67 @@ export class RoleViewComp extends CCComp {
|
||||
if(this.hp <= 0){
|
||||
this.dead();
|
||||
this.is_dead = true;
|
||||
this.ent.remove(MoveToComp)
|
||||
smc.vm_data.game_over = true;
|
||||
setTimeout(() => {
|
||||
this.ent.destroy();
|
||||
}, 15);
|
||||
}
|
||||
}
|
||||
heathed(){
|
||||
this.node.getChildByName("heathed").active=true
|
||||
}
|
||||
add_hp(hp: number=0){
|
||||
console.log("hero 加血动画");
|
||||
this.heathed();
|
||||
this.tooltip(2,hp.toString());
|
||||
let hp_progress= this.hp/this.hp_max;
|
||||
this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
|
||||
}
|
||||
add_atk(atk: number,time:number=0){
|
||||
if(time > 0){
|
||||
this.buff_atk=0
|
||||
let buff={atk:atk,time:time}
|
||||
this.buff_atks.push(buff);
|
||||
this.buff_atks.forEach((element: { atk: number; }) => {
|
||||
this.buff_atk += element.atk
|
||||
});
|
||||
}else{
|
||||
this.mission_atk += atk;
|
||||
}
|
||||
// this.sprite.setSharedMaterial(this.atkMaterial, 0);
|
||||
// this.scheduleOnce(() => {
|
||||
// this.sprite.setSharedMaterial(this.orginalFlashMaterial, 0);
|
||||
// }, 0.3);
|
||||
}
|
||||
|
||||
check_buff_atks(dt: number){
|
||||
for(let i=0;i<this.buff_atks.length;i++){
|
||||
let buff=this.buff_atks[i];
|
||||
buff.time -= dt;
|
||||
if(buff.time <= 0){
|
||||
this.buff_atk -= buff.atk
|
||||
this.buff_atks.splice(i,1);
|
||||
}
|
||||
}
|
||||
if(this.buff_atks.length <= 0){
|
||||
this.buff_atk = 0
|
||||
this.buff_icon_change("atk",false)
|
||||
}else{
|
||||
this.buff_icon_change("atk",true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
buff_icon_change(icon:string,value:boolean){
|
||||
this.node.getChildByName("top").getChildByName("buff").getChildByName(icon).active=value
|
||||
}
|
||||
|
||||
|
||||
|
||||
add_shield(shield: number,time:number=0){
|
||||
this.shield =this.shield_max=shield
|
||||
this.shield_time = time;
|
||||
}
|
||||
shield_change(hp: number){
|
||||
let ls=this.shield - hp;
|
||||
if(ls <= 0){
|
||||
@@ -271,6 +345,29 @@ export class RoleViewComp extends CCComp {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
in_shield(dt: number){
|
||||
if(this.shield <= 0){
|
||||
this.shield_time=0
|
||||
this.node.getChildByName("shielded").active=false
|
||||
}else{
|
||||
this.node.getChildByName("shielded").active=true
|
||||
}
|
||||
if(this.shield_time <= 0){
|
||||
this.shield = this.shield_max=0;
|
||||
this.node.getChildByName("shielded").active=false
|
||||
return
|
||||
}
|
||||
if(this.shield_time > 0){
|
||||
this.shield_time -= dt;
|
||||
if(this.shield_time <= 0){
|
||||
this.shield_time = 0;
|
||||
this.shield = this.shield_max=0;
|
||||
// this.node.getChildByName("top").getChildByName("shield").active=false
|
||||
}
|
||||
// let shield_progress= this.shield/this.shield_max;
|
||||
// this.node.getChildByName("top").getChildByName("shield").getComponent(ProgressBar)!.progress = shield_progress;
|
||||
}
|
||||
}
|
||||
tooltip(type:number=1,value:string="",s_uuid:number=1001){
|
||||
// console.log("tooltip",type);
|
||||
let tip =ecs.getEntity<Tooltip>(Tooltip);
|
||||
@@ -309,18 +406,18 @@ export class RoleViewComp extends CCComp {
|
||||
|
||||
in_atked() {
|
||||
|
||||
// var path = "game/skills/atked";
|
||||
// var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
// var node = instantiate(prefab);
|
||||
// let pos = v3(0,60)
|
||||
// node.setPosition(pos)
|
||||
// node.parent = this.node;
|
||||
var path = "game/skills/atked";
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
var node = instantiate(prefab);
|
||||
let pos = v3(0,60)
|
||||
node.setPosition(pos)
|
||||
node.parent = this.node;
|
||||
|
||||
|
||||
this.sprite.setSharedMaterial(this.hitFlashMaterial, 0);
|
||||
this.scheduleOnce(() => {
|
||||
this.sprite.setSharedMaterial(this.orginalFlashMaterial, 0);
|
||||
}, 0.1);
|
||||
// this.sprite.setSharedMaterial(this.hitFlashMaterial, 0);
|
||||
// this.scheduleOnce(() => {
|
||||
// this.sprite.setSharedMaterial(this.orginalFlashMaterial, 0);
|
||||
// }, 0.1);
|
||||
|
||||
|
||||
|
||||
@@ -331,9 +428,6 @@ export class RoleViewComp extends CCComp {
|
||||
var node = instantiate(prefab);
|
||||
node.setPosition(this.node.position.x,this.node.position.y+30,this.node.position.z);
|
||||
node.parent = this.node.parent;
|
||||
}
|
||||
heathed(){
|
||||
|
||||
}
|
||||
toDestroy(){
|
||||
|
||||
|
||||
@@ -23,27 +23,45 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
/** 游戏地图 */
|
||||
map: GameMap = null!;
|
||||
cards: any = [
|
||||
{uuid:9001,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:9041,type:1}
|
||||
];
|
||||
items: any = [
|
||||
{uuid:1001,type:2},{uuid:1002,type:2},{uuid:4011,type:2},{uuid:4012,type:2},
|
||||
|
||||
{uuid:6210,type:3},{uuid:6211,type:3},{uuid:6005,type:3},{uuid:6006,type:3},{uuid:6101,type:3},{uuid:6102,type:3},
|
||||
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},
|
||||
// {uuid:6213,type:2},{uuid:6214,type:2},{uuid:6215,type:2},
|
||||
// {uuid:6216,type:2},{uuid:6217,type:2},{uuid:6218,type:2}
|
||||
];
|
||||
items: any = []
|
||||
player_skills: any = [
|
||||
];
|
||||
player_buffs: any = [
|
||||
|
||||
{x:-BoxSet.CSKILL_X,y:BoxSet.CSKILL_Y,eid:0},
|
||||
{x:-BoxSet.CSKILL_X+55,y:BoxSet.CSKILL_Y,eid:0},
|
||||
{x:-BoxSet.CSKILL_X+110,y:BoxSet.CSKILL_Y,eid:0},
|
||||
{x:-BoxSet.CSKILL_X+165,y:BoxSet.CSKILL_Y,eid:0},
|
||||
{x:-BoxSet.CSKILL_X,y:BoxSet.CSKILL_Y,eid:0},
|
||||
|
||||
{x:-BoxSet.CSKILL_X,y:BoxSet.CSKILL_Y+55,eid:0},
|
||||
{x:-BoxSet.CSKILL_X+55,y:BoxSet.CSKILL_Y+55,eid:0},
|
||||
{x:-BoxSet.CSKILL_X+110,y:BoxSet.CSKILL_Y+55,eid:0},
|
||||
{x:-BoxSet.CSKILL_X+165,y:BoxSet.CSKILL_Y+55,eid:0},
|
||||
];
|
||||
role_heros: any = [
|
||||
{x:BoxSet.ROLE_FUX,y:50,eid:0},
|
||||
{x:BoxSet.ROLE_FUX,y:0,eid:0},
|
||||
{x:BoxSet.ROLE_FUX,y:-50,eid:0},
|
||||
|
||||
{x:BoxSet.ROLE_FUX+40,y:50,eid:0},
|
||||
{x:BoxSet.ROLE_FUX+40,y:0,eid:0},
|
||||
{x:BoxSet.ROLE_FUX+40,y:-50,eid:0},
|
||||
|
||||
{x:BoxSet.ROLE_BUX,y:50,eid:0},
|
||||
{x:BoxSet.ROLE_BUX,y:0,eid:0},
|
||||
{x:BoxSet.ROLE_BUX,y:-50,eid:0},
|
||||
|
||||
{x:BoxSet.ROLE_BUX-40,y:50,eid:0},
|
||||
{x:BoxSet.ROLE_BUX-40,y:0,eid:0},
|
||||
{x:BoxSet.ROLE_BUX-40,y:-50,eid:0},
|
||||
|
||||
];
|
||||
monster_buffs: any = [];
|
||||
/** 游戏主角 */
|
||||
Role: Role = null;
|
||||
@@ -80,14 +98,19 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
role:{
|
||||
hp:3000,
|
||||
hp_max:3000,
|
||||
speed:30,
|
||||
atk:10,
|
||||
atk_cd:2,
|
||||
atk_range:1000,
|
||||
buff_atk:0,
|
||||
mission_atk:0,
|
||||
atk_cd:1,
|
||||
atk_cd_up:0,
|
||||
mission_atk_cd_up:0,
|
||||
atk_range:400,
|
||||
lv:1,
|
||||
exp:0,
|
||||
next_exp:100,
|
||||
power:300,
|
||||
skill:1001,
|
||||
skill:8001,
|
||||
skills:{
|
||||
1:{uuid:8001,cd:2,alive:true },
|
||||
2:{uuid:9002,cd:2,alive:false},
|
||||
@@ -105,9 +128,9 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
up_cost:4,
|
||||
},
|
||||
gold: {
|
||||
min: 1,
|
||||
min: 200,
|
||||
max: 200,
|
||||
max_limit:10,
|
||||
max_limit:200,
|
||||
time:0,
|
||||
cd:1,
|
||||
},
|
||||
|
||||
@@ -37,6 +37,18 @@ export enum BoxSet {
|
||||
MAX_SKILL_SY = 50,
|
||||
MAX_SKILL_BY = 80,
|
||||
ATK_Y = 20,
|
||||
|
||||
ROLE_FUX=80,
|
||||
ROLE_FUY=40,
|
||||
|
||||
ROLE_FDX=80,
|
||||
ROLE_FDY=-40,
|
||||
|
||||
ROLE_BUX=-80,
|
||||
ROLE_BUY=40,
|
||||
|
||||
ROLE_BDX=-80,
|
||||
ROLE_BDY=-40,
|
||||
}
|
||||
export enum GameSet {
|
||||
ATK_TO_ATK_RATIO=0.1,
|
||||
|
||||
@@ -4,17 +4,17 @@
|
||||
|
||||
export const CardList={
|
||||
1:[
|
||||
{uuid:9001,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:9041,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: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:9041,type:1}
|
||||
],
|
||||
3:[
|
||||
{uuid:9001,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:9041,type:1}
|
||||
],
|
||||
4:[
|
||||
{uuid:9001,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:9041,type:1}
|
||||
],
|
||||
5:[
|
||||
{uuid:1001,type:2},{uuid:1002,type:2},{uuid:4011,type:2},{uuid:4012,type:2},
|
||||
|
||||
70
assets/script/game/common/config/ItemSet.ts
Normal file
70
assets/script/game/common/config/ItemSet.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
type :
|
||||
1: 远距离攻击,碰撞后 结束
|
||||
2: 远距离攻击,碰撞后 持续,直到技能结束
|
||||
3: 远距离攻击,碰撞后 持续,带击退功能
|
||||
4: 双技能技能,1技能结束后,触发2技能
|
||||
5: 特殊技能,触发特殊弹窗选项
|
||||
6: 近距离攻击,碰撞后
|
||||
9: buff物品,
|
||||
91: 单体buff,加最少血,临时
|
||||
92:单体buff,随机或自己,临时
|
||||
93: 群体buff物品
|
||||
94:role buff
|
||||
tg: 对象,0 自己,1:同伴 ,2 自己和同伴,3:敌人,4,自己和对人
|
||||
dis: 是否移动 1 移动 0 原地
|
||||
sd: 持续时间
|
||||
cd: 卡片技能释放本技能cd
|
||||
count:卡片1次释放本技能数
|
||||
bsd:buff技能作用持续时间 ,bsd=0 为永久
|
||||
bcd:buff技能执行一次间隔
|
||||
sk_uuid:子技能id
|
||||
sk_count:子技能个数
|
||||
sp_name : 预制体名称
|
||||
path: 图片地址
|
||||
|
||||
*/
|
||||
|
||||
export const Items={
|
||||
|
||||
6005:{uuid: 6005,path: "6005",type: 93,level: 3,name: "钢盾",sp_name:"",info:"",
|
||||
dis:1,count:1,in:0,run:0,atk:0,hp:0,shield:100,sd:30,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
6006:{uuid: 6006,path: "6006",type: 94,level: 3,name: "魔法盾",sp_name:"",info:"",
|
||||
dis:1,count:1,in:0,run:0,atk:0,hp:0,shield:300,sd:30,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
6101:{uuid: 6101,path: "6101",type: 91,level: 1,name: "初级药水",sp_name:"",info:"",
|
||||
dis:1,count:1,in:0,run:0,atk:0,hp:100,shield:0,sd:30,cd:5,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
6102:{uuid: 6102,path: "6102",type: 93,level: 3,name: "高级药水",sp_name:"",info:"",
|
||||
dis:1,count:1,in:0,run:0,atk:0,hp:300,shield:0,sd:30,cd:5,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
6210:{uuid: 6210,path: "6210",type: 92,level: 3,name: "普通攻击石",sp_name:"",info:"",
|
||||
dis:1,count:1,in:0,run:0,atk:20,hp:0,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
6211:{uuid: 6211,path: "6211",type: 93,level: 4,name: "特效攻击石",sp_name:"",info:"",
|
||||
dis:1,count:1,in:0,run:0,atk:30,hp:0,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
6212:{uuid: 6212,path: "6212",type: 94,level: 4,name: "精炼攻击石",sp_name:"",info:"",
|
||||
dis:1,count:1,in:0,run:0,atk:5,hp:0,shield:0,sd:0,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
6213:{uuid: 6213,path: "6213",type: 92,level: 3,name: "普通攻速石",sp_name:"",info:"",
|
||||
dis:1,count:1,in:0,run:0,atk:0,hp:30,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
6214:{uuid: 6214,path: "6214",type: 93,level: 4,name: "特效攻速石",sp_name:"",info:"",
|
||||
dis:1,count:1,in:0,run:0,atk:0,hp:30,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
6215:{uuid: 6215,path: "6215",type: 94,level: 4,name: "精炼攻速石",sp_name:"",info:"",
|
||||
dis:1,count:1,in:0,run:0,atk:5,hp:30,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
6216:{uuid: 6216,path: "6216",type: 92,level: 3,name: "普通技能石",sp_name:"",info:"",
|
||||
dis:1,count:1,in:0,run:0,atk:5,hp:30,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
6217:{uuid: 6217,path: "6217",type: 93,level: 4,name: "特效技能石",sp_name:"",info:"",
|
||||
dis:1,count:1,in:0,run:0,atk:5,hp:30,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
6218:{uuid: 6218,path: "6218",type: 94,level: 4,name: "精炼技能石",sp_name:"",info:"",
|
||||
dis:1,count:1,in:0,run:0,atk:5,hp:30,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
}
|
||||
|
||||
9
assets/script/game/common/config/ItemSet.ts.meta
Normal file
9
assets/script/game/common/config/ItemSet.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "5207ea65-7d56-4895-974a-613fa815c084",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -7,8 +7,8 @@ type :
|
||||
5: 特殊技能,触发特殊弹窗选项
|
||||
6: 近距离攻击,碰撞后
|
||||
9: buff物品,
|
||||
91: 单体buff物品,加最少血,临时
|
||||
92:单体buff物品,随机,临时
|
||||
91: 单体buff,加最少血,临时
|
||||
92:单体buff,随机或自己,临时
|
||||
93: 群体buff物品
|
||||
94:role buff
|
||||
tg: 对象,0 自己,1:同伴 ,2 自己和同伴,3:敌人,4,自己和对人
|
||||
@@ -22,9 +22,7 @@ sk_uuid:子技能id
|
||||
sk_count:子技能个数
|
||||
sp_name : 预制体名称
|
||||
path: 图片地址
|
||||
|
||||
*/
|
||||
|
||||
export const SkillSet={
|
||||
1001:{uuid: 1001,path: "1001",type: 1,tg:3,angle:true,level: 1,name: "火球术",sp_name:"fire",info:"释放一个火球术攻击敌人",
|
||||
dis:1,count:1,in:0,run:0,atk:10,hp:0,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
@@ -36,7 +34,12 @@ export const SkillSet={
|
||||
dis:1,count:1,in:0,run:0,atk:10,hp:0,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
2001:{uuid: 2001,path: "2001",type: 91,tg:1,angle:false,level: 1,name: "治愈术",sp_name:"heath",info:"释放一个寒冰箭攻击敌人",
|
||||
dis:1,count:1,in:0,run:1,atk:10,hp:0,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:450, },
|
||||
dis:1,count:1,in:0,run:1,atk:0,hp:30,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:450, },
|
||||
2002:{uuid: 2002,path: "2002",type: 91,tg:0,angle:false,level: 1,name: "魔法盾",sp_name:"shield",info:"释放一个寒冰箭攻击敌人",
|
||||
dis:1,count:1,in:0.2,run:2,atk:0,hp:0,shield:50,sd:0,cd:0,bsd:30,bcd:0,sk_uuid:1001,sk_count:0,speed:450, },
|
||||
2003:{uuid: 2003,path: "2003",type: 91,tg:0,angle:false,level: 1,name: "狂暴",sp_name:"atkup",info:"释放一个寒冰箭攻击敌人",
|
||||
dis:1,count:1,in:0.2,run:2,atk:10,hp:0,shield:0,sd:0,cd:0,bsd:30,bcd:0,sk_uuid:1001,sk_count:0,speed:450, },
|
||||
|
||||
|
||||
3001:{uuid: 3001,path: "3001",type: 1,tg:3,angle:true,level: 1,name: "三连击",sp_name:"patk",info:"释放一个魔法球攻击敌人",
|
||||
dis:1,count:3,in:0.3,run:2,atk:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600,},
|
||||
@@ -57,53 +60,7 @@ export const SkillSet={
|
||||
8001:{uuid: 8001,path: "8001",type: 1,tg:3,angle:true,level: 1,name: "飞刀",sp_name:"sword1",info:"释放一个魔法球攻击敌人",
|
||||
dis:1,count:1,in:0,run:0,atk:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:8001,sk_count:0,speed:600,},
|
||||
|
||||
|
||||
6210:{uuid: 6210,path: "6210",type: 92,level: 1,name: "普通攻击石",sp_name:"",info:"",
|
||||
dis:1,count:1,in:0,run:0,atk:10,hp:0,shield:0,sd:30,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
6211:{uuid: 6211,path: "6211",type: 93,level: 3,name: "精炼攻击石",sp_name:"",info:"",
|
||||
dis:1,count:1,in:0,run:0,atk:10,hp:0,shield:0,sd:30,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
6005:{uuid: 6005,path: "6005",type: 93,level: 3,name: "钢盾",sp_name:"",info:"",
|
||||
dis:1,count:1,in:0,run:0,atk:0,hp:0,shield:30,sd:30,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
6006:{uuid: 6006,path: "6006",type: 94,level: 3,name: "魔法盾",sp_name:"",info:"",
|
||||
dis:1,count:1,in:0,run:0,atk:0,hp:0,shield:30,sd:30,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
6101:{uuid: 6101,path: "6101",type: 91,level: 1,name: "初级药水",sp_name:"",info:"",
|
||||
dis:1,count:1,in:0,run:0,atk:0,hp:30,shield:0,sd:30,cd:5,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
6102:{uuid: 6102,path: "6102",type: 93,level: 3,name: "高级药水",sp_name:"",info:"",
|
||||
dis:1,count:1,in:0,run:0,atk:0,hp:50,shield:0,sd:30,cd:5,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
}
|
||||
|
||||
export const AllItems={
|
||||
6210:{uuid: 6210,path: "6210",type: 92,level: 3,name: "普通攻击石",sp_name:"",info:"",
|
||||
dis:1,count:1,in:0,run:0,atk:0,hp:30,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
6211:{uuid: 6211,path: "6211",type: 93,level: 4,name: "特效攻击石",sp_name:"",info:"",
|
||||
dis:1,count:1,in:0,run:0,atk:5,hp:0,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
6212:{uuid: 6212,path: "6212",type: 94,level: 4,name: "精炼攻击石",sp_name:"",info:"",
|
||||
dis:1,count:1,in:0,run:0,atk:5,hp:0,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
6213:{uuid: 6213,path: "6213",type: 92,level: 3,name: "普通生命石",sp_name:"",info:"",
|
||||
dis:1,count:1,in:0,run:0,atk:0,hp:30,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
6214:{uuid: 6214,path: "6214",type: 93,level: 4,name: "特效生命石",sp_name:"",info:"",
|
||||
dis:1,count:1,in:0,run:0,atk:0,hp:30,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
6215:{uuid: 6215,path: "6215",type: 94,level: 4,name: "精炼生命石",sp_name:"",info:"",
|
||||
dis:1,count:1,in:0,run:0,atk:5,hp:30,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
6216:{uuid: 6216,path: "6216",type: 92,level: 3,name: "普通全能石",sp_name:"",info:"",
|
||||
dis:1,count:1,in:0,run:0,atk:5,hp:30,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
6217:{uuid: 6217,path: "6217",type: 93,level: 4,name: "特效全能石",sp_name:"",info:"",
|
||||
dis:1,count:1,in:0,run:0,atk:5,hp:30,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
6218:{uuid: 6218,path: "6218",type: 94,level: 4,name: "精炼全能石",sp_name:"",info:"",
|
||||
dis:1,count:1,in:0,run:0,atk:5,hp:30,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
}
|
||||
|
||||
|
||||
@@ -1,28 +1,31 @@
|
||||
|
||||
export const HeroSet = {
|
||||
9001: {
|
||||
uuid: 9001, path: "k3", type: 1, level: 1, name: "战士", atk: 4, hp: 35, atk_dis: 30, atk_cd: 2, power: 0, power_max: 10, speed: 30,
|
||||
max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 3001, word: "守护", info: "自身护盾", atktype: 1,
|
||||
uuid: 9001, path: "k3", type: 1, level: 1,cost:2, name: "骑士", atk: 4, hp: 60, atk_dis: 40, atk_cd: 1, power: 0, power_max: 10, speed: 30,
|
||||
max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 2002, word: "守护", info: "自身护盾", atktype: 1,
|
||||
},
|
||||
|
||||
|
||||
9002: {
|
||||
uuid: 9002, path: "k1", type: 1, level: 1,cost:2, name: "战士", atk: 8, hp: 30, atk_dis: 40, atk_cd: 1, power: 0, power_max: 10, speed: 30,
|
||||
max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 2003, word: "守护", info: "自身护盾", atktype: 1,
|
||||
},
|
||||
9011: {
|
||||
uuid: 9004, path: "m1", type: 1, level: 1, name: "冰法", atk: 4, hp: 15, atk_dis: 200, atk_cd: 2, power: 0, power_max: 10, speed: 30,
|
||||
uuid: 9004, path: "m1", type: 1, level: 1,cost:2, name: "冰法", atk: 15, hp: 20, atk_dis: 300, atk_cd: 2.5, power: 0, power_max: 10, speed: 30,
|
||||
max_skill: "寒冰箭", skill_uuid: 9002, max_skill_uuid: 1002, word: "守护", info: "自身护盾", atktype: 1,
|
||||
},
|
||||
9021: {
|
||||
uuid: 9006, path: "m3", type: 3, level: 1, name: "火法", atk: 6, hp: 15, atk_dis: 200, atk_cd: 2, power: 0, power_max: 10, speed: 30,
|
||||
uuid: 9006, path: "m3", type: 3, level: 1,cost:2, name: "火法", atk: 10, hp: 20, atk_dis: 300, atk_cd: 2, power: 0, power_max: 10, speed: 30,
|
||||
max_skill: "火球术", skill_uuid: 9002, max_skill_uuid: 1001, word: "守护", info: "自身护盾", atktype: 2
|
||||
},
|
||||
|
||||
9031: {
|
||||
uuid: 9005, path: "m2", type: 3, level: 1, name: "牧师", atk: 3, hp: 20, atk_dis: 200, atk_cd: 2, power: 0, power_max: 10, speed: 30,
|
||||
uuid: 9005, path: "m2", type: 3, level: 1,cost:2, name: "牧师", atk: 3, hp: 20, atk_dis: 300, atk_cd: 2, power: 0, power_max: 10, speed: 30,
|
||||
max_skill: "治愈术", skill_uuid: 9002, max_skill_uuid: 2001, word: "守护", info: "自身护盾", atktype: 2
|
||||
},
|
||||
|
||||
|
||||
9041: {
|
||||
uuid: 9009, path: "arc1", type: 3, level: 1, name: "弓箭手", atk: 3, hp: 15, atk_dis: 300, atk_cd: 1, power: 0, power_max: 10, speed: 30,
|
||||
uuid: 9009, path: "arc1", type: 3, level: 1,cost:2, name: "弓箭手", atk: 5, hp: 30, atk_dis: 200, atk_cd: 1.5, power: 0, power_max: 10, speed: 30,
|
||||
max_skill: "精准射击", skill_uuid: 9003, max_skill_uuid: 1003, word: "狂暴", info: "全体攻击", atktype: 2
|
||||
},
|
||||
|
||||
@@ -31,40 +34,29 @@ export const HeroSet = {
|
||||
export const MonSet = {
|
||||
|
||||
1011: {
|
||||
uuid: 1011, path: "orc1", type: 1, level: 1, name: "森林兽人", atk: 4, hp: 30, atk_dis: 30, atk_cd: 2, power: 0, power_max: 10, speed: 30,
|
||||
max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 1001, word: "守护", info: "自身护盾", atktype: 1
|
||||
uuid: 1011, path: "orc1", type: 1, level: 1,cost:2, name: "森林兽人", atk: 8, hp: 30, atk_dis: 40, atk_cd: 2, power: 0, power_max: 10, speed: 30,
|
||||
max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, word: "守护", info: "自身护盾", atktype: 1
|
||||
},
|
||||
1012: {
|
||||
uuid: 1012, path: "orc2", type: 1, level: 1, name: "荒野兽人", atk: 4, hp: 30, atk_dis: 30, atk_cd: 2, power: 0, power_max: 10, speed: 30,
|
||||
max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 1002, word: "守护", info: "自身护盾", atktype: 1
|
||||
uuid: 1012, path: "orc2", type: 1, level: 1,cost:2, name: "荒野兽人", atk: 8, hp: 40, atk_dis: 40, atk_cd: 2, power: 0, power_max: 10, speed: 30,
|
||||
max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, word: "守护", info: "自身护盾", atktype: 1
|
||||
},
|
||||
1013: {
|
||||
uuid: 1013, path: "orc3", type: 1, level: 1, name: "兽人战士", atk: 4, hp: 30, atk_dis: 30, atk_cd: 2, power: 0, power_max: 10, speed: 30,
|
||||
max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 1003, word: "守护", info: "自身护盾", atktype: 1
|
||||
uuid: 1013, path: "orc3", type: 1, level: 1,cost:2, name: "兽人战士", atk: 8, hp: 60, atk_dis: 40, atk_cd: 2, power: 0, power_max: 10, speed: 30,
|
||||
max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, word: "守护", info: "自身护盾", atktype: 1
|
||||
},
|
||||
|
||||
1031: {
|
||||
uuid: 1031, path: "du1", type: 1, level: 1, name: "独眼巨人", atk: 4, hp: 30, atk_dis: 30, atk_cd: 2, power: 0, power_max: 10, speed: 30,
|
||||
max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 1004, word: "守护", info: "自身护盾", atktype: 1
|
||||
uuid: 1031, path: "du1", type: 1, level: 1,cost:2, name: "独眼巨人", atk: 4, hp: 50, atk_dis: 40, atk_cd: 2, power: 0, power_max: 10, speed: 30,
|
||||
max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, word: "守护", info: "自身护盾", atktype: 1
|
||||
},
|
||||
1032: {
|
||||
uuid: 1032, path: "du2", type: 1, level: 1, name: "狂暴独眼", atk: 4, hp: 30, atk_dis: 30, atk_cd: 2, power: 0, power_max: 10, speed: 30,
|
||||
max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 3001, word: "守护", info: "自身护盾", atktype: 1
|
||||
uuid: 1032, path: "du2", type: 1, level: 1,cost:2, name: "狂暴独眼", atk: 5, hp: 60, atk_dis: 40, atk_cd: 2, power: 0, power_max: 10, speed: 30,
|
||||
max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, word: "守护", info: "自身护盾", atktype: 1
|
||||
},
|
||||
1033: {
|
||||
uuid: 1033, path: "du3", type: 1, level: 1, name: "独眼首领", atk: 4, hp: 30, atk_dis: 30, atk_cd: 2, power: 0, power_max: 10, speed: 30,
|
||||
max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 3001, word: "守护", info: "自身护盾", atktype: 1
|
||||
},
|
||||
1041: {
|
||||
uuid: 1041, path: "ys1", type: 1, level: 1, name: "火元素", atk: 4, hp: 30, atk_dis: 200, atk_cd: 2, power: 0, power_max: 10, speed: 30,
|
||||
max_skill: "火球术", skill_uuid: 9002, max_skill_uuid: 1001, word: "守护", info: "自身护盾", atktype: 2
|
||||
},
|
||||
1042: {
|
||||
uuid: 1042, path: "ys2", type: 1, level: 1, name: "冰元素", atk: 4, hp: 30, atk_dis: 200, atk_cd: 2, power: 0, power_max: 10, speed: 30,
|
||||
max_skill: "寒冰箭", skill_uuid: 9002, max_skill_uuid: 1002, word: "守护", info: "自身护盾", atktype: 2
|
||||
},
|
||||
1043: {
|
||||
uuid: 1043, path: "ys3", type: 1, level: 1, name: "气元素", atk: 4, hp: 30, atk_dis: 200, atk_cd: 2, power: 0, power_max: 10, speed: 30,
|
||||
max_skill: "魔法球", skill_uuid: 9002, max_skill_uuid: 1004, word: "守护", info: "自身护盾", atktype: 2
|
||||
uuid: 1033, path: "du3", type: 1, level: 1,cost:2, name: "独眼首领", atk: 6, hp: 100, atk_dis: 40, atk_cd: 2, power: 0, power_max: 10, speed: 30,
|
||||
max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, word: "守护", info: "自身护盾", atktype: 1
|
||||
},
|
||||
|
||||
}
|
||||
@@ -26,10 +26,10 @@ export class BoxRangComp extends CCComp {
|
||||
this.HeroViewComp=this.Hero_node.getComponent(HeroViewComp);
|
||||
// console.log("range box",this.HeroViewComp);
|
||||
if (collider) {
|
||||
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
|
||||
// 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);
|
||||
// collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);
|
||||
}
|
||||
}
|
||||
onBeginContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||
|
||||
@@ -17,6 +17,8 @@ import { HeroViewComp } from "./HeroViewComp";
|
||||
import { BoxSet } from "../common/config/BoxSet";
|
||||
import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
|
||||
import { HeroSet,MonSet } from "../common/config/heroSet";
|
||||
import { Role } from "../Role/Role";
|
||||
import { MoveToComp } from "../common/ecs/position/MoveTo";
|
||||
/** 角色实体 */
|
||||
@ecs.register(`Hero`)
|
||||
export class Hero extends ecs.Entity {
|
||||
@@ -24,6 +26,7 @@ export class Hero extends ecs.Entity {
|
||||
HeroModel!: HeroModelComp;
|
||||
// 视图层
|
||||
HeroView!: HeroViewComp;
|
||||
|
||||
|
||||
protected init() {
|
||||
this.addComponents<ecs.Comp>( HeroModelComp);
|
||||
@@ -32,12 +35,12 @@ export class Hero extends ecs.Entity {
|
||||
|
||||
destroy(): void {
|
||||
this.remove(HeroViewComp);
|
||||
this.remove(MoveToComp);
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
/** 加载角色 */
|
||||
load(pos: Vec3 = Vec3.ZERO,scale:number = -1,uuid:number=1001,layer:Node=smc.map.MapView.scene.entityLayer!.node!) {
|
||||
|
||||
load(pos: Vec3 = Vec3.ZERO,scale:number = -1,uuid:number=1001,layer:Node=smc.map.MapView.scene.entityLayer!.node!,index:number=-1) {
|
||||
var path = "game/hero/"+smc.heros[uuid].path;
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
var node = instantiate(prefab);
|
||||
@@ -45,10 +48,33 @@ export class Hero extends ecs.Entity {
|
||||
// var as = node.getComponent(HeroSpine);
|
||||
// let ratio=this.set_ratio(uuid);
|
||||
// node.setScale(node.scale.x*scale*ratio, node.scale.y*ratio, 0);
|
||||
pos.x=smc.Role.RoleView.node.position.x+pos.x;
|
||||
pos.y=smc.Role.RoleView.node.position.y+pos.y;
|
||||
node.setPosition(pos)
|
||||
this.hero_init(uuid,node)
|
||||
this.hero_init(uuid,node,index)
|
||||
oops.message.dispatchEvent("hero_load",this)
|
||||
}
|
||||
|
||||
hero_init(uuid:number=1001,node:Node,index:number=-1){
|
||||
var hv = node.getComponent(HeroViewComp)!;
|
||||
// console.log("hero_init",buff)
|
||||
hv.speed =hv.ospeed = smc.heros[uuid].speed;
|
||||
hv.hero_name= smc.heros[uuid].name;
|
||||
hv.hp= hv.hp_max = smc.heros[uuid].hp;
|
||||
hv.level = smc.heros[uuid].level;
|
||||
hv.atk = smc.heros[uuid].atk;
|
||||
hv.atk_cd = smc.heros[uuid].atk_cd;
|
||||
hv.atk_dis = smc.heros[uuid].atk_dis;
|
||||
hv.power = smc.heros[uuid].power;
|
||||
hv.power_max= smc.heros[uuid].power_max;
|
||||
hv.type = smc.heros[uuid].type;
|
||||
hv.skill_uuid = smc.heros[uuid].skill_uuid;
|
||||
hv.max_skill_uuid = smc.heros[uuid].max_skill_uuid;
|
||||
hv.scale = 1;
|
||||
hv.role_heros_index = index;
|
||||
hv.Tpos = v3(0,0,0);
|
||||
this.add(hv);
|
||||
}
|
||||
set_ratio(uuid:number){
|
||||
let ratio=1;
|
||||
switch (smc.heros[uuid].level) {
|
||||
@@ -69,23 +95,4 @@ export class Hero extends ecs.Entity {
|
||||
}
|
||||
return ratio;
|
||||
}
|
||||
hero_init(uuid:number=1001,node:Node,pos:Vec3=v3(0,0,0)){
|
||||
var mv = node.getComponent(HeroViewComp)!;
|
||||
// console.log("hero_init",buff)
|
||||
mv.speed =mv.ospeed = smc.heros[uuid].speed;
|
||||
mv.hero_name= smc.heros[uuid].name;
|
||||
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.atk_dis = smc.heros[uuid].atk_dis;
|
||||
mv.power = smc.heros[uuid].power;
|
||||
mv.power_max= smc.heros[uuid].power_max;
|
||||
mv.type = smc.heros[uuid].type;
|
||||
mv.skill_uuid = smc.heros[uuid].skill_uuid;
|
||||
mv.max_skill_uuid = smc.heros[uuid].max_skill_uuid;
|
||||
mv.scale = 1;
|
||||
mv.Tpos = v3(0,0,0);
|
||||
this.add(mv);
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ export class HeroSpine extends Component {
|
||||
atk_clip: AnimationClip = null!;
|
||||
max_clip: AnimationClip = null!;
|
||||
move_clip: AnimationClip = null!;
|
||||
default_clip:string = "move";
|
||||
default_clip:string = "";
|
||||
|
||||
onLoad() {
|
||||
// 角色控制组件
|
||||
@@ -31,6 +31,7 @@ export class HeroSpine extends Component {
|
||||
this.atk_clip = this.animator.clips[1];
|
||||
this.max_clip = this.animator.clips[2];
|
||||
this.move_clip = this.animator.clips[3];
|
||||
this.default_clip=this.move_clip.name;
|
||||
let animation = this.animator.getComponent(Animation);
|
||||
animation.on(Animation.EventType.FINISHED, this.onAnimationEvent, this)
|
||||
}
|
||||
@@ -40,6 +41,7 @@ export class HeroSpine extends Component {
|
||||
/** 初始化动画 */
|
||||
protected initAnimator() {
|
||||
this.animator=this.node.getChildByName("anm").getComponent(Animation);
|
||||
|
||||
// console.log("mon spine init",this.animator);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,9 @@ export class HeroViewComp extends CCComp {
|
||||
hitFlashMaterial: Material;
|
||||
orginalFlashMaterial: Material;
|
||||
sprite: Sprite;
|
||||
|
||||
@property(Material)
|
||||
atkMaterial: Material;
|
||||
|
||||
@property(Node)
|
||||
BoxRang:Node =null!
|
||||
|
||||
@@ -57,8 +59,6 @@ export class HeroViewComp extends CCComp {
|
||||
power_max: number = 1200; /** 能量最大值 */
|
||||
power_speed: number = 1; //能量回复速度每0.1秒回复量
|
||||
|
||||
skill_name: string = "base"; //技能名称
|
||||
max_skill_name: string = "base"; //大技能名称
|
||||
skill_uuid:number = 9001;
|
||||
max_skill_uuid:number = 1001;
|
||||
atk: number = 10; /**攻击力 */
|
||||
@@ -89,6 +89,7 @@ export class HeroViewComp extends CCComp {
|
||||
buff_atks:any = [];
|
||||
dir_y:number = 0;
|
||||
speek_time:number = 0;
|
||||
role_heros_index:number = -1;
|
||||
onLoad() {
|
||||
this.as = this.getComponent(HeroSpine);
|
||||
// this.BoxRang = this.node.getChildByName("range_box");
|
||||
@@ -96,6 +97,7 @@ export class HeroViewComp extends CCComp {
|
||||
} /** 视图层逻辑代码分离演示 */
|
||||
start () {
|
||||
this.as.move()
|
||||
this.node.getChildByName("top").getChildByName("hp").active = false;
|
||||
this.sprite = this.node.getChildByName("anm").getComponent(Sprite);
|
||||
// this.node.getChildByName("top").getChildByName("shield").active = false;
|
||||
// this.node.getChildByName("top").setScale(this.scale,1);
|
||||
@@ -118,9 +120,9 @@ export class HeroViewComp extends CCComp {
|
||||
collider.group = this.box_group;
|
||||
if (collider) {
|
||||
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
|
||||
collider.on(Contact2DType.END_CONTACT, this.onEndContact, 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);
|
||||
// collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);
|
||||
}
|
||||
// this.node.getChildByName("level").getChildByName("level").getComponent(Label).string = this.level.toString();
|
||||
|
||||
@@ -146,6 +148,7 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
onPreSolve (selfCollider: Collider2D, otherCollider: Collider2D) {
|
||||
if(selfCollider.group == otherCollider.group&&selfCollider.tag==otherCollider.tag){
|
||||
|
||||
if(selfCollider.node.position.y < otherCollider.node.position.y){
|
||||
if(selfCollider.node.getSiblingIndex() < otherCollider.node.getSiblingIndex()){
|
||||
|
||||
@@ -164,13 +167,15 @@ export class HeroViewComp extends CCComp {
|
||||
if (this.timer.update(dt)) {
|
||||
this.power_change(this.power_speed)
|
||||
}
|
||||
this.check_buff_atks(dt)
|
||||
this.in_destroy();
|
||||
this.check_buff_atks(dt)
|
||||
this.in_shield(dt);
|
||||
this.in_stop(dt);
|
||||
this.in_atk(dt);
|
||||
this.in_speek(dt);
|
||||
this.move(dt);
|
||||
this.hp_show()
|
||||
// this.in_speek(dt);
|
||||
// this.move(dt);
|
||||
this.move_to()
|
||||
// if(this.m_timer.update(dt)){
|
||||
// this.move_to()
|
||||
// }
|
||||
@@ -186,15 +191,24 @@ export class HeroViewComp extends CCComp {
|
||||
if(this.enemy){
|
||||
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);
|
||||
}
|
||||
set_diry(){
|
||||
this.dir_y=-(this.node.position.y-BoxSet.GAME_LINE)/20
|
||||
hp_show(){
|
||||
if(this.hp == this.hp_max){
|
||||
this.node.getChildByName("top").getChildByName("hp").active = false;
|
||||
} else{
|
||||
this.node.getChildByName("top").getChildByName("hp").active = true;
|
||||
}
|
||||
}
|
||||
move_to(){
|
||||
// if(this.stop_cd > 0){
|
||||
// return
|
||||
// }
|
||||
// if(this.enemy){
|
||||
// return
|
||||
// }
|
||||
var move = this.ent.get(MoveToComp) || this.ent.add(MoveToComp);
|
||||
move.target = v3(smc.Role.RoleView.node.position.x+10,smc.Role.RoleView.node.position.y);
|
||||
move.target = v3(smc.Role.RoleView.node.position.x+smc.role_heros[this.role_heros_index].x,smc.Role.RoleView.node.position.y+smc.role_heros[this.role_heros_index].y);
|
||||
move.node = this.node;
|
||||
move.speed = this.ospeed;
|
||||
}
|
||||
@@ -202,7 +216,7 @@ export class HeroViewComp extends CCComp {
|
||||
this.power += power;
|
||||
if(this.power >= this.power_max&&this.check_enemy_alive()){
|
||||
this.as.atk()
|
||||
this.to_speek(smc.skills[this.max_skill_uuid].name)
|
||||
// this.to_speek(smc.skills[this.max_skill_uuid].name)
|
||||
this.scheduleOnce(()=>{
|
||||
this.handle_skill(this.max_skill_uuid);
|
||||
},0.5)
|
||||
@@ -237,10 +251,10 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
return {pos,t_pos}
|
||||
}
|
||||
shoot(skill_uuid:number,y:number=0,x:number=0){
|
||||
// console.log("mon shoot");
|
||||
shoot_enemy(skill_uuid:number,y:number=0,x:number=0){
|
||||
// console.log("mon shoot_enemy");
|
||||
let skill = ecs.getEntity<Skill>(Skill);
|
||||
let atk = smc.skills[skill_uuid].atk+this.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
|
||||
@@ -252,21 +266,32 @@ export class HeroViewComp extends CCComp {
|
||||
let atk = smc.skills[s_uuid].atk+this.atk;
|
||||
let {pos,t_pos}=this.get_hero_pos(hero)
|
||||
skill.load(pos,BoxSet.HERO,this.node,this.max_skill_uuid,atk,t_pos);
|
||||
hero.HeroView.add_hp(smc.skills[s_uuid].atk)
|
||||
if(smc.skills[s_uuid].hp > 0){ //buff加血
|
||||
hero.HeroView.add_hp(smc.skills[s_uuid].hp)
|
||||
}
|
||||
if(smc.skills[s_uuid].atk > 0){ //buff加攻击
|
||||
hero.HeroView.add_atk(smc.skills[s_uuid].atk,smc.skills[s_uuid].bsd)
|
||||
}
|
||||
if(smc.skills[s_uuid].shield > 0){ //buff护盾
|
||||
hero.HeroView.add_shield(smc.skills[s_uuid].shield,smc.skills[s_uuid].bsd)
|
||||
}
|
||||
|
||||
}
|
||||
push_least_buff(skill:number){
|
||||
let heros:any = ecs.query(ecs.allOf(HeroModelComp));
|
||||
let least_hp:number=999999
|
||||
let least_hp:number=0
|
||||
let t_hero:any= null
|
||||
if (heros.length > 0) {
|
||||
if(smc.skills[skill].type==92){ //随机添加buff
|
||||
let i = RandomManager.instance.getRandomInt(0,heros.length-1,3)
|
||||
this.to_add_buff(heros[i],skill)
|
||||
}else{
|
||||
for (let i = 0; i < heros.length; i++) {
|
||||
let hero = heros[i];
|
||||
if(!hero.HeroView) continue
|
||||
if(smc.skills[skill].type==91){ //血量最少单体
|
||||
if(hero.HeroView.hp < least_hp){
|
||||
least_hp = hero.HeroView.hp
|
||||
if((hero.HeroView.hp_max-hero.HeroView.hp) > least_hp){
|
||||
least_hp = (hero.HeroView.hp_max-hero.HeroView.hp)
|
||||
t_hero = hero
|
||||
}
|
||||
}else{ //群体
|
||||
@@ -287,19 +312,21 @@ export class HeroViewComp extends CCComp {
|
||||
handle_skill(skill:number){
|
||||
switch (smc.skills[skill].tg) {
|
||||
case 0: //自己
|
||||
|
||||
this.to_add_buff(this.ent,skill)
|
||||
break;
|
||||
case 1: //伙伴
|
||||
this.push_least_buff(skill)
|
||||
break;
|
||||
case 2: //自己和伙伴
|
||||
|
||||
this.to_add_buff(this.ent,skill)
|
||||
this.push_least_buff(skill)
|
||||
break;
|
||||
case 3: //敌人
|
||||
this.shoot(skill)
|
||||
this.shoot_enemy(skill)
|
||||
break;
|
||||
case 4: //敌人和自己
|
||||
this.shoot(skill)
|
||||
this.to_add_buff(this.ent,skill)
|
||||
this.shoot_enemy(skill)
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -346,6 +373,22 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
heathed(){
|
||||
this.node.getChildByName("heathed").active=true
|
||||
}
|
||||
add_hp(hp: number=0){
|
||||
this.heathed();
|
||||
this.hp+=hp;
|
||||
if(this.hp > this.hp_max){
|
||||
this.hp = this.hp_max;
|
||||
}
|
||||
this.tooltip(2,hp.toString());
|
||||
let hp_progress= this.hp/this.hp_max;
|
||||
this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
|
||||
}
|
||||
|
||||
hp_change(hp: number){
|
||||
if(this.is_dead){
|
||||
return;
|
||||
@@ -364,26 +407,15 @@ export class HeroViewComp extends CCComp {
|
||||
if(this.hp <= 0){
|
||||
this.dead();
|
||||
this.is_dead = true;
|
||||
smc.role_heros[this.role_heros_index].eid == 0
|
||||
setTimeout(() => {
|
||||
this.ent.destroy();
|
||||
}, 15);
|
||||
}
|
||||
}
|
||||
heathed(){
|
||||
this.node.getChildByName("heathed").active=true
|
||||
}
|
||||
add_hp(hp: number=0){
|
||||
this.heathed();
|
||||
this.hp+=hp;
|
||||
if(this.hp > this.hp_max){
|
||||
this.hp = this.hp_max;
|
||||
}
|
||||
this.tooltip(2,hp.toString());
|
||||
let hp_progress= this.hp/this.hp_max;
|
||||
this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
|
||||
}
|
||||
add_atk(atk: number,time:number=0){
|
||||
if(time > 0){
|
||||
this.buff_atk=0
|
||||
let buff={atk:atk,time:time}
|
||||
this.buff_atks.push(buff);
|
||||
this.buff_atks.forEach((element: { atk: number; }) => {
|
||||
@@ -392,15 +424,20 @@ export class HeroViewComp extends CCComp {
|
||||
}else{
|
||||
this.atk += atk;
|
||||
}
|
||||
this.sprite.setSharedMaterial(this.atkMaterial, 0);
|
||||
this.scheduleOnce(() => {
|
||||
this.sprite.setSharedMaterial(this.orginalFlashMaterial, 0);
|
||||
}, 0.3);
|
||||
console.log(this.buff_atks)
|
||||
}
|
||||
|
||||
check_buff_atks(dt: number){
|
||||
for(let i=0;i<this.buff_atks.length;i++){
|
||||
let buff=this.buff_atks[i];
|
||||
buff.time -= dt;
|
||||
if(buff.time <= 0){
|
||||
this.buff_atk -= buff.atk
|
||||
this.buff_atks.splice(i,1);
|
||||
}else{
|
||||
this.buff_atk += buff.atk
|
||||
}
|
||||
}
|
||||
if(this.buff_atks.length <= 0){
|
||||
@@ -410,9 +447,14 @@ export class HeroViewComp extends CCComp {
|
||||
this.buff_icon_change("atk",true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
buff_icon_change(icon:string,value:boolean){
|
||||
this.node.getChildByName("top").getChildByName("buff").getChildByName(icon).active=value
|
||||
}
|
||||
|
||||
|
||||
|
||||
add_shield(shield: number,time:number=0){
|
||||
this.shield =this.shield_max=shield
|
||||
this.shield_time = time;
|
||||
@@ -428,7 +470,15 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
}
|
||||
in_shield(dt: number){
|
||||
if(this.shield <= 0){
|
||||
this.shield_time=0
|
||||
this.node.getChildByName("shielded").active=false
|
||||
}else{
|
||||
this.node.getChildByName("shielded").active=true
|
||||
}
|
||||
if(this.shield_time <= 0){
|
||||
this.shield = this.shield_max=0;
|
||||
this.node.getChildByName("shielded").active=false
|
||||
return
|
||||
}
|
||||
if(this.shield_time > 0){
|
||||
@@ -441,12 +491,6 @@ export class HeroViewComp extends CCComp {
|
||||
// let shield_progress= this.shield/this.shield_max;
|
||||
// this.node.getChildByName("top").getChildByName("shield").getComponent(ProgressBar)!.progress = shield_progress;
|
||||
}
|
||||
if(this.shield <= 0){
|
||||
this.shield_time=0
|
||||
// this.node.getChildByName("top").getChildByName("shield").active=false
|
||||
}else{
|
||||
// this.node.getChildByName("top").getChildByName("shield").active=true
|
||||
}
|
||||
}
|
||||
tooltip(type:number=1,value:string="",s_uuid:number=1001,y:number=60){
|
||||
// console.log("tooltip",type);
|
||||
|
||||
@@ -14,6 +14,7 @@ import { LoadingViewComp } from "./view/LoadingViewComp";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { MonSet, HeroSet } from "../common/config/heroSet";
|
||||
import { SkillSet } from "../common/config/SkillSet";
|
||||
import { Items } from "../common/config/ItemSet";
|
||||
|
||||
// import {data} from "../data/data";
|
||||
/**
|
||||
@@ -89,7 +90,7 @@ export class Initialize extends ecs.Entity {
|
||||
smc.monsters=MonSet;
|
||||
// console.log("加载完成!",smc.heros);
|
||||
smc.skills=SkillSet;
|
||||
|
||||
smc.items=Items;
|
||||
var uic: UICallbacks = {
|
||||
onAdded: (node: Node, params: any) => {
|
||||
var comp = node.getComponent(LoadingViewComp) as ecs.Comp;
|
||||
|
||||
@@ -20,12 +20,12 @@ export class CardControllerComp extends CCComp {
|
||||
touch_time:number = 0
|
||||
in_touch:boolean = false
|
||||
cards:any = {
|
||||
1:{uuid:1101,type:1,lv:0,alive:false},
|
||||
2:{uuid:1102,type:1,lv:0,alive:false},
|
||||
3:{uuid:1103,type:1,lv:0,alive:false},
|
||||
4:{uuid:1104,type:1,lv:0,alive:false},
|
||||
5:{uuid:1105,type:1,lv:0,alive:false},
|
||||
6:{uuid:1106,type:1,lv:0,alive:false},
|
||||
1:{uuid:1101,type:1,lv:0,cost:0,alive:false},
|
||||
2:{uuid:1102,type:1,lv:0,cost:0,alive:false},
|
||||
3:{uuid:1103,type:1,lv:0,cost:0,alive:false},
|
||||
4:{uuid:1104,type:1,lv:0,cost:0,alive:false},
|
||||
5:{uuid:1105,type:1,lv:0,cost:0,alive:false},
|
||||
6:{uuid:1106,type:1,lv:0,cost:0,alive:false},
|
||||
}
|
||||
protected onLoad(): void {
|
||||
let card1 = this.node.getChildByName("cards").getChildByName("card1");
|
||||
@@ -146,27 +146,18 @@ export class CardControllerComp extends CCComp {
|
||||
// console.log("show_info",uuid)
|
||||
let node =this.node.getChildByName("item_box")
|
||||
if(type == 2){
|
||||
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
|
||||
smc.vm_data.item_box.skillsd = SkillSet[uuid].sd
|
||||
smc.vm_data.item_box.atk = SkillSet[uuid].atk
|
||||
smc.vm_data.item_box.hp = SkillSet[uuid].hp
|
||||
smc.vm_data.item_box.info = smc.items[uuid].info
|
||||
smc.vm_data.item_box.name = smc.items[uuid].name
|
||||
smc.vm_data.item_box.skillcd = smc.items[uuid].cd
|
||||
smc.vm_data.item_box.skillsd = smc.items[uuid].sd
|
||||
smc.vm_data.item_box.atk = smc.items[uuid].atk
|
||||
smc.vm_data.item_box.hp = smc.items[uuid].hp
|
||||
smc.vm_data.item_box.shield = smc.items[uuid].shield
|
||||
node.active=true
|
||||
}
|
||||
if(type == 3){
|
||||
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
|
||||
smc.vm_data.item_box.skillsd = SkillSet[uuid].sd
|
||||
smc.vm_data.item_box.atk = SkillSet[uuid].atk
|
||||
smc.vm_data.item_box.hp = SkillSet[uuid].hp
|
||||
smc.vm_data.item_box.shield = SkillSet[uuid].shield
|
||||
node.active=true
|
||||
if(SkillSet[uuid].shield > 0){
|
||||
if(smc.items[uuid].shield > 0){
|
||||
node.getChildByName("data").getChildByName("shield").active=true
|
||||
}
|
||||
if(SkillSet[uuid].hp > 0){
|
||||
if(smc.items[uuid].hp > 0){
|
||||
node.getChildByName("data").getChildByName("hp").active=true
|
||||
}
|
||||
}
|
||||
@@ -231,8 +222,9 @@ export class CardControllerComp extends CCComp {
|
||||
|
||||
load_cards() {
|
||||
this.in_load = true
|
||||
|
||||
let card:any=null
|
||||
for (let index = 1; index <= 4; index++) {
|
||||
for (let index = 1; index <= 6; index++) {
|
||||
card=RandomManager.instance.getRandomByObjectList(smc.cards, 1);
|
||||
this.cards[index].uuid=card[0].uuid
|
||||
this.cards[index].type=card[0].type
|
||||
@@ -241,35 +233,15 @@ export class CardControllerComp extends CCComp {
|
||||
let pathName: string = "";
|
||||
let name: string = "";
|
||||
let level: number = 0;
|
||||
let cost: number = 0;
|
||||
let { uuid, type } = card[0];
|
||||
url = "game/hero/hero_icon";
|
||||
({ uuid: pathName, name, level } = smc.heros[uuid]);
|
||||
({ uuid: pathName, name, level ,cost} = smc.heros[uuid]);
|
||||
this.cards[index].lv=level
|
||||
this.cards[index].cost = cost
|
||||
let node=this.node.getChildByName('cards').getChildByName('card'+index)
|
||||
node.getChildByName('cost').getComponent(Label).string=level.toString()
|
||||
node.getChildByName('name').getComponent(Label).string=name
|
||||
// const sprite = node.getChildByName("item").getComponent(Sprite);
|
||||
// console.log(this['card'+index],url,pathName,sprite)
|
||||
resources.load(url, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = node.getChildByName("item").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(pathName);
|
||||
});
|
||||
this.cards[index].alive=true
|
||||
}
|
||||
for (let index = 5; index <= 6; index++) {
|
||||
card=RandomManager.instance.getRandomByObjectList(smc.items, 1);
|
||||
this.cards[index].uuid=card[0].uuid
|
||||
this.cards[index].type=card[0].type
|
||||
let url: string = "";
|
||||
let pathName: string = "";
|
||||
let name: string = "";
|
||||
let level: number = 0;
|
||||
let { uuid, type } = card[0];
|
||||
url = "game/heros/skill";
|
||||
({ path: pathName, name, level } = smc.skills[uuid]);
|
||||
this.cards[index].lv=level
|
||||
let node=this.node.getChildByName('cards').getChildByName('card'+index)
|
||||
node.getChildByName('cost').getComponent(Label).string=level.toString()
|
||||
node.getChildByName('cost').getComponent(Label).string=cost.toString()
|
||||
node.getChildByName('lv').getChildByName('lv').getComponent(Label).string=level.toString()
|
||||
node.getChildByName('name').getComponent(Label).string=name
|
||||
// const sprite = node.getChildByName("item").getComponent(Sprite);
|
||||
// console.log(this['card'+index],url,pathName,sprite)
|
||||
@@ -279,6 +251,29 @@ export class CardControllerComp extends CCComp {
|
||||
});
|
||||
this.cards[index].alive=true
|
||||
}
|
||||
// for (let index = 5; index <= 6; index++) {
|
||||
// card=RandomManager.instance.getRandomByObjectList(smc.item_list, 1);
|
||||
// this.cards[index].uuid=card[0].uuid
|
||||
// this.cards[index].type=card[0].type
|
||||
// let url: string = "";
|
||||
// let pathName: string = "";
|
||||
// let name: string = "";
|
||||
// let level: number = 0;
|
||||
// let { uuid, type } = card[0];
|
||||
// url = "game/heros/skill";
|
||||
// ({ path: pathName, name, level } = smc.items[uuid]);
|
||||
// this.cards[index].lv=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
|
||||
// // const sprite = node.getChildByName("item").getComponent(Sprite);
|
||||
// // console.log(this['card'+index],url,pathName,sprite)
|
||||
// resources.load(url, SpriteAtlas, (err: any, atlas) => {
|
||||
// const sprite = node.getChildByName("item").getComponent(Sprite);
|
||||
// sprite.spriteFrame = atlas.getSpriteFrame(pathName);
|
||||
// });
|
||||
// this.cards[index].alive=true
|
||||
// }
|
||||
// console.log("cards:",this.cards)
|
||||
this.in_load = false
|
||||
}
|
||||
@@ -317,7 +312,7 @@ export class CardControllerComp extends CCComp {
|
||||
// console.log("card_index:",index,"card_alive:",this.cards[index].alive)
|
||||
return;
|
||||
};
|
||||
if(smc.vm_data.gold.min >= this.cards[index].lv){
|
||||
if(smc.vm_data.gold.min >= this.cards[index].cost){
|
||||
this.cards[index].alive=false
|
||||
this.do_use_card(index)
|
||||
}else{
|
||||
@@ -327,18 +322,19 @@ export class CardControllerComp extends CCComp {
|
||||
}
|
||||
do_use_card(index:number){
|
||||
this.cards[index].alive=false
|
||||
smc.vm_data.gold.min -= this.cards[index].lv;
|
||||
switch (this.cards[index].type) {
|
||||
case 1:
|
||||
oops.message.dispatchEvent("do_add_hero", { uuid: this.cards[index].uuid });
|
||||
break;
|
||||
case 2:
|
||||
oops.message.dispatchEvent("do_use_skill", { uuid: this.cards[index].uuid });
|
||||
break;
|
||||
case 3:
|
||||
oops.message.dispatchEvent("do_use_skill", { uuid: this.cards[index].uuid });
|
||||
break;
|
||||
}
|
||||
smc.vm_data.gold.min -= this.cards[index].cost;
|
||||
oops.message.dispatchEvent("do_add_hero", { uuid: this.cards[index].uuid });
|
||||
// switch (this.cards[index].type) {
|
||||
// case 1:
|
||||
// oops.message.dispatchEvent("do_add_hero", { uuid: this.cards[index].uuid });
|
||||
// break;
|
||||
// case 2:
|
||||
// oops.message.dispatchEvent("do_use_item", { uuid: this.cards[index].uuid });
|
||||
// break;
|
||||
// case 3:
|
||||
// oops.message.dispatchEvent("do_use_item", { uuid: this.cards[index].uuid });
|
||||
// break;
|
||||
// }
|
||||
this.remove_card(index)
|
||||
}
|
||||
protected update(dt: number): void {
|
||||
|
||||
@@ -36,7 +36,9 @@ export class MapMonsterComp extends CCComp {
|
||||
target_timer: Timer = new Timer(0.1);
|
||||
setp_num:number = 5;
|
||||
game_over:boolean = false;
|
||||
start_ys:any[] = [100,50,0,-50,-100];
|
||||
start_ys:any[] = [70,0,-70];
|
||||
hero_start_ys:any[] = [35,-35];
|
||||
|
||||
onLoad(){
|
||||
// 监听全局事件
|
||||
oops.message.on("other_add_monster", this.on_other_add_monster, this);
|
||||
@@ -95,11 +97,26 @@ export class MapMonsterComp extends CCComp {
|
||||
private addHero(uuid:number=1001) {
|
||||
let hero = ecs.getEntity<Hero>(Hero);
|
||||
var scene = smc.map.MapView.scene;
|
||||
let oy=RandomManager.instance.getRandomByObjectList(this.start_ys,1)
|
||||
let pos:Vec3 = v3(BoxSet.HERO_START,BoxSet.GAME_LINE+oy[0]);
|
||||
let oy=RandomManager.instance.getRandomInt(-70,70,1)
|
||||
let pos = v3(0,0);
|
||||
let less=0
|
||||
let index =0
|
||||
for(let i=0; i <= 11;i++){
|
||||
if(smc.role_heros[i].eid==0){
|
||||
pos=v3(smc.role_heros[i].x,smc.role_heros[i].y)
|
||||
less += 1
|
||||
index = i
|
||||
smc.role_heros[i].eid=hero.eid
|
||||
break
|
||||
}
|
||||
}
|
||||
if(less <= 0){
|
||||
oops.gui.toast("人数已满");
|
||||
return false
|
||||
}
|
||||
let monster_layer = scene.entityLayer!.node!
|
||||
let scale = 1
|
||||
hero.load(pos,scale,uuid,monster_layer);
|
||||
hero.load(pos,scale,uuid,monster_layer,index);
|
||||
}
|
||||
monster_refresh(){
|
||||
if (this.setp_num <= 0){
|
||||
@@ -107,8 +124,8 @@ export class MapMonsterComp extends CCComp {
|
||||
}
|
||||
let m:any = RandomManager.instance.getRandomByObjectList(this.mission_list[this.monster_level],1)
|
||||
var scene = smc.map.MapView.scene;
|
||||
let oy=RandomManager.instance.getRandomByObjectList(this.start_ys,1)
|
||||
let pos:Vec3 = v3(BoxSet.MONSTER_START,BoxSet.GAME_LINE+oy[0])
|
||||
let oy=RandomManager.instance.getRandomInt(-70,70,1)
|
||||
let pos:Vec3 = v3(BoxSet.MONSTER_START,BoxSet.GAME_LINE+oy)
|
||||
let monster_layer = scene.entityLayer!.node!
|
||||
this.addMonster(m[0],monster_layer,pos)
|
||||
this.setp_num -= 1
|
||||
|
||||
@@ -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 "../skills/CSkill";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@@ -18,6 +18,7 @@ export class MapSkillComp extends CCComp {
|
||||
oops.message.on("monster_load", this.doMonsterLoad, this);
|
||||
oops.message.on("hero_load", this.doHeroLoad, this);
|
||||
oops.message.on("do_use_skill", this.doSkill, this);
|
||||
oops.message.on("do_use_item", this.useItem, this);
|
||||
}
|
||||
doSkill(event: string, args: any){
|
||||
this.addCSkill(args.uuid);
|
||||
@@ -26,14 +27,7 @@ export class MapSkillComp extends CCComp {
|
||||
|
||||
}
|
||||
addCSkill(uuid:number=1001,args:any=null){
|
||||
let csk =ecs.getEntity<CSkill>(CSkill);
|
||||
let scale = 1
|
||||
let pos = v3(BoxSet.CSKILL_X*-scale,BoxSet.CSKILL_Y)
|
||||
if(args){
|
||||
pos = v3(args.x,args.y)
|
||||
scale = args.scale
|
||||
}
|
||||
csk.load(pos,scale,uuid);
|
||||
|
||||
}
|
||||
doMonsterLoad(){
|
||||
const light = instantiate(this.light);
|
||||
@@ -45,6 +39,18 @@ export class MapSkillComp extends CCComp {
|
||||
light.setPosition(BoxSet.HERO_START,BoxSet.GAME_LINE,0);
|
||||
this.node.addChild(light);
|
||||
}
|
||||
useItem(event: string, args: any){
|
||||
console.log("useItem");
|
||||
if(smc.items[args.uuid].hp > 0){ //buff加血
|
||||
smc.Role.RoleView.add_hp(smc.items[args.uuid].hp)
|
||||
}
|
||||
if(smc.items[args.uuid].atk > 0){ //buff加攻击
|
||||
smc.Role.RoleView.add_atk(smc.items[args.uuid].atk,smc.items[args.uuid].sd)
|
||||
}
|
||||
if(smc.items[args.uuid].shield > 0){ //buff护盾
|
||||
smc.Role.RoleView.add_shield(smc.items[args.uuid].shield,smc.items[args.uuid].sd)
|
||||
}
|
||||
}
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start() {
|
||||
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
|
||||
|
||||
@@ -42,7 +42,7 @@ export class MapViewComp extends CCComp {
|
||||
// smc.vm_data.game.g_time += 1;
|
||||
// }
|
||||
// this.shuaxin(dt)
|
||||
this.gold_add(dt)
|
||||
// this.gold_add(dt)
|
||||
}
|
||||
// 刷新怪物
|
||||
|
||||
|
||||
@@ -26,10 +26,10 @@ export class BoxRangComp extends CCComp {
|
||||
this.MonViewComp=this.Hero_node.getComponent(MonViewComp);
|
||||
// console.log("range box",this.MonViewComp);
|
||||
if (collider) {
|
||||
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
|
||||
// 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);
|
||||
// collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);
|
||||
}
|
||||
}
|
||||
onBeginContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||
@@ -59,7 +59,6 @@ export class BoxRangComp extends CCComp {
|
||||
// console.log("onPreSolve b:"+selfCollider.node.parent.getSiblingIndex()+"/"+otherCollider.node.parent.getSiblingIndex());
|
||||
// }
|
||||
if(selfCollider.group != otherCollider.group&&otherCollider.tag == 0){
|
||||
let scene =smc.map.MapView.scene.mapLayer!.node!
|
||||
let other_pos = otherCollider.node.getWorldPosition() ;
|
||||
let self_pos = this.node.getWorldPosition();
|
||||
// console.log("onPreSolve:",self_pos,other_pos);
|
||||
|
||||
@@ -58,7 +58,7 @@ export class MonViewComp extends CCComp {
|
||||
skill_name: string = "base"; //技能名称
|
||||
max_skill_name: string = "base"; //大技能名称
|
||||
skill_uuid:number = 9001;
|
||||
max_skill_uuid:number = 1001;
|
||||
max_skill_uuid:number = 0;
|
||||
atk: number = 10; /**攻击力 */
|
||||
// atk_speed: number = 1;
|
||||
atk_cd: number = 1.3; /**攻击速度 攻击间隔 */
|
||||
@@ -114,9 +114,9 @@ export class MonViewComp extends CCComp {
|
||||
collider.group = this.box_group;
|
||||
if (collider) {
|
||||
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
|
||||
collider.on(Contact2DType.END_CONTACT, this.onEndContact, 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);
|
||||
// collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);
|
||||
}
|
||||
// this.node.getChildByName("level").getChildByName("level").getComponent(Label).string = this.level.toString();
|
||||
|
||||
@@ -149,7 +149,7 @@ export class MonViewComp extends CCComp {
|
||||
}
|
||||
}
|
||||
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -162,12 +162,19 @@ export class MonViewComp extends CCComp {
|
||||
this.in_shield(dt);
|
||||
this.in_stop(dt);
|
||||
this.in_atk(dt);
|
||||
this.hp_show()
|
||||
this.move(dt);
|
||||
// if(this.m_timer.update(dt)){
|
||||
// this.move_to()
|
||||
// }
|
||||
}
|
||||
|
||||
hp_show(){
|
||||
if(this.hp == this.hp_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){
|
||||
return
|
||||
@@ -188,6 +195,9 @@ export class MonViewComp extends CCComp {
|
||||
move.speed = this.ospeed;
|
||||
}
|
||||
power_change(power: number){
|
||||
if(this.max_skill_uuid == 0){
|
||||
return
|
||||
}
|
||||
this.power += power;
|
||||
if(this.power >= this.power_max&&this.check_enemy_alive()){
|
||||
this.as.atk()
|
||||
@@ -212,9 +222,7 @@ export class MonViewComp extends CCComp {
|
||||
}
|
||||
//使用max_skill
|
||||
do_max_skill(){
|
||||
for(let i=0;i<smc.skills[this.max_skill_uuid].count;i++){
|
||||
this.shoot(this.max_skill_uuid)
|
||||
}
|
||||
this.shoot(this.max_skill_uuid)
|
||||
}
|
||||
to_speek(words:string,time:number=0.5){
|
||||
this.speek_time=0.5
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "430ee378-c69f-409a-b098-d3daec37d90b",
|
||||
"uuid": "80aaeefe-a9d9-42da-8086-62a77b582046",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "31174503-d934-4bd4-bd68-01aaa5534e81",
|
||||
"uuid": "b8d6919d-0a2d-41eb-8c10-5ea684508f48",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "917ea8ef-8f1b-498c-8bfe-654cd28a86a5",
|
||||
"uuid": "d87fc680-dacd-4c20-9d19-08e941660d54",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
|
||||
@@ -54,7 +54,7 @@ export class Skill extends ecs.Entity {
|
||||
angle=0
|
||||
}
|
||||
sv.angle = angle;
|
||||
console.log(smc.skills[uuid].name+"angle:"+angle)
|
||||
// console.log(smc.skills[uuid].name+"angle:"+angle)
|
||||
sv.s_uuid = uuid;
|
||||
sv.atk = atk;
|
||||
node.setScale(v3(node.scale.x*scale,node.scale.y))
|
||||
|
||||
@@ -75,7 +75,7 @@ export class SkillCom extends CCComp {
|
||||
}
|
||||
// console.log("skill run_type",this.run_type)
|
||||
if(this.run_type == 1){ //贝塞尔曲线
|
||||
console.log("skill bezierTo",this.t_pos)
|
||||
// console.log("skill bezierTo",this.t_pos)
|
||||
let s_pos = v3(this.node.position.x,this.node.position.y)
|
||||
let c_pos = v3((this.t_pos.x+this.node.position.x)/2,this.node.position.y+100)
|
||||
let e_pos = v3(this.node.position.x+this.t_pos.x,this.node.position.y+this.t_pos.y)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { _decorator, Component, Node, sp ,Animation, AnimationState} from 'cc';
|
||||
import { _decorator, Component, Node, sp ,Animation, AnimationState, animation, AnimationClip} from 'cc';
|
||||
import { Timer } from '../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer';
|
||||
const { ccclass, property ,} = _decorator;
|
||||
|
||||
@@ -6,17 +6,18 @@ const { ccclass, property ,} = _decorator;
|
||||
export class anonce extends Component {
|
||||
|
||||
timer:Timer=new Timer(0.5);
|
||||
anm_clip: AnimationClip = null!;
|
||||
|
||||
start() {
|
||||
|
||||
}
|
||||
protected onLoad(): void {
|
||||
|
||||
this.anm_clip = this.node.getChildByName("skill").getComponent(Animation).clips[0];
|
||||
}
|
||||
|
||||
update(deltaTime: number) {
|
||||
if(this.node.active){
|
||||
if(!this.node.getChildByName("skill").getComponent(Animation).getState("heathed").isPlaying){
|
||||
if(!this.node.getChildByName("skill").getComponent(Animation).getState(this.anm_clip.name).isPlaying){
|
||||
this.node.getChildByName("skill").getComponent(Animation).play();
|
||||
}
|
||||
if (this.timer.update(deltaTime)) {
|
||||
|
||||
Reference in New Issue
Block a user