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