dd
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
* @LastEditors: dgflash
|
||||
* @LastEditTime: 2022-08-17 13:43:02
|
||||
*/
|
||||
import { profiler, _decorator ,PhysicsSystem2D} from 'cc';
|
||||
import { profiler, _decorator ,PhysicsSystem2D,RigidBody} from 'cc';
|
||||
import { DEBUG } from 'cc/env';
|
||||
import { oops } from '../../extensions/oops-plugin-framework/assets/core/Oops';
|
||||
import { Root } from '../../extensions/oops-plugin-framework/assets/core/Root';
|
||||
@@ -19,21 +19,24 @@ const { ccclass, property } = _decorator;
|
||||
export class Main extends Root {
|
||||
start() {
|
||||
if (DEBUG) profiler.showStats();
|
||||
|
||||
}
|
||||
|
||||
protected async run() {
|
||||
smc.initialize = ecs.getEntity<Initialize>(Initialize);
|
||||
smc.monsters = [
|
||||
{prefab_path:'lang',name:'迅狼',speed:110},
|
||||
{prefab_path:'hero',name:'火猴',speed:100},
|
||||
// {prefab_path:'niu',name:'m3',speed:40},
|
||||
// {prefab_path:'niu',name:'m4',speed:80},
|
||||
{prefab_path:'lang',name:'迅狼',speed:40},
|
||||
{prefab_path:'hero',name:'火猴',speed:40},
|
||||
{prefab_path:'lang',name:'m3',speed:40},
|
||||
{prefab_path:'lang',name:'m4',speed:40},
|
||||
{prefab_path:'lang',name:'m3',speed:40},
|
||||
{prefab_path:'lang',name:'m4',speed:40},
|
||||
]
|
||||
smc.heros = [
|
||||
// {prefab_path:'lang',name:'迅狼',speed:110},
|
||||
{prefab_path:'liubang',name:'刘邦',speed:80},
|
||||
{prefab_path:'mulan',name:'花木兰',speed:70},
|
||||
{prefab_path:'yinzheng',name:'嬴政',speed:60},
|
||||
{prefab_path:'liubang',name:'刘邦',speed:40},
|
||||
{prefab_path:'mulan',name:'花木兰',speed:40},
|
||||
{prefab_path:'yinzheng',name:'嬴政',speed:40},
|
||||
]
|
||||
console.log("Game start");
|
||||
smc.vmAdd()
|
||||
|
||||
@@ -51,7 +51,7 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
},
|
||||
shuaxin: {
|
||||
min: 0,
|
||||
max: 20,
|
||||
max: 2,
|
||||
speed:1,
|
||||
},
|
||||
gold_add: {
|
||||
|
||||
@@ -72,7 +72,7 @@ export class Monster extends ecs.Entity {
|
||||
oops.message.dispatchEvent("monster_load",this)
|
||||
}
|
||||
|
||||
|
||||
console.log(smc.heros_in,smc.monsters_in)
|
||||
}
|
||||
|
||||
/** 移动(ECS System处理逻辑,分享功能独立的业务代码) */
|
||||
|
||||
@@ -5,11 +5,12 @@
|
||||
* @LastEditTime: 2022-08-17 12:36:18
|
||||
*/
|
||||
|
||||
import { Vec3, _decorator ,tween, v3,Collider2D,Contact2DType,PhysicsSystem2D,IPhysics2DContact,EPhysics2DDrawFlags,Label,Node} from "cc";
|
||||
import { Vec3, _decorator , v3,Collider2D,Contact2DType,PhysicsSystem2D,IPhysics2DContact,EPhysics2DDrawFlags,Label,Node} 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 { MonsterSpine } from "./MonsterSpine";
|
||||
import { Monster } from "./Monster";
|
||||
import { Hero } from "./Hero";
|
||||
import { MonsterModelComp } from "./MonsterModelComp";
|
||||
import { BoxSet } from "../common/config/BoxSet";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
@@ -50,6 +51,9 @@ export class MonsterViewComp extends CCComp {
|
||||
// collider.on(Contact2DType.PRE_SOLVE, this.onPreSolve, this);
|
||||
collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
onBeginContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||
switch (selfCollider.group) {
|
||||
@@ -57,7 +61,7 @@ export class MonsterViewComp extends CCComp {
|
||||
switch (otherCollider.group){
|
||||
case BoxSet.HERO:
|
||||
this.state = 2;
|
||||
console.log('onBeginContact',selfCollider,otherCollider);
|
||||
// console.log('onBeginContact',selfCollider,otherCollider);
|
||||
// this.speed = 0;
|
||||
// this.timer = 1;
|
||||
// console.log("speed:"+this.speed+" | timer:"+this.timer);
|
||||
@@ -135,7 +139,7 @@ export class MonsterViewComp extends CCComp {
|
||||
}
|
||||
|
||||
this.move(dt);
|
||||
this.update_pos();
|
||||
// this.update_pos();
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user