hero 死亡进入墓地 而不是摧毁,todo 受伤动画重做
This commit is contained in:
@@ -43,13 +43,13 @@
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": -0.49999999999999994,
|
||||
"w": 0.8660254037844387
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_lscale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0.2,
|
||||
"y": 1,
|
||||
"x": 1,
|
||||
"y": 0.8,
|
||||
"z": 1
|
||||
},
|
||||
"_mobility": 0,
|
||||
@@ -58,7 +58,7 @@
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": -60
|
||||
"z": 0
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
@@ -107,9 +107,9 @@
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"r": 250,
|
||||
"g": 234,
|
||||
"b": 0,
|
||||
"a": 255
|
||||
},
|
||||
"_skeletonData": {
|
||||
|
||||
@@ -54,7 +54,7 @@ export const SkillSet={
|
||||
dis:1,count:5,in:0,run:0,atk:10,hp:0,shield:0,sd:10,cd:2,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
9001:{uuid: 9001,path: "1001",type: 1,tg:3,angle:true,level: 1,name: "普攻",sp_name:"patk",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:1001,sk_count:0,speed:600,},
|
||||
dis:1,count:1,in:0,run:0,atk:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:6000,},
|
||||
9002:{uuid: 9002,path: "1001",type: 1,tg:3,angle:true,level: 1,name: "魔法小球",sp_name:"mball",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:1001,sk_count:0,speed:600,},
|
||||
9003:{uuid: 9003,path: "1001",type: 1,tg:3,angle:true,level: 1,name: "射击",sp_name:"arrow",info:"释放一个魔法球攻击敌人",
|
||||
|
||||
@@ -70,29 +70,29 @@ export class Hero extends ecs.Entity {
|
||||
hero_init(uuid:number=1001,node:Node,index:number=-1,scale:number=1,box_group=BoxSet.HERO){
|
||||
var hv = node.getComponent(HeroViewComp)!;
|
||||
// console.log("hero_init",buff)
|
||||
let hero_set= smc.heros[uuid]
|
||||
let role_talent= smc.vm_data.talent
|
||||
let HInf= smc.heros[uuid] // 角色数据
|
||||
let talent= smc.vm_data.talent
|
||||
let talents=Talents;
|
||||
hv.scale = scale;
|
||||
hv.box_group = box_group;
|
||||
hv.hero_uuid= uuid;
|
||||
hv.hero_name= hero_set.name;
|
||||
|
||||
hv.speed =hv.ospeed = hero_set.speed;
|
||||
hv.dis = hero_set.dis;
|
||||
hv.power = hero_set.power;
|
||||
hv.level = hero_set.level;
|
||||
hv.type = hero_set.type;
|
||||
hv.sk1 = hero_set.sk1;
|
||||
hv.sk2 = hero_set.sk2;
|
||||
hv.sk3 = hero_set.sk3;
|
||||
hv.sk4 = hero_set.sk4;
|
||||
hv.sk5 = hero_set.sk5;
|
||||
hv.type = hero_set.type;
|
||||
hv.hp= hv.hp_max =hero_set.hp;
|
||||
hv.ap = hero_set.ap;
|
||||
hv.cd = hero_set.a_cd
|
||||
hv.power_max= hero_set.power_max
|
||||
hv.hero_name= HInf.name;
|
||||
hv.hero_type= HInf.type;
|
||||
hv.speed =hv.ospeed = HInf.speed;
|
||||
hv.dis = HInf.dis;
|
||||
hv.power = HInf.power;
|
||||
hv.level = HInf.level;
|
||||
hv.type = HInf.type;
|
||||
hv.sk1 = HInf.sk1;
|
||||
hv.sk2 = HInf.sk2;
|
||||
hv.sk3 = HInf.sk3;
|
||||
hv.sk4 = HInf.sk4;
|
||||
hv.sk5 = HInf.sk5;
|
||||
hv.type = HInf.type;
|
||||
hv.hp= hv.hp_max =HInf.hp;
|
||||
hv.ap = HInf.ap;
|
||||
hv.cd = HInf.a_cd
|
||||
hv.power_max= HInf.power_max
|
||||
this.add(hv);
|
||||
}
|
||||
set_ratio(uuid:number){
|
||||
|
||||
@@ -53,44 +53,44 @@ export class HeroSpine extends Component {
|
||||
}
|
||||
onAnimationEvent(type: Animation.EventType, state: AnimationState){
|
||||
if(type==Animation.EventType.FINISHED){
|
||||
console.log("animator end",state.name);
|
||||
// console.log("animator end",state.name);
|
||||
if(state.name==this.atk_clip.name||state.name==this.max_clip.name){
|
||||
console.log("animator no atk and no max");
|
||||
// console.log("animator no atk and no max");
|
||||
this.default();
|
||||
}
|
||||
}
|
||||
}
|
||||
change_default(value:string){
|
||||
console.log("change default",value);
|
||||
// console.log("change default",value);
|
||||
this.default_clip=value;
|
||||
}
|
||||
default() {
|
||||
if(!this.in_playing()){
|
||||
console.log("do default");
|
||||
// console.log("do default");
|
||||
this.animator.play(this.default_clip);
|
||||
}
|
||||
|
||||
}
|
||||
idle(){
|
||||
if(!this.in_playing()){
|
||||
console.log("do idle");
|
||||
// console.log("do idle");
|
||||
this.animator.play(this.idle_clip.name);
|
||||
}
|
||||
}
|
||||
atk() {
|
||||
console.log("do atk");
|
||||
// console.log("do atk");
|
||||
this.animator.play(this.atk_clip.name);
|
||||
}
|
||||
|
||||
|
||||
max(){
|
||||
console.log("do max");
|
||||
// console.log("do max");
|
||||
this.animator.play(this.max_clip.name);
|
||||
}
|
||||
|
||||
move(){
|
||||
if(!this.in_playing()){
|
||||
console.log("do move");
|
||||
// console.log("do move");
|
||||
this.animator.play(this.move_clip.name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,11 +19,9 @@ import { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/
|
||||
import { SkillCom } from "../skills/SkillCom";
|
||||
import { SkillSet } from "../common/config/SkillSet";
|
||||
import { Tooltip } from "../skills/Tooltip";
|
||||
import { MoveToComp } from "../common/ecs/position/MoveTo";
|
||||
import { BoxRangComp } from "./BoxRangComp";
|
||||
import { MonViewComp } from "../mon/MonViewComp";
|
||||
import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
|
||||
import { TimerManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/timer/TimerManager";
|
||||
import { HeroSet } from "../common/config/heroSet";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 角色显示组件 */
|
||||
@@ -47,6 +45,7 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
hero_uuid:number = 1001;
|
||||
hero_name : string = "hero";
|
||||
hero_type:number = 1;
|
||||
level:number =1;
|
||||
scale: number = 1; /** 角色阵营 1:hero -1 :mon */
|
||||
type: number = 1; /**角色类型 1:前排 2 后排 */
|
||||
@@ -203,18 +202,15 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D) {
|
||||
}
|
||||
status_change(type:string){
|
||||
if(this.status == type) return
|
||||
this.status=type
|
||||
if(type != "move"){
|
||||
this.as.change_default("idle")
|
||||
}else{
|
||||
this.as.change_default("move")
|
||||
}
|
||||
}
|
||||
|
||||
update(dt: number){
|
||||
if(!smc.vm_data.mission.play||smc.vm_data.pause||this.is_dead){
|
||||
if(!smc.vm_data.mission.play||smc.vm_data.pause){
|
||||
let pos =v3(this.scale*-9999,this.node.position.y,this.node.position.z)
|
||||
this.node.setPosition(pos)
|
||||
return
|
||||
}
|
||||
if(this.is_dead){
|
||||
let pos =v3(this.scale*-9999,this.node.position.y,this.node.position.z)
|
||||
this.node.setPosition(pos)
|
||||
return
|
||||
}
|
||||
if (this.timer.update(dt)) {
|
||||
@@ -231,13 +227,18 @@ export class HeroViewComp extends CCComp {
|
||||
// this.hp_show()
|
||||
this.move(dt);
|
||||
|
||||
|
||||
// this.in_speek(dt);
|
||||
// this.move_to()
|
||||
// if(this.m_timer.update(dt)){
|
||||
// this.move_to()
|
||||
// }
|
||||
}
|
||||
status_change(type:string){
|
||||
if(this.status == type) return
|
||||
this.status=type
|
||||
if(type != "move"){
|
||||
this.as.change_default("idle")
|
||||
}else{
|
||||
this.as.change_default("move")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
change_anm(){
|
||||
if (this.anm_name == "max"){
|
||||
this.as.max()
|
||||
@@ -318,18 +319,7 @@ export class HeroViewComp extends CCComp {
|
||||
this.node.getChildByName("top").getChildByName("hp").active = true;
|
||||
}
|
||||
}
|
||||
move_to(target:any){
|
||||
// if(this.stop_cd > 0){
|
||||
// return
|
||||
// }
|
||||
// if(this.enemy){
|
||||
// return
|
||||
// }
|
||||
var move = this.ent.get(MoveToComp) || this.ent.add(MoveToComp);
|
||||
move.target = v3(target.x,target.y);
|
||||
move.node = this.node;
|
||||
move.speed = this.ospeed;
|
||||
}
|
||||
|
||||
power_change(power: number){
|
||||
this.power += power;
|
||||
if(this.power >= this.power_max){
|
||||
@@ -535,7 +525,6 @@ export class HeroViewComp extends CCComp {
|
||||
// setTimeout(() => {
|
||||
// this.ent.destroy();
|
||||
// }, 15);
|
||||
this.toDestroy()
|
||||
}
|
||||
}
|
||||
add_atk(atk: number,time:number=0){
|
||||
@@ -609,28 +598,24 @@ export class HeroViewComp extends CCComp {
|
||||
var path = "game/skills/atked";
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
var node = instantiate(prefab);
|
||||
let pos = v3(0,60)
|
||||
let pos =v3(0,30);
|
||||
node.setPosition(pos)
|
||||
node.parent = this.node;
|
||||
// this.sprite.setSharedMaterial(this.hitFlashMaterial, 0);
|
||||
// this.scheduleOnce(() => {
|
||||
// this.sprite.setSharedMaterial(this.orginalFlashMaterial, 0);
|
||||
// }, 0.1);
|
||||
|
||||
|
||||
}
|
||||
dead(){
|
||||
var path = "game/skills/dead";
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
var node = instantiate(prefab);
|
||||
node.setPosition(this.node.position.x,this.node.position.y+30,this.node.position.z);
|
||||
let pos = v3(this.node.position.x,this.node.position.y+30,this.node.position.z);
|
||||
node.parent = this.node.parent;
|
||||
node.setPosition(pos);
|
||||
}
|
||||
toDestroy(){
|
||||
this.node.setPosition(this.scale*9999,this.node.position.y)
|
||||
|
||||
}
|
||||
toAlive(){
|
||||
this.node.setPosition(-1*this.scale*BoxSet.HERO_START,this.node.position.y)
|
||||
let pos =v3(HeroSet.StartPos[this.hero_type],this.node.position.y,this.node.position.z)
|
||||
this.node.setPosition(pos)
|
||||
}
|
||||
reset() {
|
||||
this.is_dead = false;
|
||||
|
||||
@@ -217,7 +217,8 @@ export class MapMonsterComp extends CCComp {
|
||||
private addHero(uuid:number=1001) {
|
||||
let hero = ecs.getEntity<Hero>(Hero);
|
||||
let scale = 1
|
||||
let pos:Vec3 = v3(HeroSet[smc.heros[uuid].type],BoxSet.GAME_LINE);
|
||||
let pos:Vec3 = v3(HeroSet.StartPos[smc.heros[uuid].type],BoxSet.GAME_LINE);
|
||||
console.log("addHero:",pos)
|
||||
hero.load(pos,scale,uuid);
|
||||
this.set_start_point()
|
||||
}
|
||||
@@ -225,7 +226,8 @@ export class MapMonsterComp extends CCComp {
|
||||
let monster = ecs.getEntity<Hero>(Hero);
|
||||
let scale = -1
|
||||
let index = -1
|
||||
let pos:Vec3 = v3(-1*HeroSet[smc.heros[uuid].type],BoxSet.GAME_LINE);
|
||||
let pos:Vec3 = v3(-1*HeroSet.StartPos[smc.heros[uuid].type],BoxSet.GAME_LINE);
|
||||
console.log("addMonster:",pos)
|
||||
monster.load(pos,scale,uuid,index,false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user