fix:编辑器文件导入. add:example,runtime

This commit is contained in:
YipLee
2021-01-24 19:29:37 +08:00
parent c232a91a41
commit 91f4d8011b
214 changed files with 41328 additions and 120 deletions

24
examples/example3-0rc/.gitignore vendored Normal file
View File

@@ -0,0 +1,24 @@
#///////////////////////////
# Cocos Creator 3D Project
#///////////////////////////
library/
temp/
local/
build/
profiles/
#//////////////////////////
# NPM
#//////////////////////////
node_modules/
#//////////////////////////
# VSCode
#//////////////////////////
.vscode/
#//////////////////////////
# WebStorm
#//////////////////////////
.idea/

View File

@@ -0,0 +1,12 @@
{
"ver": "1.1.0",
"importer": "directory",
"imported": true,
"uuid": "f186b5cb-4924-43d1-858b-27bd5b181a26",
"files": [],
"subMetas": {},
"userData": {
"compressionType": {},
"isRemoteBundle": {}
}
}

View File

@@ -0,0 +1,12 @@
{
"ver": "1.1.0",
"importer": "directory",
"imported": true,
"uuid": "e5705606-7893-4ecf-8023-cfb3a7501b64",
"files": [],
"subMetas": {},
"userData": {
"compressionType": {},
"isRemoteBundle": {}
}
}

View File

@@ -0,0 +1 @@
{"animator":"1.0.0","mainStateMachine":{"layerPos":[-68.23754226233478,-21.050174637417967],"layerScale":1.2000000000000002,"anyStatePos":[-300,300],"subStates":["sheep_hit","sheep_idle","sheep_run"],"subStateMachines":[]},"subStateMachines":[],"defaultState":"sheep_idle","anyState":{"transitions":[{"toState":"sheep_hit","hasExitTime":false,"conditions":[{"param":"hit","value":0,"logic":0}]}]},"states":[{"position":[210,60],"upStateMachine":"BaseLayer","state":"sheep_hit","motion":"sheep_hit","speed":1,"multiplier":"","loop":false,"transitions":[{"toState":"sheep_idle","hasExitTime":true,"conditions":[]}]},{"position":[-240,60],"upStateMachine":"BaseLayer","state":"sheep_idle","motion":"sheep_idle","speed":1,"multiplier":"","loop":true,"transitions":[{"toState":"sheep_run","hasExitTime":false,"conditions":[{"param":"speed","value":0,"logic":2}]}]},{"position":[-240,-120],"upStateMachine":"BaseLayer","state":"sheep_run","motion":"sheep_run","speed":1,"multiplier":"","loop":true,"transitions":[{"toState":"sheep_idle","hasExitTime":false,"conditions":[{"param":"speed","value":0,"logic":0}]}]}],"parameters":[{"param":"speed","type":2,"init":0},{"param":"hit","type":3,"init":0}]}

View File

@@ -0,0 +1,11 @@
{
"ver": "1.0.0",
"importer": "json",
"imported": true,
"uuid": "cdbc148d-945c-4ee8-b9f2-cb0bc1fa01f4",
"files": [
".json"
],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1 @@
{"defaultState":"sheep_idle","anyState":{"transitions":[{"toState":"sheep_hit","hasExitTime":false,"conditions":[{"param":"hit","value":0,"logic":0}]}]},"states":[{"state":"sheep_hit","motion":"sheep_hit","speed":1,"multiplier":"","loop":false,"transitions":[{"toState":"sheep_idle","hasExitTime":true,"conditions":[]}]},{"state":"sheep_idle","motion":"sheep_idle","speed":1,"multiplier":"","loop":true,"transitions":[{"toState":"sheep_run","hasExitTime":false,"conditions":[{"param":"speed","value":0,"logic":2}]}]},{"state":"sheep_run","motion":"sheep_run","speed":1,"multiplier":"","loop":true,"transitions":[{"toState":"sheep_idle","hasExitTime":false,"conditions":[{"param":"speed","value":0,"logic":0}]}]}],"parameters":[{"param":"speed","type":2,"init":0},{"param":"hit","type":3,"init":0}]}

View File

@@ -0,0 +1,11 @@
{
"ver": "1.0.0",
"importer": "json",
"imported": true,
"uuid": "fb16e83f-22fc-409a-9341-aa34e16e1d22",
"files": [
".json"
],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,191 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>frames</key>
<dict>
<key>sheep_down_0.png</key>
<dict>
<key>frame</key>
<string>{{2,2},{224,87}}</string>
<key>offset</key>
<string>{0,-25}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{2,61},{224,87}}</string>
<key>sourceSize</key>
<string>{228,159}</string>
</dict>
<key>sheep_down_1.png</key>
<dict>
<key>frame</key>
<string>{{326,367},{152,103}}</string>
<key>offset</key>
<string>{-6,-8}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{32,36},{152,103}}</string>
<key>sourceSize</key>
<string>{228,159}</string>
</dict>
<key>sheep_down_2.png</key>
<dict>
<key>frame</key>
<string>{{2,335},{166,105}}</string>
<key>offset</key>
<string>{-7,-3}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{24,30},{166,105}}</string>
<key>sourceSize</key>
<string>{228,159}</string>
</dict>
<key>sheep_jump_0.png</key>
<dict>
<key>frame</key>
<string>{{326,472},{144,151}}</string>
<key>offset</key>
<string>{-10,0}</string>
<key>rotated</key>
<true/>
<key>sourceColorRect</key>
<string>{{32,4},{144,151}}</string>
<key>sourceSize</key>
<string>{228,159}</string>
</dict>
<key>sheep_jump_1.png</key>
<dict>
<key>frame</key>
<string>{{170,351},{154,131}}</string>
<key>offset</key>
<string>{-13,2}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{24,12},{154,131}}</string>
<key>sourceSize</key>
<string>{228,159}</string>
</dict>
<key>sheep_jump_2.png</key>
<dict>
<key>frame</key>
<string>{{348,260},{160,105}}</string>
<key>offset</key>
<string>{-10,4}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{24,23},{160,105}}</string>
<key>sourceSize</key>
<string>{228,159}</string>
</dict>
<key>sheep_jump_3.png</key>
<dict>
<key>frame</key>
<string>{{2,442},{152,115}}</string>
<key>offset</key>
<string>{-12,-2}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{26,24},{152,115}}</string>
<key>sourceSize</key>
<string>{228,159}</string>
</dict>
<key>sheep_jump_4.png</key>
<dict>
<key>frame</key>
<string>{{360,119},{148,139}}</string>
<key>offset</key>
<string>{-12,-2}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{28,12},{148,139}}</string>
<key>sourceSize</key>
<string>{228,159}</string>
</dict>
<key>sheep_run_0.png</key>
<dict>
<key>frame</key>
<string>{{178,236},{168,113}}</string>
<key>offset</key>
<string>{-4,0}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{26,23},{168,113}}</string>
<key>sourceSize</key>
<string>{228,159}</string>
</dict>
<key>sheep_run_1.png</key>
<dict>
<key>frame</key>
<string>{{182,119},{176,115}}</string>
<key>offset</key>
<string>{1,2}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{27,20},{176,115}}</string>
<key>sourceSize</key>
<string>{228,159}</string>
</dict>
<key>sheep_run_2.png</key>
<dict>
<key>frame</key>
<string>{{228,2},{178,115}}</string>
<key>offset</key>
<string>{1,11}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{26,11},{178,115}}</string>
<key>sourceSize</key>
<string>{228,159}</string>
</dict>
<key>sheep_run_3.png</key>
<dict>
<key>frame</key>
<string>{{2,91},{178,113}}</string>
<key>offset</key>
<string>{2,1}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{27,22},{178,113}}</string>
<key>sourceSize</key>
<string>{228,159}</string>
</dict>
<key>sheep_touch_0.png</key>
<dict>
<key>frame</key>
<string>{{2,206},{174,127}}</string>
<key>offset</key>
<string>{-5,16}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{22,0},{174,127}}</string>
<key>sourceSize</key>
<string>{228,159}</string>
</dict>
</dict>
<key>metadata</key>
<dict>
<key>format</key>
<integer>2</integer>
<key>realTextureFileName</key>
<string>sheep.png</string>
<key>size</key>
<string>{512,1024}</string>
<key>smartupdate</key>
<string>$TexturePacker:SmartUpdate:a7b82875050232ffbd24deccd7e379b7:847cb78fe45f863139518baf3831526a:13084b924613a7ef2ca9c6df3339651b$</string>
<key>textureFileName</key>
<string>sheep.png</string>
</dict>
</dict>
</plist>

View File

@@ -0,0 +1,837 @@
{
"ver": "1.0.6",
"importer": "sprite-atlas",
"imported": true,
"uuid": "efc1bbab-8753-4506-859f-0558eb86db31",
"files": [
".plist",
".json"
],
"subMetas": {
"52715": {
"importer": "sprite-frame",
"uuid": "efc1bbab-8753-4506-859f-0558eb86db31@52715",
"displayName": "",
"id": "52715",
"name": "sheep_jump_0",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": true,
"offsetX": -10,
"offsetY": 0,
"trimX": 326,
"trimY": 472,
"width": 144,
"height": 151,
"rawWidth": 228,
"rawHeight": 159,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"isUuid": true,
"imageUuidOrDatabaseUri": "83e05166-d611-452a-ac2f-4cbf5c3d5a06@6c48a",
"atlasUuid": "efc1bbab-8753-4506-859f-0558eb86db31"
},
"ver": "1.0.9",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"sheep_down_0.png": {
"ver": "1.0.4",
"uuid": "bb17971e-c86f-4b8f-ab66-84baf1704b64",
"rawTextureUuid": "83e05166-d611-452a-ac2f-4cbf5c3d5a06",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": -25,
"trimX": 2,
"trimY": 2,
"width": 224,
"height": 87,
"rawWidth": 228,
"rawHeight": 159,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"spriteType": "normal",
"subMetas": {},
"importer": "*",
"imported": false,
"files": [],
"userData": {},
"displayName": "",
"id": "",
"name": ""
},
"sheep_down_1.png": {
"ver": "1.0.4",
"uuid": "9f1c8acd-ed6c-4328-9a0d-16dc5c57b3a0",
"rawTextureUuid": "83e05166-d611-452a-ac2f-4cbf5c3d5a06",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -6,
"offsetY": -8,
"trimX": 326,
"trimY": 367,
"width": 152,
"height": 103,
"rawWidth": 228,
"rawHeight": 159,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"spriteType": "normal",
"subMetas": {},
"importer": "*",
"imported": false,
"files": [],
"userData": {},
"displayName": "",
"id": "",
"name": ""
},
"sheep_down_2.png": {
"ver": "1.0.4",
"uuid": "449c763b-2b89-4afc-89ca-e7b8d189d6e2",
"rawTextureUuid": "83e05166-d611-452a-ac2f-4cbf5c3d5a06",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -7,
"offsetY": -3,
"trimX": 2,
"trimY": 335,
"width": 166,
"height": 105,
"rawWidth": 228,
"rawHeight": 159,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"spriteType": "normal",
"subMetas": {},
"importer": "*",
"imported": false,
"files": [],
"userData": {},
"displayName": "",
"id": "",
"name": ""
},
"sheep_jump_0.png": {
"ver": "1.0.4",
"uuid": "1d89d22e-a3da-44c8-b3aa-591b40fa714d",
"rawTextureUuid": "83e05166-d611-452a-ac2f-4cbf5c3d5a06",
"trimType": "auto",
"trimThreshold": 1,
"rotated": true,
"offsetX": -10,
"offsetY": 0,
"trimX": 326,
"trimY": 472,
"width": 144,
"height": 151,
"rawWidth": 228,
"rawHeight": 159,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"spriteType": "normal",
"subMetas": {},
"importer": "*",
"imported": false,
"files": [],
"userData": {},
"displayName": "",
"id": "",
"name": ""
},
"sheep_jump_1.png": {
"ver": "1.0.4",
"uuid": "42041434-3d6c-46ed-acb7-272b5a383576",
"rawTextureUuid": "83e05166-d611-452a-ac2f-4cbf5c3d5a06",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -13,
"offsetY": 2,
"trimX": 170,
"trimY": 351,
"width": 154,
"height": 131,
"rawWidth": 228,
"rawHeight": 159,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"spriteType": "normal",
"subMetas": {},
"importer": "*",
"imported": false,
"files": [],
"userData": {},
"displayName": "",
"id": "",
"name": ""
},
"sheep_jump_2.png": {
"ver": "1.0.4",
"uuid": "6224a554-fc2b-4b9d-a2de-43fd81a31850",
"rawTextureUuid": "83e05166-d611-452a-ac2f-4cbf5c3d5a06",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -10,
"offsetY": 4,
"trimX": 348,
"trimY": 260,
"width": 160,
"height": 105,
"rawWidth": 228,
"rawHeight": 159,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"spriteType": "normal",
"subMetas": {},
"importer": "*",
"imported": false,
"files": [],
"userData": {},
"displayName": "",
"id": "",
"name": ""
},
"sheep_jump_3.png": {
"ver": "1.0.4",
"uuid": "a31dfd3f-1734-4fc2-a75e-acf961ab7b85",
"rawTextureUuid": "83e05166-d611-452a-ac2f-4cbf5c3d5a06",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -12,
"offsetY": -2,
"trimX": 2,
"trimY": 442,
"width": 152,
"height": 115,
"rawWidth": 228,
"rawHeight": 159,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"spriteType": "normal",
"subMetas": {},
"importer": "*",
"imported": false,
"files": [],
"userData": {},
"displayName": "",
"id": "",
"name": ""
},
"sheep_jump_4.png": {
"ver": "1.0.4",
"uuid": "e50f8a41-9ab5-450a-a125-2ebefa30854e",
"rawTextureUuid": "83e05166-d611-452a-ac2f-4cbf5c3d5a06",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -12,
"offsetY": -2,
"trimX": 360,
"trimY": 119,
"width": 148,
"height": 139,
"rawWidth": 228,
"rawHeight": 159,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"spriteType": "normal",
"subMetas": {},
"importer": "*",
"imported": false,
"files": [],
"userData": {},
"displayName": "",
"id": "",
"name": ""
},
"sheep_run_0.png": {
"ver": "1.0.4",
"uuid": "7ccb784f-7c51-4a0b-a59e-e95da40f3013",
"rawTextureUuid": "83e05166-d611-452a-ac2f-4cbf5c3d5a06",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -4,
"offsetY": 0,
"trimX": 178,
"trimY": 236,
"width": 168,
"height": 113,
"rawWidth": 228,
"rawHeight": 159,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"spriteType": "normal",
"subMetas": {},
"importer": "*",
"imported": false,
"files": [],
"userData": {},
"displayName": "",
"id": "",
"name": ""
},
"sheep_run_1.png": {
"ver": "1.0.4",
"uuid": "c2037678-65b3-4b0b-8b66-fee835a46f94",
"rawTextureUuid": "83e05166-d611-452a-ac2f-4cbf5c3d5a06",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 1,
"offsetY": 2,
"trimX": 182,
"trimY": 119,
"width": 176,
"height": 115,
"rawWidth": 228,
"rawHeight": 159,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"spriteType": "normal",
"subMetas": {},
"importer": "*",
"imported": false,
"files": [],
"userData": {},
"displayName": "",
"id": "",
"name": ""
},
"sheep_run_2.png": {
"ver": "1.0.4",
"uuid": "9563cb61-be04-40b0-9b0a-c721c057f21d",
"rawTextureUuid": "83e05166-d611-452a-ac2f-4cbf5c3d5a06",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 1,
"offsetY": 11,
"trimX": 228,
"trimY": 2,
"width": 178,
"height": 115,
"rawWidth": 228,
"rawHeight": 159,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"spriteType": "normal",
"subMetas": {},
"importer": "*",
"imported": false,
"files": [],
"userData": {},
"displayName": "",
"id": "",
"name": ""
},
"sheep_run_3.png": {
"ver": "1.0.4",
"uuid": "73034713-ab4b-4fba-953b-5f7d4c36320c",
"rawTextureUuid": "83e05166-d611-452a-ac2f-4cbf5c3d5a06",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 2,
"offsetY": 1,
"trimX": 2,
"trimY": 91,
"width": 178,
"height": 113,
"rawWidth": 228,
"rawHeight": 159,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"spriteType": "normal",
"subMetas": {},
"importer": "*",
"imported": false,
"files": [],
"userData": {},
"displayName": "",
"id": "",
"name": ""
},
"sheep_touch_0.png": {
"ver": "1.0.4",
"uuid": "8026fa0b-21e9-4784-8044-cd7ac2819df6",
"rawTextureUuid": "83e05166-d611-452a-ac2f-4cbf5c3d5a06",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -5,
"offsetY": 16,
"trimX": 2,
"trimY": 206,
"width": 174,
"height": 127,
"rawWidth": 228,
"rawHeight": 159,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"spriteType": "normal",
"subMetas": {},
"importer": "*",
"imported": false,
"files": [],
"userData": {},
"displayName": "",
"id": "",
"name": ""
},
"7cc6b": {
"importer": "sprite-frame",
"uuid": "efc1bbab-8753-4506-859f-0558eb86db31@7cc6b",
"displayName": "",
"id": "7cc6b",
"name": "sheep_down_0",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": -25,
"trimX": 2,
"trimY": 2,
"width": 224,
"height": 87,
"rawWidth": 228,
"rawHeight": 159,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"isUuid": true,
"imageUuidOrDatabaseUri": "83e05166-d611-452a-ac2f-4cbf5c3d5a06@6c48a",
"atlasUuid": "efc1bbab-8753-4506-859f-0558eb86db31"
},
"ver": "1.0.9",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"d1ecf": {
"importer": "sprite-frame",
"uuid": "efc1bbab-8753-4506-859f-0558eb86db31@d1ecf",
"displayName": "",
"id": "d1ecf",
"name": "sheep_down_1",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -6,
"offsetY": -8,
"trimX": 326,
"trimY": 367,
"width": 152,
"height": 103,
"rawWidth": 228,
"rawHeight": 159,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"isUuid": true,
"imageUuidOrDatabaseUri": "83e05166-d611-452a-ac2f-4cbf5c3d5a06@6c48a",
"atlasUuid": "efc1bbab-8753-4506-859f-0558eb86db31"
},
"ver": "1.0.9",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"acab0": {
"importer": "sprite-frame",
"uuid": "efc1bbab-8753-4506-859f-0558eb86db31@acab0",
"displayName": "",
"id": "acab0",
"name": "sheep_down_2",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -7,
"offsetY": -3,
"trimX": 2,
"trimY": 335,
"width": 166,
"height": 105,
"rawWidth": 228,
"rawHeight": 159,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"isUuid": true,
"imageUuidOrDatabaseUri": "83e05166-d611-452a-ac2f-4cbf5c3d5a06@6c48a",
"atlasUuid": "efc1bbab-8753-4506-859f-0558eb86db31"
},
"ver": "1.0.9",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"6982f": {
"importer": "sprite-frame",
"uuid": "efc1bbab-8753-4506-859f-0558eb86db31@6982f",
"displayName": "",
"id": "6982f",
"name": "sheep_jump_1",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -13,
"offsetY": 2,
"trimX": 170,
"trimY": 351,
"width": 154,
"height": 131,
"rawWidth": 228,
"rawHeight": 159,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"isUuid": true,
"imageUuidOrDatabaseUri": "83e05166-d611-452a-ac2f-4cbf5c3d5a06@6c48a",
"atlasUuid": "efc1bbab-8753-4506-859f-0558eb86db31"
},
"ver": "1.0.9",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"d19ec": {
"importer": "sprite-frame",
"uuid": "efc1bbab-8753-4506-859f-0558eb86db31@d19ec",
"displayName": "",
"id": "d19ec",
"name": "sheep_jump_2",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -10,
"offsetY": 4,
"trimX": 348,
"trimY": 260,
"width": 160,
"height": 105,
"rawWidth": 228,
"rawHeight": 159,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"isUuid": true,
"imageUuidOrDatabaseUri": "83e05166-d611-452a-ac2f-4cbf5c3d5a06@6c48a",
"atlasUuid": "efc1bbab-8753-4506-859f-0558eb86db31"
},
"ver": "1.0.9",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"123b8": {
"importer": "sprite-frame",
"uuid": "efc1bbab-8753-4506-859f-0558eb86db31@123b8",
"displayName": "",
"id": "123b8",
"name": "sheep_jump_3",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -12,
"offsetY": -2,
"trimX": 2,
"trimY": 442,
"width": 152,
"height": 115,
"rawWidth": 228,
"rawHeight": 159,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"isUuid": true,
"imageUuidOrDatabaseUri": "83e05166-d611-452a-ac2f-4cbf5c3d5a06@6c48a",
"atlasUuid": "efc1bbab-8753-4506-859f-0558eb86db31"
},
"ver": "1.0.9",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"2f938": {
"importer": "sprite-frame",
"uuid": "efc1bbab-8753-4506-859f-0558eb86db31@2f938",
"displayName": "",
"id": "2f938",
"name": "sheep_jump_4",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -12,
"offsetY": -2,
"trimX": 360,
"trimY": 119,
"width": 148,
"height": 139,
"rawWidth": 228,
"rawHeight": 159,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"isUuid": true,
"imageUuidOrDatabaseUri": "83e05166-d611-452a-ac2f-4cbf5c3d5a06@6c48a",
"atlasUuid": "efc1bbab-8753-4506-859f-0558eb86db31"
},
"ver": "1.0.9",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"e0c75": {
"importer": "sprite-frame",
"uuid": "efc1bbab-8753-4506-859f-0558eb86db31@e0c75",
"displayName": "",
"id": "e0c75",
"name": "sheep_run_0",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -4,
"offsetY": 0,
"trimX": 178,
"trimY": 236,
"width": 168,
"height": 113,
"rawWidth": 228,
"rawHeight": 159,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"isUuid": true,
"imageUuidOrDatabaseUri": "83e05166-d611-452a-ac2f-4cbf5c3d5a06@6c48a",
"atlasUuid": "efc1bbab-8753-4506-859f-0558eb86db31"
},
"ver": "1.0.9",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"a8883": {
"importer": "sprite-frame",
"uuid": "efc1bbab-8753-4506-859f-0558eb86db31@a8883",
"displayName": "",
"id": "a8883",
"name": "sheep_run_1",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 1,
"offsetY": 2,
"trimX": 182,
"trimY": 119,
"width": 176,
"height": 115,
"rawWidth": 228,
"rawHeight": 159,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"isUuid": true,
"imageUuidOrDatabaseUri": "83e05166-d611-452a-ac2f-4cbf5c3d5a06@6c48a",
"atlasUuid": "efc1bbab-8753-4506-859f-0558eb86db31"
},
"ver": "1.0.9",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"6a8f4": {
"importer": "sprite-frame",
"uuid": "efc1bbab-8753-4506-859f-0558eb86db31@6a8f4",
"displayName": "",
"id": "6a8f4",
"name": "sheep_run_2",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 1,
"offsetY": 11,
"trimX": 228,
"trimY": 2,
"width": 178,
"height": 115,
"rawWidth": 228,
"rawHeight": 159,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"isUuid": true,
"imageUuidOrDatabaseUri": "83e05166-d611-452a-ac2f-4cbf5c3d5a06@6c48a",
"atlasUuid": "efc1bbab-8753-4506-859f-0558eb86db31"
},
"ver": "1.0.9",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"07ea9": {
"importer": "sprite-frame",
"uuid": "efc1bbab-8753-4506-859f-0558eb86db31@07ea9",
"displayName": "",
"id": "07ea9",
"name": "sheep_run_3",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 2,
"offsetY": 1,
"trimX": 2,
"trimY": 91,
"width": 178,
"height": 113,
"rawWidth": 228,
"rawHeight": 159,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"isUuid": true,
"imageUuidOrDatabaseUri": "83e05166-d611-452a-ac2f-4cbf5c3d5a06@6c48a",
"atlasUuid": "efc1bbab-8753-4506-859f-0558eb86db31"
},
"ver": "1.0.9",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"c6353": {
"importer": "sprite-frame",
"uuid": "efc1bbab-8753-4506-859f-0558eb86db31@c6353",
"displayName": "",
"id": "c6353",
"name": "sheep_touch_0",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -5,
"offsetY": 16,
"trimX": 2,
"trimY": 206,
"width": 174,
"height": 127,
"rawWidth": 228,
"rawHeight": 159,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"isUuid": true,
"imageUuidOrDatabaseUri": "83e05166-d611-452a-ac2f-4cbf5c3d5a06@6c48a",
"atlasUuid": "efc1bbab-8753-4506-859f-0558eb86db31"
},
"ver": "1.0.9",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"atlasTextureName": "sheep.png",
"format": 2,
"uuid": "efc1bbab-8753-4506-859f-0558eb86db31",
"textureUuid": "83e05166-d611-452a-ac2f-4cbf5c3d5a06@6c48a"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 KiB

View File

@@ -0,0 +1,68 @@
{
"ver": "1.0.21",
"importer": "image",
"imported": true,
"uuid": "83e05166-d611-452a-ac2f-4cbf5c3d5a06",
"files": [
".png",
".json"
],
"subMetas": {
"sheep": {
"ver": "1.0.4",
"uuid": "aaf71854-d55f-43e8-92aa-ec6c71177195",
"rawTextureUuid": "83e05166-d611-452a-ac2f-4cbf5c3d5a06",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -1,
"offsetY": 203,
"trimX": 2,
"trimY": 2,
"width": 506,
"height": 614,
"rawWidth": 512,
"rawHeight": 1024,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {},
"importer": "*",
"imported": false,
"files": [],
"userData": {},
"displayName": "",
"id": "",
"name": ""
},
"6c48a": {
"importer": "texture",
"uuid": "83e05166-d611-452a-ac2f-4cbf5c3d5a06@6c48a",
"displayName": "sheep",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "repeat",
"wrapModeT": "repeat",
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 1,
"isUuid": true,
"imageUuidOrDatabaseUri": "83e05166-d611-452a-ac2f-4cbf5c3d5a06"
},
"ver": "1.0.20",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"hasAlpha": true,
"type": "texture",
"redirect": "83e05166-d611-452a-ac2f-4cbf5c3d5a06@6c48a"
}
}

View File

@@ -0,0 +1,56 @@
[
{
"__type__": "cc.AnimationClip",
"_name": "sheep_hit",
"_objFlags": 0,
"_native": "",
"sample": 60,
"speed": 1,
"wrapMode": 1,
"events": [],
"_duration": 0.5166666666666667,
"_keys": [
[
0,
0.16666666666666666,
0.3333333333333333,
0.5
]
],
"_stepness": 0,
"_curves": [
{
"modifiers": [
{
"__id__": 1
},
"spriteFrame"
],
"data": {
"keys": 0,
"values": [
{
"__uuid__": "efc1bbab-8753-4506-859f-0558eb86db31@c6353"
},
{
"__uuid__": "efc1bbab-8753-4506-859f-0558eb86db31@7cc6b"
},
{
"__uuid__": "efc1bbab-8753-4506-859f-0558eb86db31@d1ecf"
},
{
"__uuid__": "efc1bbab-8753-4506-859f-0558eb86db31@acab0"
}
],
"easingMethods": {}
}
}
],
"_commonTargets": [],
"_hash": 0
},
{
"__type__": "cc.animation.ComponentPath",
"component": "cc.Sprite"
}
]

View File

@@ -0,0 +1,13 @@
{
"ver": "1.0.11",
"importer": "animation-clip",
"imported": true,
"uuid": "050adbf6-bd66-4a26-ac79-d68c00ad7812",
"files": [
".json"
],
"subMetas": {},
"userData": {
"name": "sheep_hit"
}
}

View File

@@ -0,0 +1,44 @@
[
{
"__type__": "cc.AnimationClip",
"_name": "sheep_idle",
"_objFlags": 0,
"_native": "",
"sample": 60,
"speed": 1,
"wrapMode": 0,
"events": [],
"_duration": 0.016666666666666666,
"_keys": [
[
0
]
],
"_stepness": 0,
"_curves": [
{
"modifiers": [
{
"__id__": 1
},
"spriteFrame"
],
"data": {
"keys": 0,
"values": [
{
"__uuid__": "efc1bbab-8753-4506-859f-0558eb86db31@acab0"
}
],
"easingMethods": {}
}
}
],
"_commonTargets": [],
"_hash": 1037761290
},
{
"__type__": "cc.animation.ComponentPath",
"component": "cc.Sprite"
}
]

View File

@@ -0,0 +1,13 @@
{
"ver": "1.0.11",
"importer": "animation-clip",
"imported": true,
"uuid": "2532e8aa-d1bb-4a86-a212-5ca6868dec37",
"files": [
".json"
],
"subMetas": {},
"userData": {
"name": "sheep_idle"
}
}

View File

@@ -0,0 +1,56 @@
[
{
"__type__": "cc.AnimationClip",
"_name": "sheep_run",
"_objFlags": 0,
"_native": "",
"sample": 60,
"speed": 1,
"wrapMode": 0,
"events": [],
"_duration": 0.26666666666666666,
"_keys": [
[
0,
0.08333333333333333,
0.16666666666666666,
0.25
]
],
"_stepness": 0,
"_curves": [
{
"modifiers": [
{
"__id__": 1
},
"spriteFrame"
],
"data": {
"keys": 0,
"values": [
{
"__uuid__": "efc1bbab-8753-4506-859f-0558eb86db31@e0c75"
},
{
"__uuid__": "efc1bbab-8753-4506-859f-0558eb86db31@6a8f4"
},
{
"__uuid__": "efc1bbab-8753-4506-859f-0558eb86db31@07ea9"
},
{
"__uuid__": "efc1bbab-8753-4506-859f-0558eb86db31@e0c75"
}
],
"easingMethods": {}
}
}
],
"_commonTargets": [],
"_hash": 1187270062
},
{
"__type__": "cc.animation.ComponentPath",
"component": "cc.Sprite"
}
]

View File

@@ -0,0 +1,13 @@
{
"ver": "1.0.11",
"importer": "animation-clip",
"imported": true,
"uuid": "b2f09761-f403-4e08-82a9-add2525c236f",
"files": [
".json"
],
"subMetas": {},
"userData": {
"name": "sheep_run"
}
}

View File

@@ -0,0 +1,12 @@
{
"ver": "1.1.0",
"importer": "directory",
"imported": true,
"uuid": "580aa3d9-472c-4db2-b779-7206e076d12d",
"files": [],
"subMetas": {},
"userData": {
"compressionType": {},
"isRemoteBundle": {}
}
}

View File

@@ -0,0 +1 @@
{"animator":"1.0.0","mainStateMachine":{"layerPos":[0,0],"layerScale":1,"anyStatePos":[-300,300],"subStates":["anim1","anim2","anim3","anim4"],"subStateMachines":[]},"subStateMachines":[],"defaultState":"anim1","anyState":{"transitions":[]},"states":[{"position":[-300,120],"upStateMachine":"BaseLayer","state":"anim1","motion":"anim1","speed":1,"multiplier":"","loop":false,"transitions":[{"toState":"anim2","hasExitTime":true,"conditions":[]}]},{"position":[90,120],"upStateMachine":"BaseLayer","state":"anim2","motion":"anim2","speed":1,"multiplier":"","loop":false,"transitions":[{"toState":"anim4","hasExitTime":true,"conditions":[]}]},{"position":[-300,-60],"upStateMachine":"BaseLayer","state":"anim3","motion":"anim3","speed":1,"multiplier":"","loop":false,"transitions":[{"toState":"anim1","hasExitTime":true,"conditions":[]}]},{"position":[90,-60],"upStateMachine":"BaseLayer","state":"anim4","motion":"anim4","speed":1,"multiplier":"","loop":false,"transitions":[{"toState":"anim3","hasExitTime":true,"conditions":[]}]}],"parameters":[]}

View File

@@ -0,0 +1,11 @@
{
"ver": "1.0.0",
"importer": "json",
"imported": true,
"uuid": "aeb6fafb-e37c-49de-8f1e-d7facfe4f1fc",
"files": [
".json"
],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1 @@
{"defaultState":"anim1","anyState":{"transitions":[]},"states":[{"state":"anim1","motion":"anim1","speed":1,"multiplier":"","loop":false,"transitions":[{"toState":"anim2","hasExitTime":true,"conditions":[]}]},{"state":"anim2","motion":"anim2","speed":1,"multiplier":"","loop":false,"transitions":[{"toState":"anim4","hasExitTime":true,"conditions":[]}]},{"state":"anim3","motion":"anim3","speed":1,"multiplier":"","loop":false,"transitions":[{"toState":"anim1","hasExitTime":true,"conditions":[]}]},{"state":"anim4","motion":"anim4","speed":1,"multiplier":"","loop":false,"transitions":[{"toState":"anim3","hasExitTime":true,"conditions":[]}]}],"parameters":[]}

View File

@@ -0,0 +1,11 @@
{
"ver": "1.0.0",
"importer": "json",
"imported": true,
"uuid": "fb7c34bc-ae0f-47af-9853-399b4b2929b9",
"files": [
".json"
],
"subMetas": {},
"userData": {}
}

Binary file not shown.

View File

@@ -0,0 +1,517 @@
{
"ver": "2.0.10",
"importer": "fbx",
"imported": true,
"uuid": "d3ea15fb-3c29-4d96-8c92-56627ef06f12",
"files": [],
"subMetas": {
"30732": {
"importer": "gltf-skeleton",
"uuid": "d3ea15fb-3c29-4d96-8c92-56627ef06f12@30732",
"displayName": "",
"id": "30732",
"name": "UnnamedSkeleton-0.skeleton",
"userData": {
"gltfIndex": 0,
"jointsLength": 52
},
"ver": "1.0.1",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"buffer.bin": {
"ver": "1.0.0",
"uuid": "15870405-71d0-4e48-9b17-fdb0d7f24a64",
"subMetas": {},
"importer": "*",
"imported": false,
"files": [],
"userData": {},
"displayName": "",
"id": "",
"name": ""
},
"Beta_Joints.mesh": {
"ver": "1.0.1",
"uuid": "1fac28de-5b91-4e21-95dc-37c99b0b7ad4",
"verts": 12473,
"tris": 20840,
"submeshes": 1,
"minPos": {
"x": -0.883466839790344,
"y": -0.00323115638457239,
"z": -0.124687545001507
},
"maxPos": {
"x": 0.883466958999634,
"y": 1.59360826015472,
"z": 0.130236849188805
},
"subMetas": {},
"importer": "*",
"imported": false,
"files": [],
"userData": {},
"displayName": "",
"id": "",
"name": ""
},
"Beta_Surface.mesh": {
"ver": "1.0.1",
"uuid": "0a792e25-1cf8-45f8-9370-b7e8a38ae04a",
"verts": 15901,
"tris": 28272,
"submeshes": 1,
"minPos": {
"x": -0.902565956115723,
"y": -0.00320193218067288,
"z": -0.14373941719532
},
"maxPos": {
"x": 0.902566075325012,
"y": 1.80604910850525,
"z": 0.176958158612251
},
"subMetas": {},
"importer": "*",
"imported": false,
"files": [],
"userData": {},
"displayName": "",
"id": "",
"name": ""
},
"model-0.skeleton": {
"ver": "1.0.1",
"uuid": "26737cab-42a5-49dc-845d-21ebb1d739e4",
"subMetas": {},
"importer": "*",
"imported": false,
"files": [],
"userData": {},
"displayName": "",
"id": "",
"name": ""
},
"model-1.skeleton": {
"ver": "1.0.1",
"uuid": "679183cc-35dc-4ace-b1fa-8d6a5906cde2",
"subMetas": {},
"importer": "*",
"imported": false,
"files": [],
"userData": {},
"displayName": "",
"id": "",
"name": ""
},
"model.prefab": {
"ver": "1.2.5",
"uuid": "42f8b881-07dc-4988-ad55-511a4d27d009",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": true,
"content": [
{
"__type__": "cc.Prefab",
"_name": "",
"_objFlags": 0,
"data": {
"__id__": 1
}
},
{
"__type__": "cc.Node",
"_name": "Sprite",
"_objFlags": 0,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_cascadeOpacityEnabled": true,
"_parent": null,
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_contentSize": {
"__type__": "cc.Size",
"width": 40,
"height": 36
},
"_children": [],
"_skewX": 0,
"_skewY": 0,
"_localZOrder": 0,
"_globalZOrder": 0,
"_tag": -1,
"_opacityModifyRGB": false,
"_reorderChildDirty": false,
"_id": "",
"_active": true,
"_components": [
{
"__id__": 2
}
],
"_prefab": {
"__id__": 3
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
0,
1,
1,
1
]
}
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_spriteFrame": {
"__uuid__": "8cdb44ac-a3f6-449f-b354-7cd48cf84061"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_atlas": null
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": null,
"fileId": "d7118yAG5lKybkFOAh8koPL"
}
],
"subMetas": {},
"importer": "*",
"imported": false,
"files": [],
"userData": {},
"displayName": "",
"id": "",
"name": ""
},
"01512": {
"importer": "gltf-mesh",
"uuid": "d3ea15fb-3c29-4d96-8c92-56627ef06f12@01512",
"displayName": "",
"id": "01512",
"name": "Beta_Joints.mesh",
"userData": {
"gltfIndex": 0
},
"ver": "1.1.0",
"imported": true,
"files": [
".bin",
".json"
],
"subMetas": {}
},
"eca75": {
"importer": "gltf-mesh",
"uuid": "d3ea15fb-3c29-4d96-8c92-56627ef06f12@eca75",
"displayName": "",
"id": "eca75",
"name": "Beta_Surface.mesh",
"userData": {
"gltfIndex": 1
},
"ver": "1.1.0",
"imported": true,
"files": [
".bin",
".json"
],
"subMetas": {}
},
"18d6f": {
"importer": "gltf-animation",
"uuid": "d3ea15fb-3c29-4d96-8c92-56627ef06f12@18d6f",
"displayName": "",
"id": "18d6f",
"name": "mixamo.com.animation",
"userData": {
"gltfIndex": 0,
"wrapMode": 2,
"sample": 30,
"span": {
"from": 0,
"to": 15.75
},
"events": []
},
"ver": "1.0.14",
"imported": true,
"files": [
".bin",
".json"
],
"subMetas": {}
},
"05949": {
"importer": "gltf-animation",
"uuid": "d3ea15fb-3c29-4d96-8c92-56627ef06f12@05949",
"displayName": "",
"id": "05949",
"name": "anim1.animation",
"userData": {
"gltfIndex": 0,
"wrapMode": 2,
"sample": 30,
"span": {
"from": 0,
"to": 3.52
},
"events": []
},
"ver": "1.0.14",
"imported": true,
"files": [
".bin",
".json"
],
"subMetas": {}
},
"6d3e9": {
"importer": "gltf-animation",
"uuid": "d3ea15fb-3c29-4d96-8c92-56627ef06f12@6d3e9",
"displayName": "",
"id": "6d3e9",
"name": "anim2.animation",
"userData": {
"gltfIndex": 0,
"wrapMode": 2,
"sample": 30,
"span": {
"from": 3.66,
"to": 6.77
},
"events": []
},
"ver": "1.0.14",
"imported": true,
"files": [
".bin",
".json"
],
"subMetas": {}
},
"041bf": {
"importer": "gltf-animation",
"uuid": "d3ea15fb-3c29-4d96-8c92-56627ef06f12@041bf",
"displayName": "",
"id": "041bf",
"name": "anim3.animation",
"userData": {
"gltfIndex": 0,
"wrapMode": 2,
"sample": 30,
"span": {
"from": 7.05,
"to": 10.29
},
"events": []
},
"ver": "1.0.14",
"imported": true,
"files": [
".bin",
".json"
],
"subMetas": {}
},
"0b197": {
"importer": "gltf-animation",
"uuid": "d3ea15fb-3c29-4d96-8c92-56627ef06f12@0b197",
"displayName": "",
"id": "0b197",
"name": "anim4.animation",
"userData": {
"gltfIndex": 0,
"wrapMode": 2,
"sample": 30,
"span": {
"from": 10.64,
"to": 15.75
},
"events": []
},
"ver": "1.0.14",
"imported": true,
"files": [
".bin",
".json"
],
"subMetas": {}
},
"f1394": {
"importer": "gltf-skeleton",
"uuid": "d3ea15fb-3c29-4d96-8c92-56627ef06f12@f1394",
"displayName": "",
"id": "f1394",
"name": "UnnamedSkeleton-1.skeleton",
"userData": {
"gltfIndex": 1,
"jointsLength": 52
},
"ver": "1.0.1",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"0f0f9": {
"importer": "gltf-material",
"uuid": "d3ea15fb-3c29-4d96-8c92-56627ef06f12@0f0f9",
"displayName": "",
"id": "0f0f9",
"name": "Beta_Joints_MAT.material",
"userData": {
"gltfIndex": 0
},
"ver": "1.0.14",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"124e8": {
"importer": "gltf-material",
"uuid": "d3ea15fb-3c29-4d96-8c92-56627ef06f12@124e8",
"displayName": "",
"id": "124e8",
"name": "asdf1:Beta_HighLimbsGeoSG2.material",
"userData": {
"gltfIndex": 1
},
"ver": "1.0.14",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"0551c": {
"importer": "gltf-scene",
"uuid": "d3ea15fb-3c29-4d96-8c92-56627ef06f12@0551c",
"displayName": "",
"id": "0551c",
"name": "model.prefab",
"userData": {
"gltfIndex": 0
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"imageMetas": [],
"legacyFbxImporter": false,
"animationImportSettings": [
{
"name": "mixamo.com",
"duration": 15.75,
"fps": 30,
"splits": [
{
"name": "mixamo.com",
"from": 0,
"to": 15.75,
"wrapMode": 2
},
{
"name": "anim1",
"from": 0,
"to": 3.52,
"wrapMode": 2
},
{
"name": "anim2",
"from": 3.66,
"to": 6.77,
"wrapMode": 2
},
{
"name": "anim3",
"from": 7.05,
"to": 10.29,
"wrapMode": 2
},
{
"name": "anim4",
"from": 10.64,
"to": 15.75,
"wrapMode": 2
}
]
}
],
"redirect": "d3ea15fb-3c29-4d96-8c92-56627ef06f12@0551c",
"assetFinder": {
"meshes": [
"d3ea15fb-3c29-4d96-8c92-56627ef06f12@01512",
"d3ea15fb-3c29-4d96-8c92-56627ef06f12@eca75"
],
"skeletons": [
"d3ea15fb-3c29-4d96-8c92-56627ef06f12@30732",
"d3ea15fb-3c29-4d96-8c92-56627ef06f12@f1394"
],
"textures": [],
"materials": [
"d3ea15fb-3c29-4d96-8c92-56627ef06f12@0f0f9",
"d3ea15fb-3c29-4d96-8c92-56627ef06f12@124e8"
],
"scenes": [
"d3ea15fb-3c29-4d96-8c92-56627ef06f12@0551c"
]
}
}
}

View File

@@ -0,0 +1,12 @@
{
"ver": "1.1.0",
"importer": "directory",
"imported": true,
"uuid": "55c5f38e-bf5b-4bbd-a41c-6e78f715fb49",
"files": [],
"subMetas": {},
"userData": {
"compressionType": {},
"isRemoteBundle": {}
}
}

View File

@@ -0,0 +1,808 @@
[
{
"__type__": "cc.SceneAsset",
"_name": "",
"_objFlags": 0,
"_native": "",
"scene": {
"__id__": 1
},
"asyncLoadAssets": false
},
{
"__type__": "cc.Scene",
"_name": "",
"_objFlags": 0,
"_parent": null,
"_children": [
{
"__id__": 2
},
{
"__id__": 5
},
{
"__id__": 7
}
],
"_active": true,
"_components": [],
"_prefab": null,
"autoReleaseAssets": false,
"_globals": {
"__id__": 29
},
"_id": "280a8ada-9441-4f16-a80a-ff222160dbb4"
},
{
"__type__": "cc.Node",
"_name": "Main Light",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 3
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": -0.24999999999999997,
"y": -0.24999999999999997,
"z": -0.06698729810778066,
"w": 0.9330127018922194
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": -30,
"y": -30,
"z": 0
},
"_id": "c0y6F5f+pAvI805TdmxIjx"
},
{
"__type__": "cc.DirectionalLight",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": null,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_useColorTemperature": false,
"_colorTemperature": 6550,
"_staticSettings": {
"__id__": 4
},
"_illuminance": 65000,
"_id": "597uMYCbhEtJQc0ffJlcgA"
},
{
"__type__": "cc.StaticLightSettings",
"_baked": false,
"_editorOnly": false,
"_bakeable": false,
"_castShadow": false
},
{
"__type__": "cc.Node",
"_name": "Main Camera",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 6
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": -10,
"y": 10,
"z": 10
},
"_lrot": {
"__type__": "cc.Quat",
"x": -0.27781593346944056,
"y": -0.36497167621709875,
"z": -0.11507512748638377,
"w": 0.8811195706053617
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": -35,
"y": -45,
"z": 0
},
"_id": "c9DMICJLFO5IeO07EPon7U"
},
{
"__type__": "cc.Camera",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
},
"_enabled": true,
"__prefab": null,
"_projection": 1,
"_priority": 0,
"_fov": 45,
"_fovAxis": 0,
"_orthoHeight": 10,
"_near": 1,
"_far": 1000,
"_color": {
"__type__": "cc.Color",
"r": 51,
"g": 51,
"b": 51,
"a": 255
},
"_depth": 1,
"_stencil": 0,
"_clearFlags": 7,
"_rect": {
"__type__": "cc.Rect",
"x": 0,
"y": 0,
"width": 1,
"height": 1
},
"_aperture": 19,
"_shutter": 7,
"_iso": 0,
"_screenScale": 1,
"_visibility": 1822425087,
"_targetTexture": null,
"_id": "7dWQTpwS5LrIHnc1zAPUtf"
},
{
"__type__": "cc.Node",
"_name": "Canvas",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 8
},
{
"__id__": 10
},
{
"__id__": 18
}
],
"_active": true,
"_components": [
{
"__id__": 23
},
{
"__id__": 25
},
{
"__id__": 27
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 540,
"y": 360,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "e49rLL88tO8JHkOKHtSB0h"
},
{
"__type__": "cc.Node",
"_name": "Camera",
"_objFlags": 0,
"_parent": {
"__id__": 7
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 9
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 1000
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "1fqFhmIbtDhI3IhgadV8gI"
},
{
"__type__": "cc.Camera",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
},
"_enabled": true,
"__prefab": null,
"_projection": 0,
"_priority": 1073741824,
"_fov": 45,
"_fovAxis": 0,
"_orthoHeight": 360,
"_near": 1,
"_far": 2000,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_depth": 1,
"_stencil": 0,
"_clearFlags": 6,
"_rect": {
"__type__": "cc.Rect",
"x": 0,
"y": 0,
"width": 1,
"height": 1
},
"_aperture": 19,
"_shutter": 7,
"_iso": 0,
"_screenScale": 1,
"_visibility": 41943040,
"_targetTexture": null,
"_id": "6fZAAkTr1OyoeaDQvtP6oL"
},
{
"__type__": "cc.Node",
"_name": "sheep",
"_objFlags": 0,
"_parent": {
"__id__": 7
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 11
},
{
"__id__": 13
},
{
"__id__": 15
},
{
"__id__": 16
},
{
"__id__": 17
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 2,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "29EsqeRvFB4LpiriyyyAVn"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 10
},
"_enabled": true,
"__prefab": {
"__id__": 12
},
"_priority": 0,
"_contentSize": {
"__type__": "cc.Size",
"width": 166,
"height": 105
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "070UePYTVEQrGBEB8Q2SKz"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "f7NISe7HdAD68SLfhnddy8"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 10
},
"_enabled": true,
"__prefab": {
"__id__": 14
},
"_visFlags": 0,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "efc1bbab-8753-4506-859f-0558eb86db31@acab0"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": "a7UPilt4hHYLBu7K4Pxv09"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "e71ctEmpxFC4KlSYRZNz/a"
},
{
"__type__": "cc.Animation",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 10
},
"_enabled": true,
"__prefab": null,
"playOnLoad": false,
"_clips": [
{
"__uuid__": "2532e8aa-d1bb-4a86-a212-5ca6868dec37"
},
{
"__uuid__": "050adbf6-bd66-4a26-ac79-d68c00ad7812"
},
{
"__uuid__": "b2f09761-f403-4e08-82a9-add2525c236f"
}
],
"_defaultClip": null,
"_id": "f9KSGKg3FI+Z4b9fQ2FM6r"
},
{
"__type__": "616e8FAn2NOvbq4WacGHJvP",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 10
},
"_enabled": true,
"__prefab": null,
"AssetRawUrl": {
"__uuid__": "fb16e83f-22fc-409a-9341-aa34e16e1d22"
},
"PlayOnStart": true,
"AutoUpdate": true,
"_id": "35V03aZdVP/Ztj64NUKCiu"
},
{
"__type__": "af622tAzIFD7pL0aRQWXdrq",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 10
},
"_enabled": true,
"__prefab": null,
"_id": "c6Tik1l4ZLxaVUpFk90avd"
},
{
"__type__": "cc.Node",
"_name": "info",
"_objFlags": 0,
"_parent": {
"__id__": 7
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 19
},
{
"__id__": 21
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 155.25,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "84OEJgOlVLZZFT3sGoW4UO"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 18
},
"_enabled": true,
"__prefab": {
"__id__": 20
},
"_priority": 0,
"_contentSize": {
"__type__": "cc.Size",
"width": 241.8,
"height": 90.4
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "c3gdwlwaZBvbA/8RoMsw7T"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "c68UOAlNhN171Umca6yVvF"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 18
},
"_enabled": true,
"__prefab": {
"__id__": 22
},
"_visFlags": 0,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_string": "按左右键移动\n按k键播放hit动画",
"_horizontalAlign": 0,
"_verticalAlign": 1,
"_actualFontSize": 32,
"_fontSize": 32,
"_fontFamily": "Arial",
"_lineHeight": 40,
"_overflow": 0,
"_enableWrapText": true,
"_font": null,
"_isSystemFontUsed": true,
"_isItalic": false,
"_isBold": false,
"_isUnderline": false,
"_underlineHeight": 2,
"_cacheMode": 0,
"_id": "59nIfOQFtPEYZkZcyPLwd5"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "2frm37uaJHQr0AEEaYyM82"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
},
"_enabled": true,
"__prefab": {
"__id__": 24
},
"_priority": 0,
"_contentSize": {
"__type__": "cc.Size",
"width": 1080,
"height": 720
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "9ewmSQBHBHKJSILVlgywnZ"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "0dngp/9gNO34wUQjZfN/CX"
},
{
"__type__": "cc.Canvas",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
},
"_enabled": true,
"__prefab": {
"__id__": 26
},
"_cameraComponent": {
"__id__": 9
},
"_alignCanvasWithScreen": true,
"_id": "4cOOu+YU9EPabhmqlCllJq"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "3f2oTdCepERZdpmIfLsrhd"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
},
"_enabled": true,
"__prefab": {
"__id__": 28
},
"_alignFlags": 45,
"_target": null,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_alignMode": 2,
"_lockFlags": 0,
"_id": "eawAk9tc1HL649C4eJxFyc"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "e8a+bU/8dPDbbJguUzLdoF"
},
{
"__type__": "cc.SceneGlobals",
"ambient": {
"__id__": 30
},
"shadows": {
"__id__": 31
},
"_skybox": {
"__id__": 32
},
"fog": {
"__id__": 33
}
},
{
"__type__": "cc.AmbientInfo",
"_skyColor": {
"__type__": "cc.Color",
"r": 51,
"g": 128,
"b": 204,
"a": 1
},
"_skyIllum": 20000,
"_groundAlbedo": {
"__type__": "cc.Color",
"r": 51,
"g": 51,
"b": 51,
"a": 255
}
},
{
"__type__": "cc.ShadowsInfo",
"_type": 0,
"_enabled": false,
"_normal": {
"__type__": "cc.Vec3",
"x": 0,
"y": 1,
"z": 0
},
"_distance": 0,
"_shadowColor": {
"__type__": "cc.Color",
"r": 76,
"g": 76,
"b": 76,
"a": 255
},
"_autoAdapt": true,
"_pcf": 0,
"_bias": 0.00001,
"_near": 1,
"_far": 30,
"_aspect": 1,
"_orthoSize": 5,
"_maxReceived": 4,
"_size": {
"__type__": "cc.Vec2",
"x": 512,
"y": 512
}
},
{
"__type__": "cc.SkyboxInfo",
"_envmap": null,
"_isRGBE": false,
"_enabled": false,
"_useIBL": false
},
{
"__type__": "cc.FogInfo",
"_type": 0,
"_fogColor": {
"__type__": "cc.Color",
"r": 200,
"g": 200,
"b": 200,
"a": 255
},
"_enabled": false,
"_fogDensity": 0.3,
"_fogStart": 0.5,
"_fogEnd": 300,
"_fogAtten": 5,
"_fogTop": 1.5,
"_fogRange": 1.2
}
]

View File

@@ -0,0 +1,11 @@
{
"ver": "1.1.27",
"importer": "scene",
"imported": true,
"uuid": "280a8ada-9441-4f16-a80a-ff222160dbb4",
"files": [
".json"
],
"subMetas": {},
"userData": {}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,11 @@
{
"ver": "1.1.27",
"importer": "scene",
"imported": true,
"uuid": "49742970-8cda-44df-acd0-760abd9fd21c",
"files": [
".json"
],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,12 @@
{
"ver": "1.1.0",
"importer": "directory",
"imported": true,
"uuid": "22341277-5871-4b09-a5ca-01ca6a1553e0",
"files": [],
"subMetas": {},
"userData": {
"compressionType": {},
"isRemoteBundle": {}
}
}

View File

@@ -0,0 +1,12 @@
{
"ver": "1.1.0",
"importer": "directory",
"imported": true,
"uuid": "b090eabb-b874-46de-b1a9-89ffddb2089b",
"files": [],
"subMetas": {},
"userData": {
"compressionType": {},
"isRemoteBundle": {}
}
}

View File

@@ -0,0 +1,92 @@
import { Animation, AnimationState, _decorator, __private } from "cc";
import AnimatorBase, { AnimationPlayer } from "./core/AnimatorBase";
import AnimatorStateLogic from "./core/AnimatorStateLogic";
const { ccclass, property, requireComponent, disallowMultiple } = _decorator;
/**
* Cocos Animation状态机组件
*/
@ccclass
@disallowMultiple
@requireComponent(Animation)
export default class AnimatorAnimation extends AnimatorBase {
/** Animation组件 */
private _animation: Animation = null!;
/** 当前的动画实例 */
private _animState: AnimationState = null!;
/** 记录初始的wrapmode */
private _wrapModeMap: Map<AnimationState, number> = new Map();
protected start() {
if (!this.PlayOnStart || this._hasInit) {
return;
}
this._hasInit = true;
this._animation = this.getComponent(Animation)!;
this._animation.on(Animation.EventType.FINISHED, this.onAnimFinished, this);
this._animation.on(Animation.EventType.LASTFRAME, this.onAnimFinished, this);
if (this.AssetRawUrl !== null) {
this.initJson(this.AssetRawUrl.json);
}
}
/**
* 手动初始化状态机可传入0-3个参数类型如下
* - onStateChangeCall 状态切换时的回调
* - stateLogicMap 各个状态逻辑控制
* - animationPlayer 自定义动画控制
* @override
*/
public onInit(...args: Array<Map<string, AnimatorStateLogic> | ((fromState: string, toState: string) => void) | AnimationPlayer>) {
if (this.PlayOnStart || this._hasInit) {
return;
}
this._hasInit = true;
this.initArgs(...args);
this._animation = this.getComponent(Animation)!;
this._animation.on(Animation.EventType.FINISHED, this.onAnimFinished, this);
this._animation.on(Animation.EventType.LASTFRAME, this.onAnimFinished, this);
if (this.AssetRawUrl !== null) {
this.initJson(this.AssetRawUrl.json);
}
}
/**
* 播放动画
* @override
* @param animName 动画名
* @param loop 是否循环播放
*/
protected playAnimation(animName: string, loop: boolean) {
if (!animName) {
return;
}
this._animation.play(animName);
this._animState = this._animation.getState(animName);
if (!this._animState) {
return;
}
if (!this._wrapModeMap.has(this._animState)) {
this._wrapModeMap.set(this._animState, this._animState.wrapMode);
}
this._animState.wrapMode = loop ? 2 : this._wrapModeMap.get(this._animState)!;
}
/**
* 缩放动画播放速率
* @override
* @param scale 缩放倍率
*/
protected scaleTime(scale: number) {
if (this._animState) {
this._animState.speed = scale;
}
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.21",
"importer": "typescript",
"imported": true,
"uuid": "616e8140-9f63-4ebd-bab8-59a7061c9bcf",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,59 @@
import { _decorator } from "cc";
import AnimatorBase, { AnimationPlayer } from "./core/AnimatorBase";
import AnimatorStateLogic from "./core/AnimatorStateLogic";
const { ccclass, property, requireComponent, disallowMultiple } = _decorator;
/**
* 自定义动画控制的状态机组件
*/
@ccclass
@disallowMultiple
export default class AnimatorCustomization extends AnimatorBase {
/** 此组件必须主动调用onInit初始化 */
@property({ override: true, visible: false })
protected PlayOnStart: boolean = false;
/**
* 手动初始化状态机可传入0-3个参数类型如下
* - onStateChangeCall 状态切换时的回调
* - stateLogicMap 各个状态逻辑控制
* - animationPlayer 自定义动画控制
* @override
*/
public onInit(...args: Array<Map<string, AnimatorStateLogic> | ((fromState: string, toState: string) => void) | AnimationPlayer>) {
if (this._hasInit) {
return;
}
this._hasInit = true;
this.initArgs(...args);
if (this.AssetRawUrl !== null) {
this.initJson(this.AssetRawUrl.json);
}
}
/**
* 播放动画
* @override
* @param animName 动画名
* @param loop 是否循环播放
*/
protected playAnimation(animName: string, loop: boolean) {
if (this._animationPlayer && animName) {
this._animationPlayer.playAnimation(animName, loop);
}
}
/**
* 缩放动画播放速率
* @override
* @param scale 缩放倍率
*/
protected scaleTime(scale: number) {
if (this._animationPlayer) {
this._animationPlayer.scaleTime(scale);
}
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.21",
"importer": "typescript",
"imported": true,
"uuid": "3d89e3aa-c3f7-40bd-a114-156509c971eb",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,74 @@
import { dragonBones, _decorator } from "cc";
import AnimatorBase, { AnimationPlayer } from "./core/AnimatorBase";
import AnimatorStateLogic from "./core/AnimatorStateLogic";
const { ccclass, property, requireComponent, disallowMultiple } = _decorator;
/**
* DragonBones状态机组件
*/
@ccclass
@disallowMultiple
@requireComponent(dragonBones.ArmatureDisplay)
export default class AnimatorDragonBones extends AnimatorBase {
/** DragonBones组件 */
private _dragonBones: dragonBones.ArmatureDisplay = null!;
protected start() {
if (!this.PlayOnStart || this._hasInit) {
return;
}
this._hasInit = true;
this._dragonBones = this.getComponent(dragonBones.ArmatureDisplay)!;
this._dragonBones.addEventListener('complete', this.onAnimFinished, this);
if (this.AssetRawUrl !== null) {
this.initJson(this.AssetRawUrl.json);
}
}
/**
* 手动初始化状态机可传入0-3个参数类型如下
* - onStateChangeCall 状态切换时的回调
* - stateLogicMap 各个状态逻辑控制
* - animationPlayer 自定义动画控制
* @override
*/
public onInit(...args: Array<Map<string, AnimatorStateLogic> | ((fromState: string, toState: string) => void) | AnimationPlayer>) {
if (this.PlayOnStart || this._hasInit) {
return;
}
this._hasInit = true;
this.initArgs(...args);
this._dragonBones = this.getComponent(dragonBones.ArmatureDisplay)!;
this._dragonBones.addEventListener('complete', this.onAnimFinished, this);
if (this.AssetRawUrl !== null) {
this.initJson(this.AssetRawUrl.json);
}
}
/**
* 播放动画
* @override
* @param animName 动画名
* @param loop 是否循环播放
*/
protected playAnimation(animName: string, loop: boolean) {
if (animName)
this._dragonBones.playAnimation(animName, loop ? 0 : -1);
}
/**
* 缩放动画播放速率
* @override
* @param scale 缩放倍率
*/
protected scaleTime(scale: number) {
if (scale > 0)
this._dragonBones.timeScale = scale;
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.21",
"importer": "typescript",
"imported": true,
"uuid": "e07167b2-0e81-4d90-a411-f178e55210fe",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,122 @@
import { sp, _decorator } from "cc";
import AnimatorSpineSecondary from "./AnimatorSpineSecondary";
import AnimatorBase, { AnimationPlayer } from "./core/AnimatorBase";
import AnimatorStateLogic from "./core/AnimatorStateLogic";
const { ccclass, property, requireComponent, disallowMultiple } = _decorator;
/**
* Spine状态机组件主状态机trackIndex为0
*/
@ccclass
@disallowMultiple
@requireComponent(sp.Skeleton)
export default class AnimatorSpine extends AnimatorBase {
/** spine组件 */
private _spine: sp.Skeleton = null!;
/** 动画完成的回调 */
private _completeListenerMap: Map<(entry?: any) => void, any> = new Map();
/** 次状态机注册的回调 */
private _secondaryListenerMap: Map<(entry?: any) => void, AnimatorSpineSecondary> = new Map();
protected start() {
if (!this.PlayOnStart || this._hasInit) {
return;
}
this._hasInit = true;
this._spine = this.getComponent(sp.Skeleton)!;
this._spine.setCompleteListener(this.onSpineComplete.bind(this));
if (this.AssetRawUrl !== null) {
this.initJson(this.AssetRawUrl.json);
}
}
/**
* 手动初始化状态机可传入0-3个参数类型如下
* - onStateChangeCall 状态切换时的回调
* - stateLogicMap 各个状态逻辑控制
* - animationPlayer 自定义动画控制
* @override
*/
public onInit(...args: Array<Map<string, AnimatorStateLogic> | ((fromState: string, toState: string) => void) | AnimationPlayer>) {
if (this.PlayOnStart || this._hasInit) {
return;
}
this._hasInit = true;
this.initArgs(...args);
this._spine = this.getComponent(sp.Skeleton)!;
this._spine.setCompleteListener(this.onSpineComplete.bind(this));
if (this.AssetRawUrl !== null) {
this.initJson(this.AssetRawUrl.json);
}
}
private onSpineComplete(entry: any) {
entry.trackIndex === 0 && this.onAnimFinished();
this._completeListenerMap.forEach((target, cb) => { target ? cb.call(target, entry) : cb(entry); });
this._secondaryListenerMap.forEach((target, cb) => { entry.trackIndex === target.TrackIndex && cb.call(target, entry); });
}
/**
* 播放动画
* @override
* @param animName 动画名
* @param loop 是否循环播放
*/
protected playAnimation(animName: string, loop: boolean) {
if (animName) {
this._spine.setAnimation(0, animName, loop);
} else {
this._spine.clearTrack(0);
}
}
/**
* 缩放动画播放速率
* @override
* @param scale 缩放倍率
*/
protected scaleTime(scale: number) {
if (scale > 0)
this._spine.timeScale = scale;
}
/**
* 注册次状态机动画结束的回调(状态机内部方法,不能由外部直接调用)
*/
public addSecondaryListener(cb: (entry?: any) => void, target: AnimatorSpineSecondary) {
this._secondaryListenerMap.set(cb, target);
}
/**
* 注册动画完成时的监听
* @param cb 回调
* @param target 调用回调的this对象
*/
public addCompleteListener(cb: (entry?: any) => void, target: any = null) {
if (this._completeListenerMap.has(cb)) {
return;
}
this._completeListenerMap.set(cb, target);
}
/**
* 注销动画完成的监听
* @param cb 回调
*/
public removeCompleteListener(cb: (entry?: any) => void) {
this._completeListenerMap.delete(cb);
}
/**
* 清空动画完成的监听
*/
public clearCompleteListener() {
this._completeListenerMap.clear;
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.21",
"importer": "typescript",
"imported": true,
"uuid": "81c24459-f5fb-4bda-bba8-1a2696e1ff51",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,73 @@
import { sp, _decorator } from "cc";
import AnimatorSpine from "./AnimatorSpine";
import AnimatorBase, { AnimationPlayer } from "./core/AnimatorBase";
import AnimatorStateLogic from "./core/AnimatorStateLogic";
const { ccclass, property, requireComponent } = _decorator;
/**
* Spine状态机组件次状态机同一节点可添加多个用于在不同track中播放动画trackIndex必须大于0
*/
@ccclass
@requireComponent(sp.Skeleton)
export default class AnimatorSpineSecondary extends AnimatorBase {
@property({ tooltip: '动画播放的trackIndex必须大于0' }) TrackIndex: number = 1;
/** 主状态机 */
private _main: AnimatorSpine = null!;
/** spine组件 */
private _spine: sp.Skeleton = null!;
protected start() {
if (!this.PlayOnStart || this._hasInit) {
return;
}
this._hasInit = true;
this._spine = this.getComponent(sp.Skeleton)!;
this._main = this.getComponent(AnimatorSpine)!;
this._main.addSecondaryListener(this.onAnimFinished, this);
if (this.AssetRawUrl !== null) {
this.initJson(this.AssetRawUrl.json);
}
}
/**
* 手动初始化状态机可传入0-3个参数类型如下
* - onStateChangeCall 状态切换时的回调
* - stateLogicMap 各个状态逻辑控制
* - animationPlayer 自定义动画控制
* @override
*/
public onInit(...args: Array<Map<string, AnimatorStateLogic> | ((fromState: string, toState: string) => void) | AnimationPlayer>) {
if (this.PlayOnStart || this._hasInit) {
return;
}
this._hasInit = true;
this.initArgs(...args);
this._spine = this.getComponent(sp.Skeleton)!;
this._main = this.getComponent(AnimatorSpine)!;
this._main.addSecondaryListener(this.onAnimFinished, this);
if (this.AssetRawUrl !== null) {
this.initJson(this.AssetRawUrl.json);
}
}
/**
* 播放动画
* @override
* @param animName 动画名
* @param loop 是否循环播放
*/
protected playAnimation(animName: string, loop: boolean) {
if (animName) {
this._spine.setAnimation(this.TrackIndex, animName, loop);
} else {
this._spine.clearTrack(this.TrackIndex);
}
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.21",
"importer": "typescript",
"imported": true,
"uuid": "e0a4140f-508b-46fe-812d-a105d323a675",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,12 @@
{
"ver": "1.1.0",
"importer": "directory",
"imported": true,
"uuid": "44830f79-5a68-4423-92c7-e2458a1909b3",
"files": [],
"subMetas": {},
"userData": {
"compressionType": {},
"isRemoteBundle": {}
}
}

View File

@@ -0,0 +1,228 @@
import { Component, JsonAsset, _decorator } from 'cc';
import AnimatorController from "./AnimatorController";
import AnimatorState from "./AnimatorState";
import AnimatorStateLogic from "./AnimatorStateLogic";
const { ccclass, property, executionOrder } = _decorator;
/**
* 自定义控制动画播放的接口
*/
export interface AnimationPlayer {
/** 设置动画播放结束的回调 */
setFinishedCallback(callback: () => void, target: any): void;
/** 播放动画 */
playAnimation(animName: string, loop: boolean): void;
/** 缩放动画播放速率 */
scaleTime(scale: number): void;
}
/**
* 状态机组件基类 优先执行生命周期
*/
@ccclass
@executionOrder(-1000)
export default class AnimatorBase extends Component {
@property({ type: JsonAsset, tooltip: '状态机json文件' })
protected AssetRawUrl: JsonAsset = null!;
@property({ tooltip: '是否在start中自动启动状态机' })
protected PlayOnStart: boolean = true;
@property({ tooltip: '是否在update中自动触发状态机逻辑更新' })
protected AutoUpdate: boolean = true;
/** 是否初始化 */
protected _hasInit: boolean = false;
/** 状态机控制 */
protected _ac: AnimatorController = null!;
/** 各个状态逻辑控制key为状态名 */
protected _stateLogicMap: Map<string, AnimatorStateLogic> = null!;
/** 状态切换时的回调 */
protected _onStateChangeCall: (fromState: string, toState: string) => void = null!;
/** 自定义的动画播放控制器 */
protected _animationPlayer: AnimationPlayer = null!;
/** 当前状态名 */
public get curStateName(): string {
return this._ac.curState.name;
}
/** 当前动画名 */
public get curStateMotion(): string {
return this._ac.curState.motion;
}
/**
* 手动初始化状态机可传入0-3个参数类型如下
* - onStateChangeCall 状态切换时的回调
* - stateLogicMap 各个状态逻辑控制
* - animationPlayer 自定义动画控制
* @virtual
*/
public onInit(...args: Array<Map<string, AnimatorStateLogic> | ((fromState: string, toState: string) => void) | AnimationPlayer>) {
}
/**
* 处理初始化参数
*/
protected initArgs(...args: Array<Map<string, AnimatorStateLogic> | ((fromState: string, toState: string) => void) | AnimationPlayer>) {
args.forEach((arg) => {
if (!arg) {
return;
}
if (typeof arg === 'function') {
this._onStateChangeCall = arg;
} else if (typeof arg === 'object') {
if (arg instanceof Map) {
this._stateLogicMap = arg;
} else {
this._animationPlayer = arg;
this._animationPlayer.setFinishedCallback(this.onAnimFinished, this);
}
}
});
}
private updateAnimator() {
// 混合当前动画播放速度
let playSpeed = this._ac.curState.speed;
if (this._ac.curState.multi) {
playSpeed *= this._ac.params.getNumber(this._ac.curState.multi) || 1;
}
this.scaleTime(playSpeed);
// 更新AnimatorStateLogic
if (this._stateLogicMap) {
let curLogic = this._stateLogicMap.get(this._ac.curState.name);
curLogic && curLogic.onUpdate();
}
// 更新状态机逻辑
this._ac.updateAnimator();
}
protected update() {
if (this._hasInit && this.AutoUpdate) {
this.updateAnimator();
}
}
/**
* 手动调用更新
*/
public manualUpdate() {
if (this._hasInit && !this.AutoUpdate) {
this.updateAnimator();
}
}
/**
* 解析状态机json文件
*/
protected initJson(json: any) {
this._ac = new AnimatorController(this, json);
}
/**
* 动画结束的回调
*/
protected onAnimFinished() {
this._ac.onAnimationComplete();
}
/**
* 播放动画
* @virtual
* @param animName 动画名
* @param loop 是否循环播放
*/
protected playAnimation(animName: string, loop: boolean) {
}
/**
* 缩放动画播放速率
* @virtual
* @param scale 缩放倍率
*/
protected scaleTime(scale: number) {
}
/**
* 状态切换时的逻辑(状态机内部方法,不能由外部直接调用)
*/
public onStateChange(fromState: AnimatorState, toState: AnimatorState) {
this.playAnimation(toState.motion, toState.loop);
let fromStateName = fromState ? fromState.name : '';
if (this._stateLogicMap) {
let fromLogic = this._stateLogicMap.get(fromStateName);
fromLogic && fromLogic.onExit();
let toLogic = this._stateLogicMap.get(toState.name);
toLogic && toLogic.onEntry();
}
this._onStateChangeCall && this._onStateChangeCall(fromStateName, toState.name);
}
/**
* 设置boolean类型参数的值
*/
public setBool(key: string, value: boolean) {
this._ac.params.setBool(key, value);
}
/**
* 获取boolean类型参数的值
*/
public getBool(key: string): boolean {
return this._ac.params.getBool(key) !== 0;
}
/**
* 设置number类型参数的值
*/
public setNumber(key: string, value: number) {
this._ac.params.setNumber(key, value);
}
/**
* 获取number类型参数的值
*/
public getNumber(key: string): number {
return this._ac.params.getNumber(key);
}
/**
* 设置trigger类型参数的值
*/
public setTrigger(key: string) {
this._ac.params.setTrigger(key);
}
/**
* 重置trigger类型参数的值
*/
public resetTrigger(key: string) {
this._ac.params.resetTrigger(key);
}
/**
* 设置autoTrigger类型参数的值autoTrigger类型参数不需要主动reset每次状态机更新结束后会自动reset
*/
public autoTrigger(key: string) {
this._ac.params.autoTrigger(key);
}
/**
* 无视条件直接跳转状态
* @param 状态名
*/
public play(stateName: string) {
if (!this._hasInit) {
return;
}
this._ac.play(stateName);
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.21",
"importer": "typescript",
"imported": true,
"uuid": "b8f391f1-5a8f-4068-9247-c3c63bd87f6a",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,82 @@
import { error } from "cc";
import AnimatorController from "./AnimatorController";
/** 参数类型 */
export enum ParamType {
COMPLETE = 0,
BOOLEAN = 1,
NUMBER = 2,
TRIGGER = 3,
AUTO_TRIGGER = 4
}
/** 逻辑类型 */
export enum LogicType {
EQUAL = 0,
NOTEQUAL = 1,
GREATER = 2,
LESS = 3,
GREATER_EQUAL = 4,
LESS_EQUAL = 5
}
/**
* 单项条件
*/
export default class AnimatorCondition {
private _ac: AnimatorController;
/** 此条件对应的参数名 */
private _param: string = "";
/** 此条件对应的值 */
private _value: number = 0;
/** 此条件与值比较的逻辑 */
private _logic: LogicType = LogicType.EQUAL;
constructor(data: any, ac: AnimatorController) {
this._ac = ac;
this._param = data.param;
this._value = data.value;
this._logic = data.logic;
}
public getParamName() {
return this._param;
}
public getParamType(): ParamType {
return this._ac.params.getParamType(this._param);
}
/** 判断此条件是否满足 */
public check(): boolean {
let type: ParamType = this.getParamType();
if (type === ParamType.BOOLEAN) {
return this._ac.params.getBool(this._param) === this._value;
} else if (type === ParamType.NUMBER) {
let value: number = this._ac.params.getNumber(this._param);
switch (this._logic) {
case LogicType.EQUAL:
return value === this._value;
case LogicType.NOTEQUAL:
return value !== this._value;
case LogicType.GREATER:
return value > this._value;
case LogicType.LESS:
return value < this._value;
case LogicType.GREATER_EQUAL:
return value >= this._value;
case LogicType.LESS_EQUAL:
return value <= this._value;
default:
return false;
}
} else if (type === ParamType.AUTO_TRIGGER) {
return this._ac.params.getAutoTrigger(this._param) !== 0;
} else if (type === ParamType.TRIGGER) {
return this._ac.params.getTrigger(this._param) !== 0;
} else {
error(`[AnimatorCondition.check] 错误的type: ${type}`);
return false;
}
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.21",
"importer": "typescript",
"imported": true,
"uuid": "257d2be5-e198-4f7c-a90e-8ec11702907f",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,119 @@
import { error } from "cc";
import AnimatorBase from "./AnimatorBase";
import AnimatorParams from "./AnimatorParams";
import AnimatorState from "./AnimatorState";
/**
* 状态机控制类
*/
export default class AnimatorController {
private _jsonData: any = null;
private _animator: AnimatorBase = null!;
private _params: AnimatorParams = null!;
private _states: Map<string, AnimatorState> = null!;
private _anyState: AnimatorState = null!;
private _curState: AnimatorState = null!;
/** 状态切换次数 */
private _changeCount: number = 0;
/** 对应animComplete的状态 */
public animCompleteState: AnimatorState = null!;
/** 动画播放完毕的标记 */
public animComplete: boolean = false;
/** 当前运行的状态 */
public get curState(): AnimatorState { return this._curState; }
public get params(): AnimatorParams { return this._params; }
constructor(player: AnimatorBase, json: any) {
this._animator = player;
this._jsonData = json;
this._states = new Map<string, AnimatorState>();
this._params = new AnimatorParams(json.parameters);
this.init(json);
}
/**
* 初始化状态机所有动画状态
*/
private init(json: any) {
if (json.states.length <= 0) {
error(`[AnimatorController.init] 状态机json错误`);
return;
}
let defaultState: string = json.defaultState;
this._anyState = new AnimatorState(json.anyState, this);
for (let i = 0; i < json.states.length; i++) {
let state: AnimatorState = new AnimatorState(json.states[i], this);
this._states.set(state.name, state);
}
this.changeState(defaultState);
}
private updateState() {
this._curState.checkAndTrans();
if (this._curState !== this._anyState && this._anyState !== null) {
this._anyState.checkAndTrans();
}
}
/**
* 更新状态机逻辑
*/
public updateAnimator() {
// 重置计数
this._changeCount = 0;
this.updateState();
// 重置动画完成标记
if (this.animComplete && this.animCompleteState.loop) {
this.animComplete = false;
}
// 重置autoTrigger
this.params.resetAllAutoTrigger();
}
public onAnimationComplete() {
this.animComplete = true;
this.animCompleteState = this._curState;
// cc.log(`animation complete: ${this._curState.name}`);
}
/**
* 无视条件直接跳转状态
* @param 状态名
*/
public play(stateName: string) {
if (!this._states.has(stateName) || this._curState.name === stateName) {
return;
}
// 重置动画完成标记
this.animComplete = false;
this.changeState(stateName);
}
/**
* 切换动画状态
*/
public changeState(stateName: string) {
this._changeCount++;
if (this._changeCount > 1000) {
error('[AnimatorController.changeState] error: 状态切换递归调用超过1000次transition设置可能出错!');
return;
}
if (this._states.has(stateName) && (this._curState === null || this._curState.name !== stateName)) {
let oldState = this._curState;
this._curState = this._states.get(stateName)!;
this._animator.onStateChange(oldState, this._curState);
this.updateState();
} else {
error(`[AnimatorController.changeState] error state: ${stateName}`);
}
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.21",
"importer": "typescript",
"imported": true,
"uuid": "111f60e4-58f9-4212-b578-090e6fc32d85",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,121 @@
import { ParamType } from "./AnimatorCondition";
/**
* 参数结构
*/
interface Param {
type: ParamType;
value: number;
}
/**
* 状态机参数
*/
export default class AnimatorParams {
private _paramMap: Map<string, Param> = new Map();
constructor(dataArr: any[]) {
dataArr.forEach((data: any) => {
let param: Param = {
type: data.type,
value: data.init
};
this._paramMap.set(data.param, param);
});
}
public getParamType(key: string): ParamType {
let param: Param = this._paramMap.get(key)!;
if (param) {
return param.type;
} else {
return null!;
}
}
public setNumber(key: string, value: number) {
let param: Param = this._paramMap.get(key)!;
if (param && param.type === ParamType.NUMBER) {
param.value = value;
}
}
public setBool(key: string, value: boolean) {
let param: Param = this._paramMap.get(key)!;
if (param && param.type === ParamType.BOOLEAN) {
param.value = value ? 1 : 0;
}
}
public setTrigger(key: string) {
let param: Param = this._paramMap.get(key)!;
if (param && param.type === ParamType.TRIGGER) {
param.value = 1;
}
}
public resetTrigger(key: string) {
let param: Param = this._paramMap.get(key)!;
if (param && param.type === ParamType.TRIGGER) {
param.value = 0;
}
}
public autoTrigger(key: string) {
let param: Param = this._paramMap.get(key)!;
if (param && param.type === ParamType.AUTO_TRIGGER) {
param.value = 1;
}
}
public resetAutoTrigger(key: string) {
let param: Param = this._paramMap.get(key)!;
if (param && param.type === ParamType.AUTO_TRIGGER) {
param.value = 0;
}
}
public resetAllAutoTrigger() {
this._paramMap.forEach((param: Param, key: string) => {
if (param.type === ParamType.AUTO_TRIGGER) {
param.value = 0;
}
});
}
public getNumber(key: string): number {
let param: Param = this._paramMap.get(key)!;
if (param && param.type === ParamType.NUMBER) {
return param.value;
} else {
return 0;
}
}
public getBool(key: string): number {
let param: Param = this._paramMap.get(key)!;
if (param && param.type === ParamType.BOOLEAN) {
return param.value;
} else {
return 0;
}
}
public getTrigger(key: string): number {
let param: Param = this._paramMap.get(key)!;
if (param && param.type === ParamType.TRIGGER) {
return param.value;
} else {
return 0;
}
}
public getAutoTrigger(key: string): number {
let param: Param = this._paramMap.get(key)!;
if (param && param.type === ParamType.AUTO_TRIGGER) {
return param.value;
} else {
return 0;
}
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.21",
"importer": "typescript",
"imported": true,
"uuid": "c3c16d83-8df0-40ac-ad90-3b3f6ee65355",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,55 @@
import AnimatorController from "./AnimatorController";
import AnimatorTransition from "./AnimatorTransition";
/**
* 状态管理类
*/
export default class AnimatorState {
private _name: string = "";
private _motion: string = "";
private _loop: boolean = false;
private _speed: number = 1;
private _multi: string = "";
private _transitions: AnimatorTransition[] = [];
private _ac: AnimatorController = null!;
/** 状态名 */
public get name() { return this._name; }
/** 动画名 */
public get motion() { return this._motion; }
/** 动画是否循环播放 */
public get loop() { return this._loop; }
/** 动画播放速度 */
public get speed() { return this._speed; }
/** 动画播放速度的混合参数 */
public get multi() { return this._multi; }
constructor(data: any, ac: AnimatorController) {
this._name = data.state;
this._motion = data.motion || '';
this._loop = data.loop || false;
this._speed = data.speed || 1;
this._multi = data.multiplier || '';
this._ac = ac;
for (let i = 0; i < data.transitions.length; i++) {
let transition: AnimatorTransition = new AnimatorTransition(data.transitions[i], ac);
transition.isValid() && this._transitions.push(transition);
}
}
/**
* 判断各个分支是否满足条件,满足则转换状态
*/
public checkAndTrans() {
for (let i = 0; i < this._transitions.length; i++) {
let transition: AnimatorTransition = this._transitions[i];
if (transition && transition.check()) {
transition.doTrans();
return;
}
}
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.21",
"importer": "typescript",
"imported": true,
"uuid": "e2d00cfd-edf4-4049-be71-56efdad8caa3",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,25 @@
/**
* 状态逻辑基类
*/
export default class AnimatorStateLogic {
/**
* 进入状态时调用
* @virtual
*/
public onEntry() {
}
/**
* 每次状态机逻辑更新时调用
* @virtual
*/
public onUpdate() {
}
/**
* 离开状态时调用
* @virtual
*/
public onExit() {
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.21",
"importer": "typescript",
"imported": true,
"uuid": "c621576a-d46f-4e27-abc3-4e5d0648bd3b",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,71 @@
import AnimatorCondition, { ParamType } from "./AnimatorCondition";
import AnimatorController from "./AnimatorController";
/**
* 状态过渡类
*/
export default class AnimatorTransition {
private _toStateName: string = '';
private _hasExitTime: boolean = false;
private _conditions: AnimatorCondition[] = [];
private _ac: AnimatorController = null!;
constructor(data: any, ac: AnimatorController) {
this._toStateName = data.toState;
this._hasExitTime = data.hasExitTime;
this._ac = ac;
for (let i = 0; i < data.conditions.length; i++) {
let condition: AnimatorCondition = new AnimatorCondition(data.conditions[i], ac);
this._conditions.push(condition);
}
}
/**
* 返回该transition是否有效当未勾选hasExitTime以及没有添加任何condition时此transition无效并忽略
*/
public isValid(): boolean {
return this._hasExitTime || this._conditions.length > 0;
}
/**
* 判断是否满足所有转换条件
*/
public check(): boolean {
if (this._toStateName === this._ac.curState.name) {
return false;
}
if (this._hasExitTime && (this._ac.curState !== this._ac.animCompleteState || !this._ac.animComplete)) {
return false;
}
for (let i = 0; i < this._conditions.length; i++) {
if (!this._conditions[i].check()) {
return false;
}
}
return true;
}
/**
* 转换状态
*/
public doTrans() {
// 满足条件时重置动画播完标记
if (this._hasExitTime) {
this._ac.animComplete = false;
}
// 满足状态转换条件时重置trigger和autoTrigger
for (let i = 0; i < this._conditions.length; i++) {
let type = this._conditions[i].getParamType();
let name = this._conditions[i].getParamName();
if (type === ParamType.TRIGGER) {
this._ac.params.resetTrigger(name);
} else if (type === ParamType.AUTO_TRIGGER) {
this._ac.params.resetAutoTrigger(name);
}
}
this._ac.changeState(this._toStateName);
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.21",
"importer": "typescript",
"imported": true,
"uuid": "be88dd41-10ce-41df-bc2d-f675b373af64",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,12 @@
{
"ver": "1.1.0",
"importer": "directory",
"imported": true,
"uuid": "bab1c468-d2da-4e7b-b40d-f7f69d7c087a",
"files": [],
"subMetas": {},
"userData": {
"compressionType": {},
"isRemoteBundle": {}
}
}

View File

@@ -0,0 +1,12 @@
{
"ver": "1.1.0",
"importer": "directory",
"imported": true,
"uuid": "b2e14807-4b9d-4cc6-b6a2-abe5ddb92a8c",
"files": [],
"subMetas": {},
"userData": {
"compressionType": {},
"isRemoteBundle": {}
}
}

View File

@@ -0,0 +1,63 @@
import { Component, EventKeyboard, macro, misc, SystemEvent, systemEvent, _decorator } from 'cc';
import AnimatorAnimation from '../../animator/AnimatorAnimation';
const { ccclass, property } = _decorator;
@ccclass('Sheep')
export class Sheep extends Component {
public _animator: AnimatorAnimation = null!;
public speed: number = 0;
protected start() {
this._animator = this.getComponent(AnimatorAnimation)!;
systemEvent.on(SystemEvent.EventType.KEY_DOWN, this.onKeyDown, this);
systemEvent.on(SystemEvent.EventType.KEY_UP, this.onKeyUp, this);
}
protected update(dt: number) {
let delt = this._animator.curStateName === 'sheep_hit' ? 0 : this.speed * -this._animator.node.scale.x * dt;
let x = misc.clampf(this._animator.node.position.x + delt, -1000, 1000);
this._animator.node.setPosition(x, this._animator.node.position.y, this._animator.node.position.z);
}
protected lateUpdate() {
this._animator.setNumber('speed', this.speed);
this._animator.manualUpdate();
}
protected onDestroy() {
systemEvent.off(SystemEvent.EventType.KEY_DOWN, this.onKeyDown, this);
systemEvent.off(SystemEvent.EventType.KEY_UP, this.onKeyUp, this);
}
private onKeyDown(event: EventKeyboard) {
let code: number = event.keyCode;
switch (code) {
case macro.KEY.left:
this._animator.node.setScale(1, this._animator.node.scale.y, this._animator.node.scale.z);
this.speed = 100;
break;
case macro.KEY.right:
this._animator.node.setScale(-1, this._animator.node.scale.y, this._animator.node.scale.z);
this.speed = 100;
break;
case macro.KEY.k:
this._animator.setTrigger('hit');
default:
break;
}
}
private onKeyUp(event: EventKeyboard) {
let code: number = event.keyCode;
switch (code) {
case macro.KEY.left:
case macro.KEY.right:
this.speed = 0;
break;
default:
break;
}
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.21",
"importer": "typescript",
"imported": true,
"uuid": "af622b40-cc81-43ee-92f4-6914165ddaea",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,12 @@
{
"ver": "1.1.0",
"importer": "directory",
"imported": true,
"uuid": "e3c34b9f-47cf-4a27-917d-5794cf452e3b",
"files": [],
"subMetas": {},
"userData": {
"compressionType": {},
"isRemoteBundle": {}
}
}

View File

@@ -0,0 +1,14 @@
import { Component, _decorator } from 'cc';
import AnimatorAnimation from '../../animator/AnimatorAnimation';
const { ccclass, property } = _decorator;
@ccclass('Model')
export class Model extends Component {
private _animator: AnimatorAnimation = null!;
start() {
this._animator = this.getComponent(AnimatorAnimation)!;
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.21",
"importer": "typescript",
"imported": true,
"uuid": "95984e29-62ff-4654-b528-f781f1adc24e",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,6 @@
{
"name": "example3_0rc",
"type": "3d",
"uuid": "cf0c13ed-a5c1-4d73-875e-7ece4d0cdec1",
"version": "3.0.0"
}

View File

@@ -0,0 +1,3 @@
{
"__version__": "1.2.6"
}

View File

@@ -0,0 +1,3 @@
{
"__version__": "1.0.5"
}

View File

@@ -0,0 +1,9 @@
{
"__version__": "1.0.1",
"general": {
"designResolution": {
"width": 1080,
"height": 720
}
}
}

View File

@@ -0,0 +1,6 @@
{
/* Base configuration. Do not edit this field. */
"extends": "./temp/tsconfig.cocos.json"
/* Add your custom configuration here. */
}