原来是全局碰撞惹的祸
This commit is contained in:
@@ -27,18 +27,18 @@
|
||||
],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 66
|
||||
},
|
||||
{
|
||||
"__id__": 68
|
||||
},
|
||||
{
|
||||
"__id__": 70
|
||||
},
|
||||
{
|
||||
"__id__": 72
|
||||
},
|
||||
{
|
||||
"__id__": 74
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 72
|
||||
"__id__": 76
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
@@ -196,18 +196,18 @@
|
||||
],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 59
|
||||
},
|
||||
{
|
||||
"__id__": 61
|
||||
},
|
||||
{
|
||||
"__id__": 63
|
||||
},
|
||||
{
|
||||
"__id__": 65
|
||||
},
|
||||
{
|
||||
"__id__": 67
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 65
|
||||
"__id__": 69
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
@@ -251,20 +251,20 @@
|
||||
"__id__": 8
|
||||
},
|
||||
{
|
||||
"__id__": 38
|
||||
"__id__": 42
|
||||
},
|
||||
{
|
||||
"__id__": 50
|
||||
"__id__": 54
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 56
|
||||
"__id__": 60
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 58
|
||||
"__id__": 62
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
@@ -311,14 +311,14 @@
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 33
|
||||
"__id__": 37
|
||||
},
|
||||
{
|
||||
"__id__": 35
|
||||
"__id__": 39
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 37
|
||||
"__id__": 41
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
@@ -371,14 +371,14 @@
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 28
|
||||
"__id__": 32
|
||||
},
|
||||
{
|
||||
"__id__": 30
|
||||
"__id__": 34
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 32
|
||||
"__id__": 36
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
@@ -697,10 +697,16 @@
|
||||
},
|
||||
{
|
||||
"__id__": 25
|
||||
},
|
||||
{
|
||||
"__id__": 27
|
||||
},
|
||||
{
|
||||
"__id__": 29
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 27
|
||||
"__id__": 31
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
@@ -804,6 +810,74 @@
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "66D90QlYtEvKkAU6KcReVW"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.RigidBody2D",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 22
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 28
|
||||
},
|
||||
"enabledContactListener": false,
|
||||
"bullet": true,
|
||||
"awakeOnLoad": true,
|
||||
"_group": 1,
|
||||
"_type": 0,
|
||||
"_allowSleep": false,
|
||||
"_gravityScale": 0,
|
||||
"_linearDamping": 0,
|
||||
"_angularDamping": 0,
|
||||
"_linearVelocity": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"_angularVelocity": 0,
|
||||
"_fixedRotation": false,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "fa0hN7/dVNJp+ZtcBdqwHp"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.BoxCollider2D",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 22
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 30
|
||||
},
|
||||
"tag": 0,
|
||||
"_group": 1,
|
||||
"_density": 1,
|
||||
"_sensor": false,
|
||||
"_friction": 0.1,
|
||||
"_restitution": 0,
|
||||
"_offset": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": -1.1,
|
||||
"y": -27.5
|
||||
},
|
||||
"_size": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 1177.9,
|
||||
"height": 830
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "fexeczFgpEObyOHYY30dp9"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
@@ -827,7 +901,7 @@
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 29
|
||||
"__id__": 33
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
@@ -855,7 +929,7 @@
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 31
|
||||
"__id__": 35
|
||||
},
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
@@ -913,7 +987,7 @@
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 34
|
||||
"__id__": 38
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
@@ -941,10 +1015,10 @@
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 36
|
||||
"__id__": 40
|
||||
},
|
||||
"bgImg": {
|
||||
"__id__": 30
|
||||
"__id__": 34
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
@@ -975,17 +1049,17 @@
|
||||
},
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 39
|
||||
"__id__": 43
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 47
|
||||
"__id__": 51
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 49
|
||||
"__id__": 53
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
@@ -1022,23 +1096,23 @@
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"_parent": {
|
||||
"__id__": 38
|
||||
"__id__": 42
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 40
|
||||
},
|
||||
{
|
||||
"__id__": 42
|
||||
},
|
||||
{
|
||||
"__id__": 44
|
||||
},
|
||||
{
|
||||
"__id__": 46
|
||||
},
|
||||
{
|
||||
"__id__": 48
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 46
|
||||
"__id__": 50
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
@@ -1075,11 +1149,11 @@
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 39
|
||||
"__id__": 43
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 41
|
||||
"__id__": 45
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
@@ -1103,11 +1177,11 @@
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 39
|
||||
"__id__": 43
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 43
|
||||
"__id__": 47
|
||||
},
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
@@ -1171,11 +1245,11 @@
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 39
|
||||
"__id__": 43
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 45
|
||||
"__id__": 49
|
||||
},
|
||||
"templateMode": false,
|
||||
"watchPath": "data.name",
|
||||
@@ -1206,11 +1280,11 @@
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 38
|
||||
"__id__": 42
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 48
|
||||
"__id__": 52
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
@@ -1253,14 +1327,14 @@
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 51
|
||||
"__id__": 55
|
||||
},
|
||||
{
|
||||
"__id__": 53
|
||||
"__id__": 57
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 55
|
||||
"__id__": 59
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
@@ -1297,11 +1371,11 @@
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 50
|
||||
"__id__": 54
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 52
|
||||
"__id__": 56
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
@@ -1325,11 +1399,11 @@
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 50
|
||||
"__id__": 54
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 54
|
||||
"__id__": 58
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
@@ -1360,7 +1434,7 @@
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 57
|
||||
"__id__": 61
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
@@ -1401,7 +1475,7 @@
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 60
|
||||
"__id__": 64
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
@@ -1429,7 +1503,7 @@
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 62
|
||||
"__id__": 66
|
||||
},
|
||||
"camera": {
|
||||
"__id__": 3
|
||||
@@ -1438,13 +1512,13 @@
|
||||
"__id__": 7
|
||||
},
|
||||
"mapLayer": {
|
||||
"__id__": 35
|
||||
"__id__": 39
|
||||
},
|
||||
"floorLayer": {
|
||||
"__id__": 38
|
||||
"__id__": 42
|
||||
},
|
||||
"entityLayer": {
|
||||
"__id__": 53
|
||||
"__id__": 57
|
||||
},
|
||||
"isFollowPlayer": true,
|
||||
"_id": ""
|
||||
@@ -1463,9 +1537,8 @@
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 64
|
||||
"__id__": 68
|
||||
},
|
||||
"boss": null,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
@@ -1495,7 +1568,7 @@
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 67
|
||||
"__id__": 71
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
@@ -1523,7 +1596,7 @@
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 69
|
||||
"__id__": 73
|
||||
},
|
||||
"_cameraComponent": {
|
||||
"__id__": 3
|
||||
@@ -1545,7 +1618,7 @@
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 71
|
||||
"__id__": 75
|
||||
},
|
||||
"_alignFlags": 45,
|
||||
"_target": null,
|
||||
|
||||
@@ -811,7 +811,7 @@
|
||||
"tag": 0,
|
||||
"_group": 2,
|
||||
"_density": 1,
|
||||
"_sensor": true,
|
||||
"_sensor": false,
|
||||
"_friction": 0.2,
|
||||
"_restitution": 0,
|
||||
"_offset": {
|
||||
@@ -846,9 +846,9 @@
|
||||
"bullet": true,
|
||||
"awakeOnLoad": true,
|
||||
"_group": 2,
|
||||
"_type": 1,
|
||||
"_type": 2,
|
||||
"_allowSleep": false,
|
||||
"_gravityScale": 0,
|
||||
"_gravityScale": 1,
|
||||
"_linearDamping": 0,
|
||||
"_angularDamping": 0,
|
||||
"_linearVelocity": {
|
||||
|
||||
@@ -117,8 +117,8 @@
|
||||
},
|
||||
"_lscale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -1,
|
||||
"y": 1,
|
||||
"x": -1.5,
|
||||
"y": 1.5,
|
||||
"z": 1
|
||||
},
|
||||
"_mobility": 0,
|
||||
@@ -651,6 +651,7 @@
|
||||
"__prefab": {
|
||||
"__id__": 31
|
||||
},
|
||||
"_ospeed": 100,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
@@ -669,10 +670,10 @@
|
||||
"__prefab": {
|
||||
"__id__": 33
|
||||
},
|
||||
"tag": 0,
|
||||
"tag": 90,
|
||||
"_group": 2,
|
||||
"_density": 1,
|
||||
"_sensor": true,
|
||||
"_sensor": false,
|
||||
"_friction": 0.2,
|
||||
"_restitution": 0,
|
||||
"_offset": {
|
||||
@@ -707,9 +708,9 @@
|
||||
"bullet": true,
|
||||
"awakeOnLoad": true,
|
||||
"_group": 2,
|
||||
"_type": 1,
|
||||
"_type": 2,
|
||||
"_allowSleep": false,
|
||||
"_gravityScale": 0,
|
||||
"_gravityScale": 1,
|
||||
"_linearDamping": 0,
|
||||
"_angularDamping": 0,
|
||||
"_linearVelocity": {
|
||||
|
||||
@@ -1,192 +0,0 @@
|
||||
[
|
||||
{
|
||||
"__type__": "cc.AnimationClip",
|
||||
"_name": "animation",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {
|
||||
"embeddedPlayerGroups": []
|
||||
},
|
||||
"_native": "",
|
||||
"sample": 60,
|
||||
"speed": 1,
|
||||
"wrapMode": 2,
|
||||
"enableTrsBlending": false,
|
||||
"_duration": 0.3333333333333333,
|
||||
"_hash": 500763545,
|
||||
"_tracks": [
|
||||
{
|
||||
"__id__": 1
|
||||
}
|
||||
],
|
||||
"_exoticAnimation": null,
|
||||
"_events": [],
|
||||
"_embeddedPlayers": [],
|
||||
"_additiveSettings": {
|
||||
"__id__": 11
|
||||
},
|
||||
"_auxiliaryCurveEntries": []
|
||||
},
|
||||
{
|
||||
"__type__": "cc.animation.VectorTrack",
|
||||
"_binding": {
|
||||
"__type__": "cc.animation.TrackBinding",
|
||||
"path": {
|
||||
"__id__": 2
|
||||
},
|
||||
"proxy": null
|
||||
},
|
||||
"_channels": [
|
||||
{
|
||||
"__id__": 3
|
||||
},
|
||||
{
|
||||
"__id__": 5
|
||||
},
|
||||
{
|
||||
"__id__": 7
|
||||
},
|
||||
{
|
||||
"__id__": 9
|
||||
}
|
||||
],
|
||||
"_nComponents": 3
|
||||
},
|
||||
{
|
||||
"__type__": "cc.animation.TrackPath",
|
||||
"_paths": [
|
||||
"position"
|
||||
]
|
||||
},
|
||||
{
|
||||
"__type__": "cc.animation.Channel",
|
||||
"_curve": {
|
||||
"__id__": 4
|
||||
}
|
||||
},
|
||||
{
|
||||
"__type__": "cc.RealCurve",
|
||||
"_times": [
|
||||
0
|
||||
],
|
||||
"_values": [
|
||||
{
|
||||
"__type__": "cc.RealKeyframeValue",
|
||||
"interpolationMode": 0,
|
||||
"tangentWeightMode": 0,
|
||||
"value": 0,
|
||||
"rightTangent": 0,
|
||||
"rightTangentWeight": 1,
|
||||
"leftTangent": 0,
|
||||
"leftTangentWeight": 1,
|
||||
"easingMethod": 0,
|
||||
"__editorExtras__": null
|
||||
}
|
||||
],
|
||||
"preExtrapolation": 1,
|
||||
"postExtrapolation": 1
|
||||
},
|
||||
{
|
||||
"__type__": "cc.animation.Channel",
|
||||
"_curve": {
|
||||
"__id__": 6
|
||||
}
|
||||
},
|
||||
{
|
||||
"__type__": "cc.RealCurve",
|
||||
"_times": [
|
||||
0,
|
||||
0.1666666716337204,
|
||||
0.3333333432674408
|
||||
],
|
||||
"_values": [
|
||||
{
|
||||
"__type__": "cc.RealKeyframeValue",
|
||||
"interpolationMode": 0,
|
||||
"tangentWeightMode": 0,
|
||||
"value": 0,
|
||||
"rightTangent": 0,
|
||||
"rightTangentWeight": 1,
|
||||
"leftTangent": 0,
|
||||
"leftTangentWeight": 1,
|
||||
"easingMethod": 0,
|
||||
"__editorExtras__": null
|
||||
},
|
||||
{
|
||||
"__type__": "cc.RealKeyframeValue",
|
||||
"interpolationMode": 0,
|
||||
"tangentWeightMode": 0,
|
||||
"value": 30,
|
||||
"rightTangent": 0,
|
||||
"rightTangentWeight": 1,
|
||||
"leftTangent": 0,
|
||||
"leftTangentWeight": 1,
|
||||
"easingMethod": 0,
|
||||
"__editorExtras__": {
|
||||
"tangentMode": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"__type__": "cc.RealKeyframeValue",
|
||||
"interpolationMode": 0,
|
||||
"tangentWeightMode": 0,
|
||||
"value": 0,
|
||||
"rightTangent": 0,
|
||||
"rightTangentWeight": 1,
|
||||
"leftTangent": 0,
|
||||
"leftTangentWeight": 1,
|
||||
"easingMethod": 0,
|
||||
"__editorExtras__": {
|
||||
"tangentMode": 0
|
||||
}
|
||||
}
|
||||
],
|
||||
"preExtrapolation": 1,
|
||||
"postExtrapolation": 1
|
||||
},
|
||||
{
|
||||
"__type__": "cc.animation.Channel",
|
||||
"_curve": {
|
||||
"__id__": 8
|
||||
}
|
||||
},
|
||||
{
|
||||
"__type__": "cc.RealCurve",
|
||||
"_times": [
|
||||
0
|
||||
],
|
||||
"_values": [
|
||||
{
|
||||
"__type__": "cc.RealKeyframeValue",
|
||||
"interpolationMode": 0,
|
||||
"tangentWeightMode": 0,
|
||||
"value": 0,
|
||||
"rightTangent": 0,
|
||||
"rightTangentWeight": 1,
|
||||
"leftTangent": 0,
|
||||
"leftTangentWeight": 1,
|
||||
"easingMethod": 0,
|
||||
"__editorExtras__": null
|
||||
}
|
||||
],
|
||||
"preExtrapolation": 1,
|
||||
"postExtrapolation": 1
|
||||
},
|
||||
{
|
||||
"__type__": "cc.animation.Channel",
|
||||
"_curve": {
|
||||
"__id__": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"__type__": "cc.RealCurve",
|
||||
"_times": [],
|
||||
"_values": [],
|
||||
"preExtrapolation": 1,
|
||||
"postExtrapolation": 1
|
||||
},
|
||||
{
|
||||
"__type__": "cc.AnimationClipAdditiveSettings",
|
||||
"enabled": false,
|
||||
"refClip": null
|
||||
}
|
||||
]
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"ver": "2.0.3",
|
||||
"importer": "animation-clip",
|
||||
"imported": true,
|
||||
"uuid": "9fbb4e9a-8a4f-42b0-b402-4f56823ca4af",
|
||||
"files": [
|
||||
".cconb"
|
||||
],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"name": "animation"
|
||||
}
|
||||
}
|
||||
@@ -24,13 +24,13 @@ export class Main extends Root {
|
||||
protected async run() {
|
||||
smc.initialize = ecs.getEntity<Initialize>(Initialize);
|
||||
smc.monsters = [
|
||||
{profession:'m1',speed:50},
|
||||
{profession:'m2',speed:60},
|
||||
{profession:'m3',speed:70},
|
||||
{profession:'m4',speed:80},
|
||||
{name:'niu',profession:'m1',speed:50},
|
||||
{name:'niu',profession:'m2',speed:100},
|
||||
{name:'niu',profession:'m3',speed:50},
|
||||
{name:'niu',profession:'m4',speed:100},
|
||||
]
|
||||
smc.heros = [
|
||||
{profession:'war',speed:50},
|
||||
{name:'hero',profession:'war',speed:50},
|
||||
// {profession:'magic',speed:50},
|
||||
// {profession:'heath',speed:50},
|
||||
// {profession:'war',speed:50},
|
||||
|
||||
@@ -8,10 +8,12 @@
|
||||
/** 碰撞分组 */
|
||||
export enum BoxSet {
|
||||
DEFAULT = 0,
|
||||
MONSTER = 2,
|
||||
HERO = 4,
|
||||
MONSTER_SKILL = 8,
|
||||
HERO_SKILL = 16,
|
||||
MONSTER = 90,
|
||||
HERO = 10,
|
||||
MONSTER_SKILL = 91,
|
||||
HERO_SKILL = 11,
|
||||
BOX_WIDTH = 64,
|
||||
BOX_HEIGHT = 64
|
||||
BOX_HEIGHT = 64,
|
||||
LETF_END = -400,
|
||||
RIGHT_END = 400
|
||||
}
|
||||
@@ -4,7 +4,9 @@ import { CCComp } from "../../../../../extensions/oops-plugin-framework/assets/m
|
||||
import { smc } from "../../common/SingletonModuleComp";
|
||||
import { Role } from "../../role/Role";
|
||||
import { Niu } from "../../monster/niu/Niu";
|
||||
import { BoxSet } from "../../common/config/BoxSet";
|
||||
import { Hero } from "../../heros/Hero";
|
||||
import { Monster } from "../../monster/Monster";
|
||||
// import MapRoadUtils from "./map/road/MapRoadUtils";
|
||||
import { MapViewScene } from "./MapViewScene";
|
||||
import { Timer } from "../../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer";
|
||||
@@ -15,8 +17,7 @@ const { ccclass, property } = _decorator;
|
||||
@ecs.register('MapView', false)
|
||||
export class MapViewComp extends CCComp {
|
||||
scene: MapViewScene = null!;
|
||||
@property(Prefab)
|
||||
boss: Prefab = null!;
|
||||
|
||||
/** 是否正在转场 */
|
||||
|
||||
|
||||
@@ -55,17 +56,32 @@ export class MapViewComp extends CCComp {
|
||||
|
||||
/** 添加玩家 */
|
||||
private addHero() {
|
||||
|
||||
this.scene.node.active = true
|
||||
|
||||
|
||||
if (smc.monsters.length>0){
|
||||
let monster = ecs.getEntity<Niu>(Niu);
|
||||
monster.load(v3(360,-60),smc.monsters[0].speed);
|
||||
this.addMonster(smc.monsters[0].name,smc.monsters[0].speed)
|
||||
smc.monsters.splice(0,1)
|
||||
}
|
||||
|
||||
// if(smc.heros.length>0) {
|
||||
// this.addMonster(smc.heros[0].name,100)
|
||||
// }
|
||||
}
|
||||
|
||||
private addMonster(name:string = "niu",speed:number = 100) {
|
||||
let monster = null
|
||||
switch (name) {
|
||||
case "niu":
|
||||
monster = ecs.getEntity<Niu>(Niu);
|
||||
break;
|
||||
case "hero":
|
||||
monster = ecs.getEntity<Monster>(Monster);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
monster.load(v3(BoxSet.RIGHT_END,-60),speed);
|
||||
}
|
||||
|
||||
|
||||
private getRandomInt(min: number, max: number): number {
|
||||
min = Math.ceil(min);
|
||||
max = Math.floor(max);
|
||||
|
||||
@@ -64,7 +64,7 @@ export class MonsterViewComp extends CCComp {
|
||||
smc.monsters_in.forEach((element,index) => {
|
||||
|
||||
if(element.eid == this.ent.eid){
|
||||
console.log("index:"+index)
|
||||
// console.log("index:"+index)
|
||||
element.pos_x = this.node.position.x;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -39,7 +39,7 @@ export class Niu extends ecs.Entity {
|
||||
var node = instantiate(prefab);
|
||||
var scene = smc.map.MapView.scene;
|
||||
node.parent = scene.entityLayer!.node!;
|
||||
var as = node.getComponent(MonsterSpine);
|
||||
// var as = node.getComponent(MonsterSpine);
|
||||
node.setPosition(pos)
|
||||
|
||||
var mv = node.getComponent(NiuViewComp)!;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* @LastEditTime: 2022-08-17 12:36:18
|
||||
*/
|
||||
|
||||
import { Vec3, _decorator ,tween, v3,Collider2D,Contact2DType,PhysicsSystem2D,IPhysics2DContact} from "cc";
|
||||
import { Vec3, _decorator ,tween, v3,Collider2D,Contact2DType,PhysicsSystem2D,IPhysics2DContact,EPhysics2DDrawFlags} 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";
|
||||
@@ -23,18 +23,63 @@ export class NiuViewComp extends CCComp {
|
||||
/** 角色动画 */
|
||||
as: MonsterSpine = null!;
|
||||
speed: number = 100;
|
||||
ospeed: number = 100;
|
||||
@property
|
||||
private _ospeed: number = 100;
|
||||
@property
|
||||
set ospeed(val: number) {
|
||||
this._ospeed = val;
|
||||
}
|
||||
get ospeed() {
|
||||
return this._ospeed;
|
||||
}
|
||||
Tpos: Vec3 = v3(0,-60,0);
|
||||
timer: number = 0;
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start () {
|
||||
|
||||
// 注册单个碰撞体的回调函数
|
||||
let collider = this.getComponent(Collider2D);
|
||||
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);
|
||||
}
|
||||
}
|
||||
onBeginContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||
// 只在两个碰撞体开始接触时被调用一次
|
||||
// console.log('onBeginContact otherCollider.tag :',otherCollider,selfCollider);
|
||||
if ( otherCollider.tag == BoxSet.HERO || otherCollider.tag == BoxSet.MONSTER) {
|
||||
console.log('onBeginContact otherCollider.tag :',otherCollider,selfCollider);
|
||||
this.speed = 0;
|
||||
this.timer = 1;
|
||||
}
|
||||
}
|
||||
onEndContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||
// 只在两个碰撞体结束接触时被调用一次
|
||||
console.log('onEndContact');
|
||||
}
|
||||
// onPreSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||
// // 每次将要处理碰撞体接触逻辑时被调用
|
||||
// console.log('onPreSolve');
|
||||
// }
|
||||
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||
if (otherCollider.tag === BoxSet.HERO || otherCollider.tag === BoxSet.MONSTER) {
|
||||
// console.log('onPostSolve otherCollider.tag :'+otherCollider.tag);
|
||||
this.speed = 0;
|
||||
this.timer = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
onLoad() {
|
||||
this.as = this.getComponent(MonsterSpine);
|
||||
console.log('this.ent:',this);
|
||||
this.ospeed= this.speed;
|
||||
console.log('this.ospeed:'+this.ospeed);
|
||||
PhysicsSystem2D.instance.debugDrawFlags = EPhysics2DDrawFlags.Aabb |
|
||||
EPhysics2DDrawFlags.Pair |
|
||||
EPhysics2DDrawFlags.CenterOfMass |
|
||||
EPhysics2DDrawFlags.Joint |
|
||||
EPhysics2DDrawFlags.Shape;
|
||||
}
|
||||
|
||||
update(dt: number){
|
||||
@@ -45,10 +90,10 @@ export class NiuViewComp extends CCComp {
|
||||
this.timer = 0;
|
||||
}
|
||||
}
|
||||
if(this.node.position.x > -360){
|
||||
if(this.node.position.x > BoxSet.LETF_END){
|
||||
this.move(dt);
|
||||
}
|
||||
if(this.node.position.x < -300){
|
||||
if(this.node.position.x < BoxSet.LETF_END){
|
||||
console.log(this.node,this.ent)
|
||||
smc.monsters_in = smc.monsters_in.filter(element => element.eid !== this.ent.eid);
|
||||
this.node.destroy();
|
||||
@@ -63,7 +108,7 @@ export class NiuViewComp extends CCComp {
|
||||
smc.monsters_in.forEach((element,index) => {
|
||||
|
||||
if(element.eid == this.ent.eid){
|
||||
console.log("index:"+index)
|
||||
// console.log("index:"+index)
|
||||
element.pos_x = this.node.position.x;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user