角色动画 确定
This commit is contained in:
@@ -34,7 +34,7 @@ export class Role extends ecs.Entity {
|
||||
}
|
||||
|
||||
/** 加载角色 */
|
||||
load(pos: Vec3 = Vec3.ZERO,uuid:number=101) {
|
||||
load(pos: Vec3 = Vec3.ZERO,uuid:number=101,skin:string="Character01") {
|
||||
// var path = "game/monster/"+prefab_path;
|
||||
var path = "game/heros/role";
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
@@ -42,23 +42,24 @@ export class Role extends ecs.Entity {
|
||||
var scene = smc.map.MapView.scene;
|
||||
node.parent = scene.entityLayer!.node!;
|
||||
// var as = node.getComponent(MonsterSpine);
|
||||
|
||||
node.setPosition(pos)
|
||||
// console.log(node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite))
|
||||
const url = 'game/heros/player';
|
||||
resources.load(url, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite);
|
||||
// const url = 'game/heros/player';
|
||||
// resources.load(url, SpriteAtlas, (err: any, atlas) => {
|
||||
// const sprite = node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite);
|
||||
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(RoleSet[uuid].path);
|
||||
});
|
||||
// sprite.spriteFrame = atlas.getSpriteFrame(RoleSet[uuid].path);
|
||||
// });
|
||||
var rv = node.getComponent(RoleViewComp)!;
|
||||
rv.skin=skin
|
||||
rv.setSkin()
|
||||
this.add(rv);
|
||||
this.hero_init(uuid,node)
|
||||
oops.message.dispatchEvent("hero_load",this)
|
||||
|
||||
}
|
||||
|
||||
hero_init(uuid:number=1001,node:Node,pos:Vec3=v3(0,0,0)){
|
||||
var rv = node.getComponent(RoleViewComp)!;
|
||||
|
||||
this.add(rv);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -32,7 +32,13 @@ export class RoleSpine extends Component {
|
||||
protected initAnimator() {
|
||||
this.spine = this.animator.getComponent(sp.Skeleton)!;
|
||||
}
|
||||
|
||||
atk() {
|
||||
this.spine.setAnimation(0, "Throwing", false);
|
||||
}
|
||||
|
||||
magic() {
|
||||
this.spine.setAnimation(0, "Hit", false);
|
||||
}
|
||||
setSkin(value: string): void {
|
||||
console.log("RoleSpine setSkin", value);
|
||||
this.spine.setSkin(value);
|
||||
|
||||
@@ -15,15 +15,29 @@ const { ccclass, property, requireComponent, disallowMultiple } = _decorator;
|
||||
@disallowMultiple
|
||||
@requireComponent(sp.Skeleton)
|
||||
export default class RoleSpineAnimator extends Component {
|
||||
private animName: string = "move";
|
||||
private animName: string = "Idle";
|
||||
private loop: boolean = true;
|
||||
private spine!: sp.Skeleton;
|
||||
start() {
|
||||
this.spine = this.getComponent(sp.Skeleton)!;
|
||||
// console.log("RoleSpineAnimator start");
|
||||
// console.log("MonsterSpineAnimator start");
|
||||
this.playAnimation(this.animName, this.loop);
|
||||
}
|
||||
mixTime:number= 0.2;
|
||||
|
||||
protected onLoad(): void {
|
||||
this.spine = this.getComponent(sp.Skeleton)!;
|
||||
// this.spine?.setMix('atk', 'Idle', this.mixTime);
|
||||
// this.spine?.setMix('Idle','atk', this.mixTime);
|
||||
this.spine.setEndListener(trackEntry => {
|
||||
var animationName = trackEntry.animation ? trackEntry.animation.name : "";
|
||||
// console.log("[track %s][animation %s] end.", trackEntry.trackIndex, animationName);
|
||||
if (animationName == "Throwing"||animationName == "Hit") {
|
||||
this.spine.setAnimation(0, "Idle", true);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
lateUpdate(dt: number) {
|
||||
//
|
||||
}
|
||||
@@ -44,9 +58,9 @@ export default class RoleSpineAnimator extends Component {
|
||||
* @param loop 是否循环播放
|
||||
*/
|
||||
protected playAnimation(animName: string, loop: boolean) {
|
||||
// console.log("RoleSpineAnimator playAnimation");
|
||||
// console.log("MonsterSpineAnimator playAnimation");
|
||||
if (animName) {
|
||||
// console.log("RoleSpineAnimator playAnimation animName", animName);
|
||||
// console.log("MonsterSpineAnimator playAnimation animName", animName);
|
||||
this.animName = animName;
|
||||
this.loop = loop;
|
||||
this.spine.setAnimation(0, this.animName, this.loop);
|
||||
|
||||
@@ -5,13 +5,18 @@
|
||||
* @LastEditTime: 2022-08-17 12:36:18
|
||||
*/
|
||||
|
||||
import { Vec3, v3,_decorator ,Collider2D,Contact2DType,IPhysics2DContact,Material,Sprite,ProgressBar} from "cc";
|
||||
import { Vec3, v3,_decorator ,Collider2D,Contact2DType,IPhysics2DContact,Material,Sprite,ProgressBar, Prefab, instantiate} 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";
|
||||
import {BoxSet} from "../common/config/BoxSet"
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { SkillCom } from "../skills/SkillCom";
|
||||
import { Skill } from "../skills/Skill";
|
||||
import { SkillSet } from "../common/config/SkillSet";
|
||||
import { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer";
|
||||
import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 角色显示组件 */
|
||||
@@ -29,24 +34,27 @@ export class RoleViewComp extends CCComp {
|
||||
hp_max:number = 1000;
|
||||
power: number = 0;
|
||||
stop_cd:number = 0;
|
||||
atk_cd:number = 0;
|
||||
atk:number = 2;
|
||||
atk_cd:number = 20;
|
||||
atk:number = 10;
|
||||
skill_uuid:number = 9003;
|
||||
max_skill_uuid:number = 1001;
|
||||
skin="Character01";
|
||||
private atk_time:Timer = new Timer(1);
|
||||
|
||||
onLoad() {
|
||||
onLoad() {
|
||||
this.as = this.getComponent(RoleSpine);
|
||||
|
||||
}
|
||||
start () {
|
||||
this.sprite = this.node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite);
|
||||
this.orginalFlashMaterial = this.sprite.getRenderMaterial(0);
|
||||
|
||||
// let x = RandomManager.instance.getRandomInt(1,9,2)
|
||||
// this.as.setSkin("Character0"+x);
|
||||
this.atk_time = new Timer(this.atk_cd);
|
||||
// this.sprite = this.node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite);
|
||||
// this.orginalFlashMaterial = this.sprite.getRenderMaterial(0);
|
||||
console.log("Role view start")
|
||||
|
||||
let collider = this.getComponent(Collider2D);
|
||||
if (collider) {
|
||||
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
|
||||
}
|
||||
|
||||
}
|
||||
onBeginContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||
if(otherCollider.tag==BoxSet.SKILL_TAG){
|
||||
@@ -61,46 +69,53 @@ export class RoleViewComp extends CCComp {
|
||||
}
|
||||
}
|
||||
}
|
||||
onEndContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||
|
||||
|
||||
}
|
||||
onPreSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||
if(selfCollider.group != otherCollider.group&&otherCollider.tag != BoxSet.ATK_RANGE){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||
|
||||
|
||||
if(selfCollider.group == otherCollider.group){
|
||||
// console.log('monster view group 相同');
|
||||
|
||||
}else{
|
||||
// console.log('monster onPostSolve'+selfCollider.group+"|"+otherCollider.group);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// onEndContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {}
|
||||
// onPreSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {}
|
||||
// onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {}
|
||||
|
||||
update(dt: number){
|
||||
|
||||
if (this.atk_time.update(dt)) {
|
||||
this.toAtk(this.skill_uuid);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
setSkin(){
|
||||
this.as.setSkin(this.skin);
|
||||
}
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
}
|
||||
toAtk(uuid) {
|
||||
this.as.atk();
|
||||
this.scheduleOnce(()=>{
|
||||
this.shoot(this.skill_uuid);
|
||||
},0.5)
|
||||
}
|
||||
|
||||
|
||||
shoot(skill_uuid:number){
|
||||
// console.log("monster shoot");
|
||||
let skill = ecs.getEntity<Skill>(Skill);
|
||||
let pos = v3(35,55)
|
||||
let scale = 1
|
||||
let speed =SkillSet[skill_uuid].speed;
|
||||
let dis = SkillSet[skill_uuid].dis;
|
||||
let atk = SkillSet[skill_uuid].atk+this.atk;
|
||||
let uuid = skill_uuid;
|
||||
skill.load(pos,speed,dis,scale,this.node,uuid,atk,2);
|
||||
}
|
||||
|
||||
in_atked() {
|
||||
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);
|
||||
var path = "game/skills/atked";
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
var node = instantiate(prefab);
|
||||
let pos = v3(0,30)
|
||||
node.setPosition(pos)
|
||||
node.parent = this.node;
|
||||
}
|
||||
hp_change(hp: number){
|
||||
this.hp -= hp;
|
||||
@@ -110,8 +125,8 @@ export class RoleViewComp extends CCComp {
|
||||
let hp_progress= this.hp/this.hp_max;
|
||||
this.node.getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
|
||||
if(this.hp <= 0){
|
||||
console.log("dead");
|
||||
console.log("dead");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
9
assets/script/game/Role/role2.meta
Normal file
9
assets/script/game/Role/role2.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "826ec938-411f-429e-9693-747a063877b4",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
74
assets/script/game/Role/role2/Role2Spine.ts
Normal file
74
assets/script/game/Role/role2/Role2Spine.ts
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* @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 ,Node} from "cc";
|
||||
import { LayerUtil } from "../../../../../extensions/oops-plugin-framework/assets/core/utils/LayerUtil";
|
||||
import { smc } from "../../common/SingletonModuleComp";
|
||||
import Role2SpineAnimator from "./Role2SpineAnimator";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/**
|
||||
* RPG SPINE角色模型
|
||||
*/
|
||||
@ccclass('Role2Spine')
|
||||
export class Role2Spine extends Component {
|
||||
@property({ type: Role2SpineAnimator, tooltip: '动画控制器' })
|
||||
animator: Role2SpineAnimator = null!;
|
||||
|
||||
private spine!: sp.Skeleton;
|
||||
|
||||
onLoad() {
|
||||
// 角色控制组件
|
||||
|
||||
this.initAnimator();
|
||||
LayerUtil.setNodeLayer(LayerUtil.MAP, this.node);
|
||||
}
|
||||
atk() {
|
||||
this.spine.setAnimation(1, "atk", false);
|
||||
}
|
||||
|
||||
magic() {
|
||||
this.spine.setAnimation(1, "magic", false);
|
||||
}
|
||||
/** 初始化动画 */
|
||||
protected initAnimator() {
|
||||
this.spine = this.animator.getComponent(sp.Skeleton)!;
|
||||
}
|
||||
|
||||
setSkin(value: string): void {
|
||||
console.log("RoleSpine setSkin", value);
|
||||
this.spine.setSkin(value);
|
||||
}
|
||||
play(animName: string, loop: boolean): void {
|
||||
this.spine.setAnimation(1, animName, loop);
|
||||
}
|
||||
setAlpha(value: number): void {
|
||||
var color: Color = this.spine.color;
|
||||
color.a = 255 * (value / 1);
|
||||
this.spine.color = color;
|
||||
}
|
||||
|
||||
setPos(value: Vec3): void {
|
||||
this.node.position = value;
|
||||
}
|
||||
|
||||
checkTouch(event: EventTouch): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
this.node.destroy();
|
||||
}
|
||||
|
||||
walk() {
|
||||
|
||||
}
|
||||
|
||||
idle() {
|
||||
|
||||
}
|
||||
}
|
||||
1
assets/script/game/Role/role2/Role2Spine.ts.meta
Normal file
1
assets/script/game/Role/role2/Role2Spine.ts.meta
Normal file
@@ -0,0 +1 @@
|
||||
{"ver":"4.0.23","importer":"typescript","imported":true,"uuid":"a12321b5-d9b0-4eb8-aa4c-9db175d0f9a8","files":[],"subMetas":{},"userData":{}}
|
||||
71
assets/script/game/Role/role2/Role2SpineAnimator.ts
Normal file
71
assets/script/game/Role/role2/Role2SpineAnimator.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* @Author: dgflash
|
||||
* @Date: 2022-08-04 15:08:35
|
||||
* @LastEditors: dgflash
|
||||
* @LastEditTime: 2022-08-04 15:26:38
|
||||
*/
|
||||
import { sp, _decorator ,Component} from "cc";
|
||||
|
||||
const { ccclass, property, requireComponent } = _decorator;
|
||||
|
||||
/**
|
||||
* Spine状态机组件(主状态机),trackIndex为0
|
||||
*/
|
||||
@ccclass
|
||||
@requireComponent(sp.Skeleton)
|
||||
export default class Role2SpineAnimator extends Component {
|
||||
private animName: string = "Idle";
|
||||
private loop: boolean = true;
|
||||
private spine!: sp.Skeleton;
|
||||
start() {
|
||||
this.spine = this.getComponent(sp.Skeleton)!;
|
||||
// console.log("MonsterSpineAnimator start");
|
||||
this.playAnimation(this.animName, this.loop);
|
||||
}
|
||||
mixTime:number= 0.2;
|
||||
|
||||
protected onLoad(): void {
|
||||
this.spine = this.getComponent(sp.Skeleton)!;
|
||||
// this.spine?.setMix('atk', 'Idle', this.mixTime);
|
||||
// this.spine?.setMix('Idle','atk', this.mixTime);
|
||||
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 == "magic") {
|
||||
this.spine.setAnimation(1, "Idle", true);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
lateUpdate(dt: number) {
|
||||
//
|
||||
}
|
||||
|
||||
play(animName: string, loop: boolean) {
|
||||
if (animName) {
|
||||
this.animName = animName;
|
||||
this.loop = loop;
|
||||
this.spine.setAnimation(1 ,this.animName, this.loop);
|
||||
}
|
||||
else {
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 播放动画
|
||||
* @override
|
||||
* @param animName 动画名
|
||||
* @param loop 是否循环播放
|
||||
*/
|
||||
protected playAnimation(animName: string, loop: boolean) {
|
||||
// console.log("MonsterSpineAnimator playAnimation");
|
||||
if (animName) {
|
||||
// console.log("MonsterSpineAnimator playAnimation animName", animName);
|
||||
this.animName = animName;
|
||||
this.loop = loop;
|
||||
this.spine.setAnimation(1, this.animName, this.loop);
|
||||
}
|
||||
else {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
9
assets/script/game/Role/role2/Role2SpineAnimator.ts.meta
Normal file
9
assets/script/game/Role/role2/Role2SpineAnimator.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "93179a96-4683-4d2d-853c-a0f721f19f02",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
126
assets/script/game/Role/role2/Role2ViewComp.ts
Normal file
126
assets/script/game/Role/role2/Role2ViewComp.ts
Normal file
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* @Author: dgflash
|
||||
* @Date: 2021-11-18 17:42:59
|
||||
* @LastEditors: dgflash
|
||||
* @LastEditTime: 2022-08-17 12:36:18
|
||||
*/
|
||||
|
||||
import { Vec3, v3,_decorator ,Collider2D,Contact2DType,IPhysics2DContact,Material,Sprite,ProgressBar} 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 { Role2Spine } from "./Role2Spine";
|
||||
import {BoxSet} from "../../common/config/BoxSet"
|
||||
import { smc } from "../../common/SingletonModuleComp";
|
||||
import { SkillCom } from "../../skills/SkillCom";
|
||||
import { Skill } from "../../skills/Skill";
|
||||
import { SkillSet } from "../../common/config/SkillSet";
|
||||
import { Timer } from "../../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer";
|
||||
import { RandomManager } from "../../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 角色显示组件 */
|
||||
@ccclass('Role2ViewComp') // 定义为 Cocos Creator 组件
|
||||
@ecs.register('RoleView2', false) // 定义为 ECS 组件
|
||||
export class Role2ViewComp extends CCComp {
|
||||
@property(Material)
|
||||
hitFlashMaterial: Material;
|
||||
orginalFlashMaterial: Material;
|
||||
sprite: Sprite;
|
||||
/** 角色动画 */
|
||||
as: Role2Spine = null!;
|
||||
/** 角色属性 */
|
||||
hp: number = 1000;
|
||||
hp_max:number = 1000;
|
||||
power: number = 0;
|
||||
stop_cd:number = 0;
|
||||
atk_cd:number = 2;
|
||||
atk:number = 10;
|
||||
skill_uuid:number = 9003;
|
||||
max_skill_uuid:number = 1001;
|
||||
skin:string ="Character01";
|
||||
private atk_time:Timer = new Timer(1);
|
||||
|
||||
onLoad() {
|
||||
this.as = this.getComponent(Role2Spine);
|
||||
|
||||
}
|
||||
start () {
|
||||
// this.as.setSkin(this.skin);
|
||||
this.atk_time = new Timer(this.atk_cd);
|
||||
// this.sprite = this.node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite);
|
||||
// this.orginalFlashMaterial = this.sprite.getRenderMaterial(0);
|
||||
console.log("Role view start")
|
||||
let collider = this.getComponent(Collider2D);
|
||||
if (collider) {
|
||||
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
|
||||
}
|
||||
}
|
||||
onBeginContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||
if(otherCollider.tag==BoxSet.SKILL_TAG){
|
||||
if(selfCollider.group != otherCollider.group){
|
||||
let skill = otherCollider.node.getComponent(SkillCom)!;
|
||||
// console.log('onPostSolve',skill);
|
||||
// this.in_atked();
|
||||
if(this.hp <= 0 ){
|
||||
return
|
||||
}
|
||||
this.hp_change(skill.atk);
|
||||
}
|
||||
}
|
||||
}
|
||||
// onEndContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {}
|
||||
// onPreSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {}
|
||||
// onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {}
|
||||
|
||||
update(dt: number){
|
||||
if (this.atk_time.update(dt)) {
|
||||
this.toAtk(this.skill_uuid);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
}
|
||||
toAtk(uuid) {
|
||||
this.as.atk();
|
||||
this.scheduleOnce(()=>{
|
||||
this.shoot(this.skill_uuid);
|
||||
},0.4)
|
||||
}
|
||||
|
||||
shoot(skill_uuid:number){
|
||||
console.log("monster shoot");
|
||||
let skill = ecs.getEntity<Skill>(Skill);
|
||||
let pos = v3(60,50)
|
||||
let scale = 1
|
||||
let speed =SkillSet[skill_uuid].speed;
|
||||
let dis = SkillSet[skill_uuid].dis;
|
||||
let atk = SkillSet[skill_uuid].atk+this.atk;
|
||||
let uuid = skill_uuid;
|
||||
skill.load(pos,speed,dis,scale,this.node,uuid,atk,2);
|
||||
}
|
||||
setSkin(skin:string="Character01"){
|
||||
this.as.setSkin(skin);
|
||||
}
|
||||
|
||||
in_atked() {
|
||||
this.sprite.setSharedMaterial(this.hitFlashMaterial, 0);
|
||||
this.scheduleOnce(() => {
|
||||
this.sprite.setSharedMaterial(this.orginalFlashMaterial, 0);
|
||||
}, 0.1);
|
||||
}
|
||||
hp_change(hp: number){
|
||||
this.hp -= hp;
|
||||
if(this.hp > this.hp_max){
|
||||
this.hp = this.hp_max;
|
||||
}
|
||||
let hp_progress= this.hp/this.hp_max;
|
||||
this.node.getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
|
||||
if(this.hp <= 0){
|
||||
console.log("dead");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
1
assets/script/game/Role/role2/Role2ViewComp.ts.meta
Normal file
1
assets/script/game/Role/role2/Role2ViewComp.ts.meta
Normal file
@@ -0,0 +1 @@
|
||||
{"ver":"4.0.23","importer":"typescript","imported":true,"uuid":"4810c3ad-8287-4fcd-bdb3-dd44247d61ed","files":[],"subMetas":{},"userData":{}}
|
||||
@@ -9,6 +9,8 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ec
|
||||
import { Initialize } from "../initialize/Initialize";
|
||||
import { GameMap } from "../map/GameMap";
|
||||
import { BoxSet } from "./config/BoxSet";
|
||||
import { Role } from "../Role/Role";
|
||||
import { Monster } from "../monster/Monster";
|
||||
|
||||
// import { Role } from "../role/Role";
|
||||
// import { data } from "../data/data";
|
||||
@@ -31,17 +33,15 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
};
|
||||
monster_buffs: any = [];
|
||||
/** 游戏主角 */
|
||||
// own: Role = null;
|
||||
Role: Role = null;
|
||||
/** 游戏数据 */
|
||||
// data:data = null!;
|
||||
/**怪物数据 数组 */
|
||||
monsters = []
|
||||
/**heros 数据 */
|
||||
heros:any = [];
|
||||
monsters_in=[]
|
||||
heros_in = []
|
||||
monsters_dead = []
|
||||
heros_dead = []
|
||||
monsters_dead:any = []
|
||||
heros_dead:any = []
|
||||
|
||||
vm_data: any = {
|
||||
name : "纸片精灵大乱斗",
|
||||
/**宝石数量 */
|
||||
@@ -79,11 +79,11 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
max: 30
|
||||
},
|
||||
gold: {
|
||||
min: 20,
|
||||
max: 20,
|
||||
min: 0,
|
||||
max: 4,
|
||||
max_limit:10,
|
||||
time:0,
|
||||
cd:10,
|
||||
cd:1,
|
||||
},
|
||||
shuaxin: {
|
||||
min: 0,
|
||||
|
||||
@@ -30,4 +30,7 @@ export enum BoxSet {
|
||||
GAME_LINE = 10,
|
||||
CSKILL_X = 280,
|
||||
CSKILL_Y = 420,
|
||||
//攻击距离
|
||||
ATK_RANGE_X = 35,
|
||||
MOVE_RANGE_X = 15,
|
||||
}
|
||||
@@ -96,7 +96,7 @@ export const CardSet = {
|
||||
5002:{uuid: 5002,path: "5002",type: 0,level: 5,atk: 15,hp: 60,atk_cd: 1,power: 50,speed: 80,skill: "base",max_skill: "base",int1: null,int2: null,dps: 10,atktype: "精英型", mon: "闪电鼠"},
|
||||
5003:{uuid: 5003,path: "5003",type: 0,level: 5,atk: 15,hp: 60,atk_cd: 1,power: 50,speed: 80,skill: "base",max_skill: "base",int1: null,int2: null,dps: 10,atktype: "精英型", mon: "龙"},
|
||||
5004:{uuid: 5004,path: "5004",type: 0,level: 5,atk: 15,hp: 60,atk_cd: 1,power: 50,speed: 80,skill: "base",max_skill: "base",int1: null,int2: null,dps: 10,atktype: "精英型", mon: "龙"
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -3,57 +3,56 @@ export const CardType = {
|
||||
2: "后排",
|
||||
}
|
||||
export const SkillSet={
|
||||
1001:{uuid: 1001,path: "1001",type: 1,level: 1,name: "火球术-初级",sp_name:"fire",dis:1720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
1002:{uuid: 1002,path: "1002",type: 1,level: 1,name: "寒冰箭-初级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
1003:{uuid: 1003,path: "1003",type: 1,level: 1,name: "狂暴-初级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
1004:{uuid: 1004,path: "1004",type: 1,level: 1,name: "守护-初级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
1005:{uuid: 1005,path: "1005",type: 1,level: 1,name: "雷霆-初级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
1006:{uuid: 1006,path: "1006",type: 1,level: 1,name: "再生-初级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
1007:{uuid: 1007,path: "1007",type: 1,level: 1,name: "复生-初级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
1008:{uuid: 1008,path: "1008",type: 1,level: 1,name: "灵巧-初级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
1009:{uuid: 1009,path: "1009",type: 1,level: 1,name: "盾守-初级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
1010:{uuid: 1010,path: "1010",type: 1,level: 1,name: "治愈-初级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
1011:{uuid: 1011,path: "1011",type: 1,level: 3,name: "火焰风暴-初级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
1012:{uuid: 1012,path: "1012",type: 1,level: 3,name: "冰晶风暴-初级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
2001:{uuid: 2001,path: "1001",type: 1,level: 2,name: "火球术-中级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
2002:{uuid: 2002,path: "1002",type: 1,level: 2,name: "寒冰箭-中级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
2003:{uuid: 2003,path: "1003",type: 1,level: 2,name: "狂暴-中级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
2004:{uuid: 2004,path: "1004",type: 1,level: 2,name: "守护-中级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
2005:{uuid: 2005,path: "1005",type: 1,level: 2,name: "雷霆-中级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
2006:{uuid: 2006,path: "1006",type: 1,level: 2,name: "再生-中级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
2007:{uuid: 2007,path: "1007",type: 1,level: 2,name: "复生-中级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
2008:{uuid: 2008,path: "1008",type: 1,level: 2,name: "灵巧-中级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
2009:{uuid: 2009,path: "1009",type: 1,level: 2,name: "盾守-中级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
2010:{uuid: 2010,path: "1010",type: 1,level: 2,name: "治愈-中级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
2011:{uuid: 2011,path: "1011",type: 1,level: 4,name: "火焰风暴-中级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
2012:{uuid: 2012,path: "1012",type: 1,level: 4,name: "冰晶风暴-中级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
3001:{uuid: 3001,path: "1001",type: 1,level: 3,name: "火球术-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
3002:{uuid: 3002,path: "1002",type: 1,level: 3,name: "寒冰箭-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
3003:{uuid: 3003,path: "1003",type: 1,level: 3,name: "狂暴-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
3004:{uuid: 3004,path: "1004",type: 1,level: 3,name: "守护-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
3005:{uuid: 3005,path: "1005",type: 1,level: 3,name: "雷霆-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
3006:{uuid: 3006,path: "1006",type: 1,level: 3,name: "再生-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
3007:{uuid: 3007,path: "1007",type: 1,level: 3,name: "复生-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
3008:{uuid: 3008,path: "1008",type: 1,level: 3,name: "灵巧-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
3009:{uuid: 3009,path: "1009",type: 1,level: 3,name: "盾守-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
3010:{uuid: 3010,path: "1010",type: 1,level: 3,name: "治愈-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
3011:{uuid: 3011,path: "1011",type: 1,level: 5,name: "火焰风暴-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
3012:{uuid: 3012,path: "1012",type: 1,level: 5,name: "冰晶风暴-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
4001:{uuid: 4001,path: "1001",type: 1,level: 4,name: "火球术-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
4002:{uuid: 4002,path: "1002",type: 1,level: 4,name: "寒冰箭-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
4003:{uuid: 4003,path: "1003",type: 1,level: 4,name: "狂暴-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
4004:{uuid: 4004,path: "1004",type: 1,level: 4,name: "守护-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
4005:{uuid: 4005,path: "1005",type: 1,level: 4,name: "雷霆-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
4006:{uuid: 4006,path: "1006",type: 1,level: 4,name: "再生-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
4007:{uuid: 4007,path: "1007",type: 1,level: 4,name: "复生-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
4008:{uuid: 4008,path: "1008",type: 1,level: 4,name: "灵巧-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
4009:{uuid: 4009,path: "1009",type: 1,level: 4,name: "盾守-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
4010:{uuid: 4010,path: "1010",type: 1,level: 4,name: "治愈-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
4011:{uuid: 4011,path: "1011",type: 1,level: 6,name: "火焰风暴-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
4012:{uuid: 4012,path: "1012",type: 1,level: 6,name: "冰晶风暴-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
9001:{uuid: 9001,path: "9001",type: 1,level: 1,name: "基础攻击1",sp_name:"base",dis:90,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
9002:{uuid: 9002,path: "9002",type: 1,level: 1,name: "基础攻击2",sp_name:"base2",dis:90,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
9003:{uuid: 9003,path: "9003",type: 1,level: 1,name: "基础攻击3",sp_name:"base3",dis:720,count:1,atk: 4,sd:10,cd:1,speed:350,},
|
||||
1001:{uuid: 1001,path: "1001",type: 1,level: 1,name: "火球术-初级",sp_name:"fire",dis:1720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
1002:{uuid: 1002,path: "1002",type: 1,level: 1,name: "寒冰箭-初级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
1003:{uuid: 1003,path: "1003",type: 1,level: 1,name: "狂暴-初级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
1004:{uuid: 1004,path: "1004",type: 1,level: 1,name: "守护-初级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
1005:{uuid: 1005,path: "1005",type: 1,level: 1,name: "雷霆-初级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
1006:{uuid: 1006,path: "1006",type: 1,level: 1,name: "再生-初级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
1007:{uuid: 1007,path: "1007",type: 1,level: 1,name: "复生-初级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
1008:{uuid: 1008,path: "1008",type: 1,level: 1,name: "灵巧-初级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
1009:{uuid: 1009,path: "1009",type: 1,level: 1,name: "盾守-初级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
1010:{uuid: 1010,path: "1010",type: 1,level: 1,name: "治愈-初级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
1011:{uuid: 1011,path: "1011",type: 1,level: 3,name: "火焰风暴-初级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
1012:{uuid: 1012,path: "1012",type: 1,level: 3,name: "冰晶风暴-初级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
2001:{uuid: 2001,path: "1001",type: 1,level: 2,name: "火球术-中级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
2002:{uuid: 2002,path: "1002",type: 1,level: 2,name: "寒冰箭-中级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
2003:{uuid: 2003,path: "1003",type: 1,level: 2,name: "狂暴-中级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
2004:{uuid: 2004,path: "1004",type: 1,level: 2,name: "守护-中级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
2005:{uuid: 2005,path: "1005",type: 1,level: 2,name: "雷霆-中级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
2006:{uuid: 2006,path: "1006",type: 1,level: 2,name: "再生-中级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
2007:{uuid: 2007,path: "1007",type: 1,level: 2,name: "复生-中级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
2008:{uuid: 2008,path: "1008",type: 1,level: 2,name: "灵巧-中级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
2009:{uuid: 2009,path: "1009",type: 1,level: 2,name: "盾守-中级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
2010:{uuid: 2010,path: "1010",type: 1,level: 2,name: "治愈-中级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
2011:{uuid: 2011,path: "1011",type: 1,level: 4,name: "火焰风暴-中级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
2012:{uuid: 2012,path: "1012",type: 1,level: 4,name: "冰晶风暴-中级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
3001:{uuid: 3001,path: "1001",type: 1,level: 3,name: "火球术-高级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
3002:{uuid: 3002,path: "1002",type: 1,level: 3,name: "寒冰箭-高级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
3003:{uuid: 3003,path: "1003",type: 1,level: 3,name: "狂暴-高级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
3004:{uuid: 3004,path: "1004",type: 1,level: 3,name: "守护-高级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
3005:{uuid: 3005,path: "1005",type: 1,level: 3,name: "雷霆-高级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
3006:{uuid: 3006,path: "1006",type: 1,level: 3,name: "再生-高级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
3007:{uuid: 3007,path: "1007",type: 1,level: 3,name: "复生-高级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
3008:{uuid: 3008,path: "1008",type: 1,level: 3,name: "灵巧-高级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
3009:{uuid: 3009,path: "1009",type: 1,level: 3,name: "盾守-高级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
3010:{uuid: 3010,path: "1010",type: 1,level: 3,name: "治愈-高级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
3011:{uuid: 3011,path: "1011",type: 1,level: 5,name: "火焰风暴-高级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
3012:{uuid: 3012,path: "1012",type: 1,level: 5,name: "冰晶风暴-高级",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
4001:{uuid: 4001,path: "1001",type: 1,level: 4,name: "火球术-终极",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
4002:{uuid: 4002,path: "1002",type: 1,level: 4,name: "寒冰箭-终极",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
4003:{uuid: 4003,path: "1003",type: 1,level: 4,name: "狂暴-终极",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
4004:{uuid: 4004,path: "1004",type: 1,level: 4,name: "守护-终极",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
4005:{uuid: 4005,path: "1005",type: 1,level: 4,name: "雷霆-终极",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
4006:{uuid: 4006,path: "1006",type: 1,level: 4,name: "再生-终极",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
4007:{uuid: 4007,path: "1007",type: 1,level: 4,name: "复生-终极",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
4008:{uuid: 4008,path: "1008",type: 1,level: 4,name: "灵巧-终极",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
4009:{uuid: 4009,path: "1009",type: 1,level: 4,name: "盾守-终极",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
4010:{uuid: 4010,path: "1010",type: 1,level: 4,name: "治愈-终极",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
4011:{uuid: 4011,path: "1011",type: 1,level: 6,name: "火焰风暴-终极",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
4012:{uuid: 4012,path: "1012",type: 1,level: 6,name: "冰晶风暴-终极",sp_name:"fire",dis:720,count:1,atk:4,sd:10,cd:1,speed:350,},
|
||||
9001:{uuid: 9001,path: "9001",type: 1,level: 1,name: "基础攻击1",sp_name:"base",dis:30,count:1,atk:0,sd:10,cd:3,speed:450,},
|
||||
9002:{uuid: 9002,path: "9002",type: 1,level: 1,name: "基础攻击2",sp_name:"base2",dis:30,count:1,atk:0,sd:10,cd:3,speed:450,},
|
||||
9003:{uuid: 9003,path: "9003",type: 2,level: 1,name: "基础攻击3",sp_name:"base3",dis:720,count:1,atk:0,sd:10,cd:3,speed:450,},
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -87,7 +87,6 @@ export class Initialize extends ecs.Entity {
|
||||
this.HeroList = new HeroList();
|
||||
this.HeroList.init(); // 等待数据加载完成
|
||||
smc.heros = this.HeroList.list;
|
||||
|
||||
var uic: UICallbacks = {
|
||||
onAdded: (node: Node, params: any) => {
|
||||
var comp = node.getComponent(LoadingViewComp) as ecs.Comp;
|
||||
|
||||
@@ -39,6 +39,7 @@ export class CardControllerComp extends CCComp {
|
||||
if(smc.vm_data.gold.min >= smc.vm_data.cards.up_cost){
|
||||
smc.vm_data.gold.min -= smc.vm_data.cards.up_cost;
|
||||
smc.vm_data.cards.level += 1;
|
||||
smc.vm_data.gold.max +=2;
|
||||
smc.vm_data.cards.up_cost += 2
|
||||
if(smc.vm_data.cards.level >= smc.vm_data.cards.level_max){
|
||||
smc.vm_data.cards.level = smc.vm_data.cards.level_max;
|
||||
|
||||
@@ -21,18 +21,18 @@ export class MapMonsterComp extends CCComp {
|
||||
boss_count: number = 10; //boss波次间隔
|
||||
monster_level:number = 1; //怪物池等级
|
||||
max_monster_level:number = 4; //最高怪物次等级
|
||||
min_monster_num:number = 2; ///最小每次刷新怪物数量
|
||||
max_monster_num:number = 4; //最大每次刷新怪物数量
|
||||
refresh_timer: Timer = new Timer(5); // 刷新怪物定时器
|
||||
min_monster_num:number = 1; ///最小每次刷新怪物数量
|
||||
max_monster_num:number = 1; //最大每次刷新怪物数量
|
||||
refresh_timer: Timer = new Timer(10); // 刷新怪物定时器
|
||||
refresh_cd: Timer = new Timer(0.5);
|
||||
mission_up_timer: Timer = new Timer(30); //波次增加
|
||||
cur_mission:number = 1; //当前关卡方案
|
||||
mission_list:any = []
|
||||
setp_timer: Timer = new Timer(0.5);
|
||||
setp_num:number = 5;
|
||||
setp_num:number = 1;
|
||||
onLoad(){
|
||||
// 监听全局事件
|
||||
oops.message.on("do_add_monster", this.on_do_add_monster, this);
|
||||
oops.message.on("other_add_monster", this.on_other_add_monster, this);
|
||||
|
||||
}
|
||||
start() {
|
||||
@@ -41,7 +41,7 @@ export class MapMonsterComp extends CCComp {
|
||||
this.cur_mission = num[0]
|
||||
this.mission_list = MonsetList[this.cur_mission]
|
||||
// console.log("当前关卡方案",this.cur_mission,this.mission_list)
|
||||
this.refresh_timer= new Timer(smc.vm_data.gold.cd);
|
||||
this.refresh_timer= new Timer(smc.vm_data.gold.cd*5);
|
||||
this.monster_refresh()
|
||||
}
|
||||
protected update(dt: number): void {
|
||||
@@ -49,7 +49,7 @@ export class MapMonsterComp extends CCComp {
|
||||
this.monster_refresh()
|
||||
}
|
||||
if (this.refresh_timer.update(dt)) {
|
||||
// this.setp_num = RandomManager.instance.getRandomInt(this.min_monster_num,this.max_monster_num,2)
|
||||
this.setp_num = RandomManager.instance.getRandomInt(this.min_monster_num,this.max_monster_num,2)
|
||||
}
|
||||
if (this.mission_up_timer.update(dt)) {
|
||||
// 刷新怪物定时器
|
||||
@@ -90,15 +90,13 @@ export class MapMonsterComp extends CCComp {
|
||||
break;
|
||||
}
|
||||
monster.load(pos,scale,uuid,monster_layer);
|
||||
smc.monsters.splice(0,1)
|
||||
|
||||
}
|
||||
|
||||
private on_do_add_monster(event: string, args: any) {
|
||||
// this.addMonster(args.uuid)
|
||||
private on_other_add_monster(event: string, args: any) {
|
||||
this.addMonster(args.uuid)
|
||||
}
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
|
||||
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
|
||||
@@ -43,15 +43,15 @@ export class MapViewComp extends CCComp {
|
||||
}
|
||||
load_role(){
|
||||
let role = ecs.getEntity<Role>(Role);
|
||||
let pos = v3(0,BoxSet.GAME_LINE)
|
||||
role.load(pos,108)
|
||||
let pos = v3(BoxSet.HERO_START-50,BoxSet.GAME_LINE)
|
||||
role.load(pos,108,"Character07")
|
||||
|
||||
}
|
||||
load_data(){
|
||||
// let heros = oops.res.get("config/game/heros")
|
||||
// console.log("heros",heros)
|
||||
}
|
||||
protected update(dt: number): void {
|
||||
|
||||
// if (this.game_timer.update(dt)) {
|
||||
// smc.vm_data.game.g_time += 1;
|
||||
// }
|
||||
@@ -63,10 +63,13 @@ export class MapViewComp extends CCComp {
|
||||
gold_add(dt: number) {
|
||||
smc.vm_data.gold.time += dt;
|
||||
if (smc.vm_data.gold.time >= smc.vm_data.gold.cd) {
|
||||
if (smc.vm_data.gold.max < smc.vm_data.gold.max_limit) {
|
||||
smc.vm_data.gold.max += 1;
|
||||
// if (smc.vm_data.gold.max < smc.vm_data.gold.max_limit) {
|
||||
// smc.vm_data.gold.max += 1;
|
||||
// }
|
||||
// smc.vm_data.gold.min = smc.vm_data.gold.max;
|
||||
if(smc.vm_data.gold.min < smc.vm_data.gold.max){
|
||||
smc.vm_data.gold.min += 1;
|
||||
}
|
||||
smc.vm_data.gold.min = smc.vm_data.gold.max;
|
||||
smc.vm_data.gold.time = 0;
|
||||
}
|
||||
}
|
||||
@@ -84,6 +87,6 @@ export class MapViewComp extends CCComp {
|
||||
let scale = 1
|
||||
hero.load(pos,scale,uuid);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { _decorator,Contact2DType,Collider2D ,IPhysics2DContact,v3, v2} from "cc";
|
||||
import { _decorator,Contact2DType,Collider2D ,IPhysics2DContact,v3, v2,Vec3} 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 { BoxSet } from "../common/config/BoxSet";
|
||||
import { MonsterViewComp } from "./MonsterViewComp";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@@ -19,44 +20,49 @@ export class BoxRangComp extends CCComp {
|
||||
let collider = this.getComponent(Collider2D);
|
||||
collider.group = this.box_group;
|
||||
collider.tag = this.box_tag;
|
||||
collider.offset = v2(this.offset_x,45);
|
||||
// collider.offset = v2(this.offset_x,45);
|
||||
this.Hero_node = this.node.parent;
|
||||
this.MonsterViewComp=this.Hero_node.getComponent(MonsterViewComp);
|
||||
// console.log("range box",this.MonsterViewComp);
|
||||
if (collider) {
|
||||
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.END_CONTACT, this.onEndContact, this);
|
||||
collider.on(Contact2DType.PRE_SOLVE, this.onPreSolve, this);
|
||||
collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);
|
||||
}
|
||||
}
|
||||
onBeginContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||
if(selfCollider.group != otherCollider.group&&otherCollider.tag == 0){
|
||||
// console.log("range box group: seft:"+selfCollider.group+"|other:"+otherCollider.group+"| tag: seft:"+selfCollider.tag+"|other:"+otherCollider.tag);
|
||||
this.MonsterViewComp.is_atking = true;
|
||||
if(Math.abs(otherCollider.node.position.x-selfCollider.node.position.x) < 120){
|
||||
this.MonsterViewComp.stop_cd = 0.1
|
||||
}
|
||||
}
|
||||
|
||||
// if(selfCollider.group != otherCollider.group&&otherCollider.tag == 0){
|
||||
// console.log(this.node.name+"onBeginContact: seft:"+selfCollider.group+"|other:"+otherCollider.group+"| tag: seft:"+selfCollider.tag+"|other:"+otherCollider.tag);
|
||||
// this.MonsterViewComp.is_atking = true;
|
||||
// if(Math.abs(otherCollider.node.position.x-selfCollider.node.position.x) < 120){
|
||||
// this.MonsterViewComp.stop_cd = 0.1
|
||||
// }
|
||||
// }
|
||||
}
|
||||
onEndContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||
if(selfCollider.group != otherCollider.group&&otherCollider.tag == 0 ){
|
||||
// console.log("range box group: seft:"+selfCollider.group+"|other:"+otherCollider.group+"| tag: seft:"+selfCollider.tag+"|other:"+otherCollider.tag);
|
||||
// console.log(this.node.name+"onEndContact: seft:"+selfCollider.group+"|other:"+otherCollider.group+"| tag: seft:"+selfCollider.tag+"|other:"+otherCollider.tag);
|
||||
this.MonsterViewComp.is_atking = false;
|
||||
}
|
||||
}
|
||||
onPreSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||
if(selfCollider.group != otherCollider.group&&otherCollider.tag == 0){
|
||||
console.log("range box group: seft:"+selfCollider.group+"|other:"+otherCollider.group+"| tag: seft:"+selfCollider.tag+"|other:"+otherCollider.tag);
|
||||
this.MonsterViewComp.is_atking = true;
|
||||
if(Math.abs(otherCollider.node.position.x-selfCollider.node.position.x) < 120){
|
||||
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);
|
||||
if(Math.abs(other_pos.x-self_pos.x) < BoxSet.ATK_RANGE_X){
|
||||
this.MonsterViewComp.stop_cd = 0.1
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -67,8 +67,7 @@ export class CSkillComp extends CCComp {
|
||||
let dis = SkillSet[this.skill_uuid].dis+this.dis;
|
||||
let atk = SkillSet[this.skill_uuid].atk+this.atk;
|
||||
let speed = SkillSet[this.skill_uuid].speed+this.speed;
|
||||
let sp_name = SkillSet[this.skill_uuid].sp_name
|
||||
skill.load(pos,speed,dis,scale,this.node,sp_name,atk,angle,t_pos);
|
||||
skill.load(pos,speed,dis,scale,this.node,this.skill_uuid,atk,angle,t_pos);
|
||||
}
|
||||
/** 全局消息逻辑处理 */
|
||||
// private onHandler(event: string, args: any) {
|
||||
|
||||
@@ -78,9 +78,7 @@ export class Hero extends ecs.Entity {
|
||||
mv.change_name(smc.heros[uuid].name,1)
|
||||
this.add(mv);
|
||||
}
|
||||
push_monsters_in(uuid:number=1001,eid:number=0){
|
||||
smc.monsters_in.push({name:smc.heros[uuid].name,eid:eid})
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -32,6 +32,7 @@ export class Monster extends ecs.Entity {
|
||||
}
|
||||
|
||||
destroy(): void {
|
||||
|
||||
this.remove(MonsterViewComp);
|
||||
super.destroy();
|
||||
}
|
||||
@@ -66,16 +67,12 @@ export class Monster extends ecs.Entity {
|
||||
mv.atk_cd = smc.heros[uuid].atk_cd;
|
||||
mv.power = smc.heros[uuid].power;
|
||||
mv.type = smc.heros[uuid].type;
|
||||
mv.skill_uuid = 9002;
|
||||
mv.skill_uuid = 9001;
|
||||
mv.max_skill_uuid = smc.heros[uuid].max_skill_uuid;
|
||||
mv.scale = -1;
|
||||
mv.Tpos = v3(0,0,0);
|
||||
mv.change_name(smc.heros[uuid].name,-1)
|
||||
this.add(mv);
|
||||
this.push_monsters_in(uuid,mv.ent.eid)
|
||||
|
||||
}
|
||||
push_monsters_in(uuid:number=1001,eid:number=0){
|
||||
smc.monsters_in.push({name:smc.heros[uuid].name,eid:eid})
|
||||
}
|
||||
|
||||
}
|
||||
@@ -49,7 +49,7 @@ export class MonsterSpine extends Component {
|
||||
this.spine.setAnimation(0, animName, loop);
|
||||
}
|
||||
atk() {
|
||||
this.spine.setAnimation(0, "atk", false);
|
||||
this.spine.setAnimation(0, "atk2", false);
|
||||
}
|
||||
setAlpha(value: number): void {
|
||||
var color: Color = this.spine.color;
|
||||
|
||||
@@ -47,7 +47,7 @@ export class MonsterViewComp extends CCComp {
|
||||
hp_speed: number = 0; //每秒回复量
|
||||
|
||||
power: number = 0; /**能量**/
|
||||
power_max: number = 100; /** 能量最大值 */
|
||||
power_max: number = 600*3; /** 能量最大值 */
|
||||
power_speed: number = 1; //能量回复速度每0.1秒回复量
|
||||
|
||||
skill_name: string = "base"; //技能名称
|
||||
@@ -76,7 +76,7 @@ export class MonsterViewComp extends CCComp {
|
||||
|
||||
onLoad() {
|
||||
this.as = this.getComponent(MonsterSpine);
|
||||
PhysicsSystem2D.instance.debugDrawFlags = EPhysics2DDrawFlags.Aabb
|
||||
// PhysicsSystem2D.instance.debugDrawFlags = EPhysics2DDrawFlags.Aabb
|
||||
// | EPhysics2DDrawFlags.Pair
|
||||
// |EPhysics2DDrawFlags.CenterOfMass
|
||||
// |EPhysics2DDrawFlags.Joint
|
||||
@@ -89,7 +89,7 @@ export class MonsterViewComp extends CCComp {
|
||||
|
||||
this.BoxRang = this.node.getChildByName("range_box");
|
||||
this.BoxRang.getComponent(BoxRangComp).box_group = this.box_group;
|
||||
this.BoxRang.getComponent(BoxRangComp).offset_x = this.scale*SkillSet[this.skill_uuid].dis-30;
|
||||
this.BoxRang.getComponent(BoxRangComp).offset_x = this.scale*SkillSet[this.skill_uuid].dis;
|
||||
// console.log("monseter ",this.BoxRang);
|
||||
|
||||
// 注册单个碰撞体的回调函数
|
||||
@@ -123,7 +123,7 @@ export class MonsterViewComp extends CCComp {
|
||||
|
||||
}
|
||||
onPreSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||
if(selfCollider.group != otherCollider.group&&otherCollider.tag != BoxSet.ATK_RANGE&&otherCollider.tag != BoxSet.SKILL_TAG){
|
||||
if(selfCollider.group != otherCollider.group&&otherCollider.tag == 0){
|
||||
this.is_atking = true;
|
||||
this.stop_cd = 0.1;
|
||||
}
|
||||
@@ -132,25 +132,21 @@ export class MonsterViewComp extends CCComp {
|
||||
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||
|
||||
|
||||
if(selfCollider.group == otherCollider.group){
|
||||
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 相同');
|
||||
if(otherCollider.tag != BoxSet.SKILL_TAG){
|
||||
let self_pos=selfCollider.node.getPosition();
|
||||
let other_pos=otherCollider.node.getPosition();
|
||||
if(selfCollider.group == BoxSet.HERO){
|
||||
if(self_pos.x < other_pos.x&&Math.abs(self_pos.x-other_pos.x) <= 20&&self_pos.y==other_pos.y){
|
||||
this.stop_cd=0.1
|
||||
}
|
||||
switch (selfCollider.group) {
|
||||
case BoxSet.HERO:
|
||||
if(self_pos.x < other_pos.x&&Math.abs(self_pos.x-other_pos.x) <= BoxSet.MOVE_RANGE_X && self_pos.y==other_pos.y){
|
||||
this.stop_cd=0.1
|
||||
}
|
||||
break;
|
||||
case BoxSet.MONSTER:
|
||||
if(self_pos.x > other_pos.x&&Math.abs(self_pos.x-other_pos.x) <= BoxSet.MOVE_RANGE_X && self_pos.y==other_pos.y){
|
||||
this.stop_cd=0.1
|
||||
}
|
||||
}
|
||||
if(selfCollider.group == BoxSet.MONSTER){
|
||||
if(self_pos.x > other_pos.x&&Math.abs(self_pos.x-other_pos.x) <= 20&&self_pos.y==other_pos.y){
|
||||
this.stop_cd=0.1
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}else{
|
||||
// console.log('monster onPostSolve'+selfCollider.group+"|"+otherCollider.group);
|
||||
}
|
||||
|
||||
|
||||
@@ -178,7 +174,7 @@ export class MonsterViewComp extends CCComp {
|
||||
this.in_stop(dt);
|
||||
this.in_act(dt);
|
||||
this.move(dt);
|
||||
// this.update_pos();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -191,7 +187,7 @@ export class MonsterViewComp extends CCComp {
|
||||
* 如果角色属于正向阵营 (scale == 1) 且 x 轴位置大于等于 0,则直接返回。
|
||||
* 如果角色属于反向阵营 (scale != 1) 且 x 轴位置小于等于 0,则直接返回。
|
||||
*/
|
||||
if ((this.scale === 1 && this.node.position.x >= 120) || (this.scale !== 1 && this.node.position.x <= -180)) {
|
||||
if (this.scale === 1 && this.node.position.x >= 120) {
|
||||
return;
|
||||
}
|
||||
this.node.setPosition(this.node.position.x+dt*this.speed*this.scale, this.node.position.y, this.node.position.z);
|
||||
@@ -213,12 +209,11 @@ export class MonsterViewComp extends CCComp {
|
||||
let skill = ecs.getEntity<Skill>(Skill);
|
||||
let x=32
|
||||
let pos = v3(this.scale*32,30)
|
||||
let speed =SkillSet[skill_uuid].speed;
|
||||
let scale = this.scale
|
||||
let speed =SkillSet[skill_uuid].speed;
|
||||
let dis = SkillSet[skill_uuid].dis;
|
||||
let atk = SkillSet[skill_uuid].atk+this.atk;
|
||||
let sp_name = SkillSet[skill_uuid].sp_name;
|
||||
skill.load(pos,speed,dis,scale,this.node,sp_name,atk);
|
||||
skill.load(pos,speed,dis,scale,this.node,skill_uuid,atk);
|
||||
}
|
||||
in_act(dt: number) {
|
||||
|
||||
@@ -278,13 +273,6 @@ export class MonsterViewComp extends CCComp {
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
update_pos(){
|
||||
smc.monsters_in.forEach((element,index) => {
|
||||
if(element.eid == this.ent.eid){
|
||||
element.pos_x = this.node.position.x;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
in_atked() {
|
||||
this.sprite.setSharedMaterial(this.hitFlashMaterial, 0);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { BoxSet } from "../common/config/BoxSet";
|
||||
import { SkillSet } from "../common/config/SkillSet";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { SkillCom } from "./SkillCom";
|
||||
import { instantiate, Node, Prefab, Vec3 ,tween, v3,animation,Label,resources,SpriteFrame,Sprite} from "cc";
|
||||
@@ -28,8 +29,8 @@ export class Skill extends ecs.Entity {
|
||||
this.remove(SkillCom);
|
||||
super.destroy();
|
||||
}
|
||||
load(pos: Vec3 = Vec3.ZERO,speed:number = 100,dis:number = 50,scale:number = 1,parent:Node,sp_name:string = "base",atk:number =10,angle = 0,t_pos:Vec3 = null) {
|
||||
var path = "game/skills/"+sp_name;
|
||||
load(pos: Vec3 = Vec3.ZERO,speed:number = 100,dis:number = 50,scale:number = 1,parent:Node,uuid:number=1001,atk:number =10,angle = 0,t_pos:Vec3 = null) {
|
||||
var path = "game/skills/"+SkillSet[uuid].sp_name;
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
var node = instantiate(prefab);
|
||||
node.parent = parent;
|
||||
@@ -43,6 +44,7 @@ export class Skill extends ecs.Entity {
|
||||
sv.atk = atk;
|
||||
sv.angle = angle;
|
||||
sv.t_pos = t_pos;
|
||||
sv.type = SkillSet[uuid].type;
|
||||
sv.box_tag= BoxSet.SKILL_TAG;
|
||||
if(scale == 1){
|
||||
sv.box_group=BoxSet.HERO
|
||||
|
||||
@@ -27,6 +27,7 @@ export class SkillCom extends CCComp {
|
||||
is_destroy:boolean = false;
|
||||
box_group:number = 0;
|
||||
box_tag:number=0;
|
||||
type:number = 1;
|
||||
time:Timer = new Timer(0.01);
|
||||
start() {
|
||||
this.node.active=true
|
||||
@@ -70,7 +71,9 @@ export class SkillCom extends CCComp {
|
||||
onBeginContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||
if(otherCollider.group != selfCollider.group&&otherCollider.tag !=BoxSet.ATK_RANGE&&otherCollider.tag !=BoxSet.SKILL_TAG){
|
||||
// console.log("skill onBeginContact",selfCollider.group,otherCollider.group)
|
||||
this.is_destroy=true
|
||||
if(this.type==1){
|
||||
this.is_destroy=true
|
||||
}
|
||||
}
|
||||
}
|
||||
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||
|
||||
Reference in New Issue
Block a user