This commit is contained in:
2024-08-08 10:44:58 +08:00
parent d06189486d
commit 3eca33a33f
11 changed files with 677 additions and 453 deletions

View File

@@ -998,7 +998,7 @@
"_group": 1,
"_density": 1,
"_sensor": false,
"_friction": 0.1,
"_friction": 1,
"_restitution": 0,
"_offset": {
"__type__": "cc.Vec2",

View File

@@ -843,7 +843,7 @@
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 42.648,
"y": 14.6,
"z": 0
},
"_lrot": {
@@ -1376,8 +1376,8 @@
"_group": 2,
"_density": 1,
"_sensor": false,
"_friction": 0.2,
"_restitution": 0,
"_friction": 1,
"_restitution": 0.2,
"_offset": {
"__type__": "cc.Vec2",
"x": 1.7,
@@ -1421,7 +1421,7 @@
"y": 0
},
"_angularVelocity": 0,
"_fixedRotation": false,
"_fixedRotation": true,
"_id": ""
},
{

View File

@@ -2,18 +2,8 @@
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "c2392cff-8a0b-4baa-95de-e3bfe2999f3c",
"uuid": "240eb21f-5342-45b5-8440-6b6828e539fa",
"files": [],
"subMetas": {},
"userData": {
"compressionType": {
"wechatgame": "zip"
},
"isRemoteBundle": {
"wechatgame": true,
"web-mobile": true,
"web-desktop": true
},
"isBundle": false
}
"userData": {}
}

View File

@@ -0,0 +1,12 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "9e4a59af-22c3-4c0b-b864-98193db88d5f",
"files": [],
"subMetas": {},
"userData": {
"compressionType": {},
"isRemoteBundle": {}
}
}

View File

@@ -2,12 +2,12 @@
"ver": "1.1.50",
"importer": "prefab",
"imported": true,
"uuid": "c6dffedb-40ff-452c-981d-864b29130612",
"uuid": "b3142304-c27f-4492-b94f-551d154a2bf4",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "monster"
"syncNodeName": "loading"
}
}

View File

@@ -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()

View File

@@ -51,7 +51,7 @@ export class SingletonModuleComp extends ecs.Comp {
},
shuaxin: {
min: 0,
max: 20,
max: 2,
speed:1,
},
gold_add: {

View File

@@ -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处理逻辑分享功能独立的业务代码 */

View File

@@ -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();
}

View File

@@ -44,8 +44,8 @@
],
"collisionMatrix": {
"0": 31,
"1": 23,
"2": 15,
"1": 21,
"2": 11,
"3": 5,
"4": 3
}