diff --git a/Assets/Bundles/[EXCLAMACAO] b/Assets/Bundles/[EXCLAMACAO] new file mode 100644 index 0000000..14a7a08 Binary files /dev/null and b/Assets/Bundles/[EXCLAMACAO] differ diff --git a/Assets/Bundles/[INTERROGACAO] b/Assets/Bundles/[INTERROGACAO] new file mode 100644 index 0000000..14a7a08 Binary files /dev/null and b/Assets/Bundles/[INTERROGACAO] differ diff --git a/Assets/Bundles/[PONTO] b/Assets/Bundles/[PONTO] new file mode 100644 index 0000000..14a7a08 Binary files /dev/null and b/Assets/Bundles/[PONTO] differ diff --git a/Assets/Scenes/Scene.unity b/Assets/Scenes/Scene.unity index f5ea28b..ea82448 100644 --- a/Assets/Scenes/Scene.unity +++ b/Assets/Scenes/Scene.unity @@ -85,6 +85,30 @@ NavMeshSettings: cellSize: 0.16666666 manualCellSize: 0 m_NavMeshData: {fileID: 0} +--- !u!1 &179627316 stripped +GameObject: + m_PrefabParentObject: {fileID: 149102, guid: cd81d95d2fa8dc448b18a415b9009d43, type: 2} + m_PrefabInternal: {fileID: 1610759364} +--- !u!114 &179627317 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 179627316} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9d4b654b474c35d4592a9c87c9fe817b, type: 3} + m_Name: + m_EditorClassIdentifier: + playerManager: {fileID: 179627318} + time: 3 + probability: 0.3 +--- !u!114 &179627318 stripped +MonoBehaviour: + m_PrefabParentObject: {fileID: 11412866, guid: cd81d95d2fa8dc448b18a415b9009d43, + type: 2} + m_PrefabInternal: {fileID: 1610759364} + m_Script: {fileID: 11500000, guid: eeb6a455eb0dfd94aa6bc3484e5fecff, type: 3} --- !u!1001 &548561263 Prefab: m_ObjectHideFlags: 0 @@ -192,56 +216,52 @@ Prefab: propertyPath: m_FontData.m_Font value: objectReference: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} - - target: {fileID: 137754, guid: 12db97f21fb2a7d4cb537ec5395de1b9, type: 2} - propertyPath: m_IsActive - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: - - {fileID: 11489032, guid: 12db97f21fb2a7d4cb537ec5395de1b9, type: 2} + m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: 12db97f21fb2a7d4cb537ec5395de1b9, type: 2} m_IsPrefabParent: 0 ---- !u!1001 &1610172986 -Prefab: +--- !u!1 &910950038 stripped +GameObject: + m_PrefabParentObject: {fileID: 100138, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + m_PrefabInternal: {fileID: 1733333329} +--- !u!114 &910950040 +MonoBehaviour: m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 451132, guid: 00197fc9877daa14c963e5917de36124, type: 2} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 451132, guid: 00197fc9877daa14c963e5917de36124, type: 2} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 451132, guid: 00197fc9877daa14c963e5917de36124, type: 2} - propertyPath: m_LocalPosition.z - value: -2 - objectReference: {fileID: 0} - - target: {fileID: 451132, guid: 00197fc9877daa14c963e5917de36124, type: 2} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 451132, guid: 00197fc9877daa14c963e5917de36124, type: 2} - propertyPath: m_LocalRotation.y - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 451132, guid: 00197fc9877daa14c963e5917de36124, type: 2} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 451132, guid: 00197fc9877daa14c963e5917de36124, type: 2} - propertyPath: m_LocalRotation.w - value: -0.00000016292068 - objectReference: {fileID: 0} - - target: {fileID: 451132, guid: 00197fc9877daa14c963e5917de36124, type: 2} - propertyPath: m_RootOrder - value: 3 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_ParentPrefab: {fileID: 100100000, guid: 00197fc9877daa14c963e5917de36124, type: 2} - m_IsPrefabParent: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 910950038} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 701cf09d2ce13d246afd85b88eb177ca, type: 3} + m_Name: + m_EditorClassIdentifier: + smr: {fileID: 0} + ctrlBocaCanto_L: {fileID: 0} + ctrlLabioCentroInfer: {fileID: 0} + ctrlLabioCentroSuper: {fileID: 0} + ctrlBocaCanto_R: {fileID: 0} + ctrlSobrancelha_L: {fileID: 0} + ctrlSobrancelha_R: {fileID: 0} + ctrlSobrancCentro: {fileID: 0} + ctrlBochecha_L: {fileID: 0} + ctrlBochecha_R: {fileID: 0} + BnMandibula: {fileID: 0} +--- !u!1 &1498521122 stripped +GameObject: + m_PrefabParentObject: {fileID: 108984, guid: f5631cabe28f9db4c90e0e4e65a7d077, type: 2} + m_PrefabInternal: {fileID: 2002657203} +--- !u!114 &1498521125 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1498521122} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da8d7baf88931274abdb48afffacd98d, type: 3} + m_Name: + m_EditorClassIdentifier: + folder: ScreenCaptures + sizeMultiplier: 1 --- !u!1001 &1610759364 Prefab: m_ObjectHideFlags: 0 @@ -359,7 +379,7 @@ Prefab: - target: {fileID: 11412866, guid: cd81d95d2fa8dc448b18a415b9009d43, type: 2} propertyPath: randomAnimations value: - objectReference: {fileID: 1853098954} + objectReference: {fileID: 179627317} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: cd81d95d2fa8dc448b18a415b9009d43, type: 2} m_IsPrefabParent: 0 @@ -369,30 +389,276 @@ MonoBehaviour: type: 2} m_PrefabInternal: {fileID: 548561263} m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} ---- !u!1 &1853098951 stripped -GameObject: - m_PrefabParentObject: {fileID: 149102, guid: cd81d95d2fa8dc448b18a415b9009d43, type: 2} - m_PrefabInternal: {fileID: 1610759364} ---- !u!114 &1853098952 stripped -MonoBehaviour: - m_PrefabParentObject: {fileID: 11412866, guid: cd81d95d2fa8dc448b18a415b9009d43, - type: 2} - m_PrefabInternal: {fileID: 1610759364} - m_Script: {fileID: 11500000, guid: eeb6a455eb0dfd94aa6bc3484e5fecff, type: 3} ---- !u!114 &1853098954 -MonoBehaviour: +--- !u!1001 &1733333329 +Prefab: m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1853098951} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 9993e87cd59cf32489da3d2de0ecd84b, type: 3} - m_Name: - m_EditorClassIdentifier: - playerManager: {fileID: 1853098952} - time: 3 - probability: 0.3 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.size + value: 41 + objectReference: {fileID: 0} + - target: {fileID: 400002, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400002, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400002, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_LocalPosition.z + value: -2 + objectReference: {fileID: 0} + - target: {fileID: 400002, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400002, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_LocalRotation.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 400002, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400002, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_LocalRotation.w + value: -0.00000016292068 + objectReference: {fileID: 0} + - target: {fileID: 400002, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 400124, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_LocalRotation.x + value: 0.61669433 + objectReference: {fileID: 0} + - target: {fileID: 400124, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_LocalRotation.y + value: 0.6080088 + objectReference: {fileID: 0} + - target: {fileID: 400124, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_LocalRotation.z + value: 0.2701214 + objectReference: {fileID: 0} + - target: {fileID: 400124, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_LocalRotation.w + value: -0.42077065 + objectReference: {fileID: 0} + - target: {fileID: 100002, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Name + value: Avatar + objectReference: {fileID: 0} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animation + value: + objectReference: {fileID: 7400000, guid: 35ee7a5071a56c640b2b61ae5973eead, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[0] + value: + objectReference: {fileID: 7400000, guid: 35ee7a5071a56c640b2b61ae5973eead, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[1] + value: + objectReference: {fileID: 7400000, guid: d8f000ca18e5a0e4f9171a316b924a3b, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[2] + value: + objectReference: {fileID: 7400000, guid: 792d3b1f44997994fbd38470b5f868c2, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[3] + value: + objectReference: {fileID: 7400000, guid: 479af3282b6855e449e35e63adb41da2, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[4] + value: + objectReference: {fileID: 7400000, guid: d9f262c9534ee6244972a17d67c29b83, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[5] + value: + objectReference: {fileID: 7400000, guid: 538613ae094f2914ab9f6ec8a697cd5e, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[6] + value: + objectReference: {fileID: 7400000, guid: d9b0d9978ce268a46becbdd2d2caf90e, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[7] + value: + objectReference: {fileID: 7400000, guid: 04f57f8f049424247a0d8faaab769985, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[8] + value: + objectReference: {fileID: 7400000, guid: e8abf409e0a6f27458e2d474e0073f63, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[9] + value: + objectReference: {fileID: 7400000, guid: 06c0e40f369ab494fb4b1b6516cee9ff, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[10] + value: + objectReference: {fileID: 7400000, guid: a6764523d031de24386c8992d8b0148a, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[11] + value: + objectReference: {fileID: 7400000, guid: 25e12e29b690fa24db0698ea457b95ab, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[12] + value: + objectReference: {fileID: 7400000, guid: 659679ee3e71e1e46ad94c140edf96b1, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[13] + value: + objectReference: {fileID: 7400000, guid: 82cc47b25dcd647458f3da9451bc8329, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[14] + value: + objectReference: {fileID: 7400000, guid: 0e708e085310804448d4fe7ab20d1054, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[15] + value: + objectReference: {fileID: 7400000, guid: 26706413fed069048aaabc7b392c699f, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[16] + value: + objectReference: {fileID: 7400000, guid: 2afaecc193478e74a976b31fa19bcaa8, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[17] + value: + objectReference: {fileID: 7400000, guid: 3049e4c690605a1448cf783adc260818, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[18] + value: + objectReference: {fileID: 7400000, guid: 445d6b38bd83f2944a05f654f03676c2, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[19] + value: + objectReference: {fileID: 7400000, guid: 464d942596b490249b64f64e22c6ab19, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[20] + value: + objectReference: {fileID: 7400000, guid: 4c1a3a084aaa38e46975e9ca8fad2dd5, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[21] + value: + objectReference: {fileID: 7400000, guid: 5434ebcd194f58341ba9a7b3a120649c, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[22] + value: + objectReference: {fileID: 7400000, guid: 686f09b2b79152f4bb6f0462b9318a2c, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[23] + value: + objectReference: {fileID: 7400000, guid: 6cdfc8f2c7bd79044a1e44b86fd006ac, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[24] + value: + objectReference: {fileID: 7400000, guid: 77000653c2e90bc4891d57bf65ebd80f, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[25] + value: + objectReference: {fileID: 7400000, guid: 78c429ef57436aa42bebcc5ba0238a8a, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[26] + value: + objectReference: {fileID: 7400000, guid: 82b56df7fb4c2474fa954d8d217d4874, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[27] + value: + objectReference: {fileID: 7400000, guid: 86cf580ca0d08444693989bf70d4390a, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[28] + value: + objectReference: {fileID: 7400000, guid: 959c2b9c657b5b949bb5dc6a12b78a42, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[29] + value: + objectReference: {fileID: 7400000, guid: b98281f0ef5689d42a24663641eb8666, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[30] + value: + objectReference: {fileID: 7400000, guid: bcb5b826971f467438ab07355237ad23, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[31] + value: + objectReference: {fileID: 7400000, guid: bd75cc7221b6ef54689b0aed6506c2f3, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[32] + value: + objectReference: {fileID: 7400000, guid: c461e1a2c8d5b4b4ba25eae95d4304b8, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[33] + value: + objectReference: {fileID: 7400000, guid: caf9b70dfccae734197c871d778b7387, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[34] + value: + objectReference: {fileID: 7400000, guid: cb2ba4c4e0b1f8e4da2512e403510364, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[35] + value: + objectReference: {fileID: 7400000, guid: d7b55d01eaa71f240bfa1b5274250757, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[36] + value: + objectReference: {fileID: 7400000, guid: dd71fb38e3865c34bbe898cb661da9ab, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[37] + value: + objectReference: {fileID: 7400000, guid: e422f6e6a13f6114fb6a40cc691c71df, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[38] + value: + objectReference: {fileID: 7400000, guid: ef4ef0a64c4fc684295a28cec1a32a72, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[39] + value: + objectReference: {fileID: 7400000, guid: ef7413ebb20766c49b1bd92d5fec878b, type: 2} + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Animations.Array.data[40] + value: + objectReference: {fileID: 7400000, guid: b4cddd8331fe7f547ae2a4cae99d96f1, type: 2} + - target: {fileID: 13700004, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 2100000, guid: f59307a7307ee684c9b51e79ef13b71c, type: 2} + - target: {fileID: 13700002, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 2100000, guid: fd6cc31e0eefe15409b9165f257181d0, type: 2} + - target: {fileID: 13700000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Materials.Array.data[1] + value: + objectReference: {fileID: 2100000, guid: fd6cc31e0eefe15409b9165f257181d0, type: 2} + - target: {fileID: 13700000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 2100000, guid: 3e98fe09c9ac4ae4dbe731872ff7687a, type: 2} + - target: {fileID: 13700016, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 2100000, guid: 3e98fe09c9ac4ae4dbe731872ff7687a, type: 2} + - target: {fileID: 13700014, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 2100000, guid: 3e98fe09c9ac4ae4dbe731872ff7687a, type: 2} + - target: {fileID: 13700012, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Materials.Array.data[1] + value: + objectReference: {fileID: 2100000, guid: 2ea2853b4c338874ead33e59c519216c, type: 2} + - target: {fileID: 13700006, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 2100000, guid: 1e19ab6c967fd3348be10315b0d06b1b, type: 2} + - target: {fileID: 100002, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + propertyPath: m_TagString + value: avatar + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 100100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3} + m_IsPrefabParent: 0 --- !u!1001 &2002657203 Prefab: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/CameraCapture.cs b/Assets/Scripts/CameraCapture.cs new file mode 100644 index 0000000..2b8fd53 --- /dev/null +++ b/Assets/Scripts/CameraCapture.cs @@ -0,0 +1,45 @@ +using UnityEngine; +using System; +using System.Threading; + +public class CameraCapture : MonoBehaviour +{ + public static bool capture = false; + + // The folder we place all screenshots inside. + // If the folder exists we will append numbers to create an empty folder. + public string folder = "ScreenCaptures"; + public static int frameRate = 30; + public int sizeMultiplier = 1; + //string[] strArg; + public static int frameNumber = 0; + + void Start() + { + string[] strArg = Environment.GetCommandLineArgs(); + + if (strArg.Length >= 2) + folder = strArg[1]; + + // Create the folder + folder = Application.persistentDataPath + "/" + folder; + System.IO.Directory.CreateDirectory(folder); + Debug.Log("ScreenCaptures to " + folder); + + if (strArg.Length >= 4) + frameRate = int.Parse(strArg[3]); + + Time.captureFramerate = frameRate; + } + + void Update() + { + if (capture) + { + var name = string.Format("{0}/frame_{1}.png", folder, frameNumber++); // Time.frameCount); + Application.CaptureScreenshot(name, sizeMultiplier); + } + } + +} // class + diff --git a/Assets/Scripts/CameraCapture.cs.meta b/Assets/Scripts/CameraCapture.cs.meta new file mode 100644 index 0000000..7041994 --- /dev/null +++ b/Assets/Scripts/CameraCapture.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: da8d7baf88931274abdb48afffacd98d +timeCreated: 1444936132 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/FacialExpressions.js.meta b/Assets/Scripts/FacialExpressions.js.meta index 9d3ba77..c5b7690 100644 --- a/Assets/Scripts/FacialExpressions.js.meta +++ b/Assets/Scripts/FacialExpressions.js.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 guid: 701cf09d2ce13d246afd85b88eb177ca -timeCreated: 1461080653 +timeCreated: 1461097232 licenseType: Pro MonoImporter: serializedVersion: 2 diff --git a/Assets/Scripts/GenericPlayerManager.cs b/Assets/Scripts/GenericPlayerManager.cs deleted file mode 100644 index 54c54ae..0000000 --- a/Assets/Scripts/GenericPlayerManager.cs +++ /dev/null @@ -1,705 +0,0 @@ -/** Gerenciador genérico e principal dos players. - * - * Versão 2.1 - * - Acompanhamento da legenda - * Corrigido problema na soletração quando a velocidade ultrapassava ~1. - * - * Versão 2.2 - * - Acompanhamento da legenda - * Corrigido problema na soletração quando o estado muda para pausado. - * - * Versão 2.3 - * - Legenda - * A letras acentuadas reproduzem a mesma sem o acento. - * - * Versão 2.4 - * - Legenda - * "Ç" reproduz "C". - * - Reprodução - * Quando não há acesso aos bundles dos sinais de pontuação, eles são ignorados. - * Ç adicionado como TYPE_WORD. - */ - -//Log Dir http://docs.unity3d.com/Manual/LogFiles.html -using UnityEngine; -using System.Collections; -using System.Collections.Generic; -using System; -using System.Threading; -using System.IO; -using System.Text; -using System.Runtime.InteropServices; -using UnityEngine.UI; - -public abstract class GenericPlayerManager : MonoBehaviour { - - private const string DEFAULT_ANIMATION = "_default"; - private const string DEFAULT_ANIMATION_MIDDLE = "_default_middle"; - - public float fadeLength = 0.6F; - public string gloss = ""; - - // Referencia para o avatar - private GameObject AVATAR; - // Referencia para o componente animador do avatar - private Animation COMPONENT_ANIMATION; - public Text SUBTITLES; - - // Guarda os nomes das palavras já carregadas - private HashSet loadedAssetBundles = new HashSet(); - // Guarda os nomes das palavras que não tem assetbundle - private HashSet nonexistentAssetBundles = new HashSet(); - - // Fila de animações para reprodução - // Utilizada para alterar velocidade e apresentar a legenda - private Queue animQueue = new Queue(); - - // Sinais de intervalo de animações: não sinaliza reprodução na UI - private HashSet intervalAnimations = new HashSet(); - // Sinais ignorados na apresentação de legenda - private HashSet flags = new HashSet(); - - // True quando está na função LoadAndPlay - private volatile bool loading = false; - // True quando está reproduzindo qualquer animação - private volatile bool playing = false; - // True quando é chamada a função de pausa - private volatile bool paused = false; - - // Se diferente de null, não está reproduzindo animação de intervalo - private AnimationState intervalAnimationState = null; - // Usado para pausar quando comandado - private AnimationReference animationPlaying = null; - - // Gerenciador de animações de intervalo - public RandomAnimations randomAnimations; - // Gerenciador de legendas - public Subtitle subtitles = null; - - private bool[] lastLetterAnimations = new bool[256]; - - public virtual void Start() - { - // Configuração de velocidade das animações - subtitles = new Subtitle(SUBTITLES); - subtitles.DefaultWordSpeed = new DefaultSignSpeed(); - subtitles.DefaultFirstLetterSpeed = new DefaultSignSpeed(2.1F, 2.8F); - subtitles.DefaultLetterSpeed = new DefaultSignSpeed(3F, 4.3F); - subtitles.DefaultNumberSpeed = new DefaultSignSpeed(1.5F, 2.9F); - - AVATAR = GameObject.FindGameObjectWithTag("avatar"); - COMPONENT_ANIMATION = AVATAR.GetComponent(); - - // Sinais ignorados na legenda - string[] flags = new string[] { - "[PONTO]", - "[INTERROGAÇÃO]", - "[EXCLAMAÇÃO]" - }; - foreach (string flag in flags) - this.flags.Add(flag); - - string[] preloadedAnims = new string[] { - "A", "B", "C", "Ç", "D", "E", "F", "G", "H", "I", - "J", "K", "L", "M", "N", "O", "P", "Q", "R", - "S", "T", "U", "V", "W", "X", "Y", "Z", - "0", "1", "2", "3", "4", - "5", "6", "7", "8", "9", - "," - }; - - // Duplica sinais para diferenciar quando há repetidos - foreach (string anim in preloadedAnims) - COMPONENT_ANIMATION.AddClip(COMPONENT_ANIMATION[anim].clip, "d_" + anim); - - foreach (string anim in preloadedAnims) - this.loadedAssetBundles.Add(anim); - - // Cria novo _default chamado _default_middle para pausas dentro de uma glosa - // Impede que a animação default seja confundida com não-reprodução na UI - COMPONENT_ANIMATION.AddClip(COMPONENT_ANIMATION[DEFAULT_ANIMATION].clip, DEFAULT_ANIMATION_MIDDLE); - } - - public bool isPlayingIntervalAnimation() { return intervalAnimationState != null; } - public bool isLoading() { return loading; } - public bool isPlaying() { return playing; } - public bool isPaused() { return paused; } - public bool isRepeatable() { return ! String.IsNullOrEmpty(gloss); } - - public virtual void setSubtitle(string text) { - this.subtitles.setText(text); - } - - /* Configura as animações de intervalo */ - public void setRandomAnimations(string[] intervalAnimations) - { - foreach (string name in intervalAnimations) - { - this.intervalAnimations.Add(name); - this.loadedAssetBundles.Add(name); - } - - this.randomAnimations.setAnimations(intervalAnimations); - } - - /* Define a velocidade das animacões com base no slider da GUI */ - public void setSlider(float sliderPosition) - { - subtitles.SliderPosition = sliderPosition; - subtitles.updateWordSpeed(); - subtitles.updateLetterSpeed(); - subtitles.updateNumberSpeed(); - - // Altera a velocidade de todas as animações em reprodução - if ( ! paused) lock (this.animQueue) - { - foreach (AnimationReference reference in this.animQueue) - if (reference.type != Subtitle.TYPE_NONE && reference.state != null) - reference.state.speed = getSpeedByType(reference.type); - } - } - - /* Retorna a velocidade para o tipo */ - private float getSpeedByType(short type) - { - switch (type) - { - case Subtitle.TYPE_WORD: return subtitles.WordSpeed; - case Subtitle.TYPE_LETTER: return subtitles.LetterSpeed; - case Subtitle.TYPE_NUMBER: return subtitles.NumberSpeed; - } - - return 2F; - } - - /* Para carregamento e animações */ - public void stopAll() - { - StopCoroutine("loadAndPlay"); - this.randomAnimations.unlockFor("loadAndPlay"); - loading = false; - - stopAnimations(); - } - - /* Para animações */ - public void stopAnimations() - { - StopCoroutine("handleStates"); - this.randomAnimations.unlockFor("handleStates"); - this.subtitles.setText(""); - - lock (this.animQueue) { this.animQueue.Clear(); } - COMPONENT_ANIMATION.CrossFadeQueued(DEFAULT_ANIMATION, fadeLength, QueueMode.PlayNow); - - resetStates(); - } - - /* Repete animações */ - public void repeat() { - repeat(true); - } - - /* Repete animações se now == true ou se não estiver carregando glosa */ - public void repeat(bool now) - { - if (now || ! this.loading) - playNow(this.gloss); - } - - /* Manda reproduzir animação e adiciona a file de animações a serem reproduzidas */ - private AnimationState playAnimation(short type, string name, string subtitle, float speed) - { - try - { - AnimationState state = COMPONENT_ANIMATION.CrossFadeQueued(name, fadeLength, QueueMode.CompleteOthers); - state.speed = speed; - - lock (this.animQueue) { - this.animQueue.Enqueue(new AnimationReference(name, subtitle, state, type)); - } - - return state; - } - catch (NullReferenceException nre) { - UnityEngine.Debug.Log("'" + name + "' não foi encontrado!\n" + nre.ToString()); - } - - return null; - } - private AnimationState playAnimation(short type, string name, string subtitle) { - return playAnimation(type, name, subtitle, getSpeedByType(type)); - } - private AnimationState playAnimation(short type, string name) { - return playAnimation(type, name, name); - } - - /* Enfileira em reprodução a animação de intervalo */ - private void playDefaultAnimation() { - playDefaultAnimation(false); - } - - /* Enfileira em reprodução a animação padrão se now == true, ou reproduz imediatamente */ - private void playDefaultAnimation(bool now) { - COMPONENT_ANIMATION.CrossFadeQueued(DEFAULT_ANIMATION, fadeLength, now ? QueueMode.PlayNow : QueueMode.CompleteOthers); - } - - - /** - * Returns the asset bundle named aniName. - * - * @return AssetBundle - se for encontrado. - * null - se ocorrer num erro. - */ - public abstract WWW loadAssetBundle(string aniName); - - /** - * Listen to changes in the playing status. - */ - public abstract void onConnectionError(string gloss, string word); - - /** - * Listen to changes in the playing status. - */ - public abstract void onPlayingStateChange(); - - - /* Pause or continue animations */ - public void setPauseState(bool paused) - { - if (this.paused != paused) - { - this.paused = paused; - - lock (this.animQueue) - { - if (this.animationPlaying != null && this.animationPlaying.state != null) - this.animationPlaying.state.speed = paused ? 0F : getSpeedByType(this.animationPlaying.type); - - foreach (AnimationReference reference in this.animQueue) - if (reference.state != null) - reference.state.speed = paused ? 0F : getSpeedByType(reference.type); - } - } - - onPlayingStateChange(); - } - - public void setAnimationEnabled(bool enabled) { - COMPONENT_ANIMATION.enabled = enabled; - } - - /* Pause or continue animations */ - public void switchPauseState() { - setPauseState( ! this.paused); - } - - private System.Object LOCKER_PLAY = new System.Object(); - - /* Reproduz apenas se não houver algo sendo carregado ou rerpoduzido */ - public bool playIfEmpty(string gloss) - { - lock (LOCKER_PLAY) - { - if (this.loading || this.playing) - return false; - - StartCoroutine("loadAndPlay", gloss); - } - - return true; - } - - /* Enfieira animações para reprodução */ - public void playQueued(string gloss) - { - lock (LOCKER_PLAY) - { - Debug.Log("GPM:pQ(" + gloss + ")"); - StartCoroutine("loadAndPlay", gloss); - } - } - - /* Para todas as animações, limpa a fila e reproduz */ - public void playNow(string gloss) - { - lock (LOCKER_PLAY) - { - stopAll(); - StartCoroutine("loadAndPlay", gloss); - } - } - - /* Reproduz animação de intervalo */ - public bool playIntervalAnimation(string name) - { - if ( ! Monitor.TryEnter(LOCKER_PLAY)) - return false; - - lock (LOCKER_PLAY) - { - playDefaultAnimation(true); - this.intervalAnimationState = COMPONENT_ANIMATION.CrossFadeQueued(name, fadeLength, QueueMode.CompleteOthers); - playDefaultAnimation(false); - } - - return true; - } - - private string nextLetterAnimation(char letter) - { - string animation = (this.lastLetterAnimations[letter] ? "" : "d_") + letter.ToString(); - this.lastLetterAnimations[letter] = ! this.lastLetterAnimations[letter]; - - return animation; - } - - private static short getType(char c) - { - // Se for uma letra - if (c >= 65 && c <= 90) - return Subtitle.TYPE_LETTER; - - // Se for um número - else if (c >= 48 && c <= 57) - return Subtitle.TYPE_NUMBER; - - // Se for uma vírgula - else if (c == 44 || c == 'Ç') - return Subtitle.TYPE_WORD; - - else - return Subtitle.TYPE_NONE; - } - - /* Enfileira soletração de palavra */ - private string spellWord(Queue toPlayQueue, string word) - { - string lastAnimationSubtitle = ""; - bool defaultPlayed = false; - - // A reprodução da primeira letra deve ser longa para não ser cortada no fade - this.subtitles.updateLetterSpeed(); - - for (int i = 0; i < word.Length; i++) - { - lastAnimationSubtitle = Subtitle.highlight(word, i); - char anim = word[i]; - - switch (word[i]) - { - case 'Á': - case 'Â': - case 'À': - case 'Ã': anim = 'A'; - break; - case 'É': - case 'Ê': anim = 'E'; - break; - case 'Í': anim = 'I'; - break; - case 'Ó': - case 'Ô': - case 'Õ': anim = 'O'; - break; - case 'Ú': anim = 'U'; - break; - } - - short type = getType(anim); - string animName = nextLetterAnimation(anim); - - // Não há animação - if (type == Subtitle.TYPE_NONE) - { - // Reproduz animação default apenas uma vez - if ( ! defaultPlayed) - { - defaultPlayed = true; - toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_WORD, DEFAULT_ANIMATION_MIDDLE, lastAnimationSubtitle, this)); - - // A reprodução da próxima letra deve ser longa para não ser cortada no fade - this.subtitles.updateLetterSpeed(); - } - - UnityEngine.Debug.Log("Animação \"" + animName + "\" inexistente."); - } - else - { - toPlayQueue.Enqueue(new ToPlay(type, animName, lastAnimationSubtitle, this)); - - defaultPlayed = false; - this.subtitles.updateLetterSpeed(); - } - } - - return lastAnimationSubtitle; - } - - /* Instruções para reprodução de aninmação */ - private struct ToPlay - { - private short type; - private string name; - private string subtitle; - private float speed; - - public ToPlay(short type, string name, string subtitle, float speed) - { - this.type = type; - this.name = name; - this.subtitle = subtitle; - this.speed = speed; - } - public ToPlay(short type, string name, string subtitle, GenericPlayerManager context) - : this(type, name, subtitle, 0F) { - this.speed = context.getSpeedByType(type); - } - public ToPlay(short type, string name, GenericPlayerManager context) - : this(type, name, name, context) { } - - public void play(GenericPlayerManager context) { - context.playAnimation(this.type, this.name, this.subtitle, this.speed); - } - } - - private System.Object LOCKER_LOADING = new System.Object(); - - /* Carrega animações e reproduz */ - private IEnumerator loadAndPlay(string gloss) - { - lock (LOCKER_LOADING) - { - Debug.Log("GPM:lAP(" + gloss + ")"); - this.randomAnimations.lockFor("loadAndPlay"); - this.loading = true; - // onPlayingStateChange(); - - string lastAnimationSubtitle = ""; - bool spelled = false; - - if ( ! this.playing) - StartCoroutine("handleStates"); - - String[] stringPos = gloss.Split(' '); - - Queue toPlayQueue = new Queue(); - int wordsCount = 0; - toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION, "", this)); - - foreach (string aniName in stringPos) - { - wordsCount++; - if (String.IsNullOrEmpty(aniName)) continue; - - bool nonexistent = nonexistentAssetBundles.Contains(aniName); - bool loaded = loadedAssetBundles.Contains(aniName); - - if ( ! nonexistent && ! loaded) - { - // Função loadAssetBundle é definida pela classe filha - WWW www = loadAssetBundle(aniName); - - if (www != null) - { - Debug.Log("GPM:lAP(" + gloss + "): www != null"); - yield return www; - - AssetBundle bundle = null; - - if (www.error == null) - { - Debug.Log("GPM:lAP(" + gloss + "): www.error == null"); - bundle = www.assetBundle; - - if (bundle != null && ! String.IsNullOrEmpty(bundle.mainAsset.name)) - { - AnimationClip aniClip = bundle.mainAsset as AnimationClip; - bundle.Unload(false); - - if (aniClip) - { - COMPONENT_ANIMATION.AddClip(aniClip, aniName); - - loadedAssetBundles.Add(aniName); - loaded = true; - - Debug.Log("GPM:lAP(" + gloss + "): Bundle \"" + aniName + "\" loaded!"); - } - else UnityEngine.Debug.Log ("GPM:lAP(" + gloss + "): Sinal \"" + aniName + "\" foi não carregado corretamente."); - } - } - else onConnectionError(gloss, aniName); - } - else onConnectionError(gloss, aniName); - } - - // Reproduz palavra - if (loaded) - { - if (spelled) - { - // Default - toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION, lastAnimationSubtitle, this)); - spelled = false; - } - - if (this.flags.Contains(aniName) || this.intervalAnimations.Contains(aniName)) - { - lastAnimationSubtitle = ""; - toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_WORD, aniName, "", this)); - } - else - { - lastAnimationSubtitle = aniName; - toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_WORD, aniName, this)); - } - } - - // Soletra palavra - else - { - // Se a animação não foi carregada e nem está marcada como não existente, - // adiciona ao set de animações não existentes - if ( ! nonexistent) - nonexistentAssetBundles.Add(aniName); - - UnityEngine.Debug.Log("GPM:lAP(" + gloss + "): To spell: " + aniName); - - if (this.flags.Contains(aniName) || this.intervalAnimations.Contains(aniName)) - { - toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION_MIDDLE, "", 1.6F)); - spelled = false; - } - else - { - // Se já houve o soletramento de alguma palavra, reproduz animação default - if (spelled) - toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION_MIDDLE, "", 1.6F)); - else - spelled = true; - - lastAnimationSubtitle = spellWord(toPlayQueue, aniName); - } - } - - if (toPlayQueue.Count > 4 || wordsCount == stringPos.Length) - while (toPlayQueue.Count > 0) - toPlayQueue.Dequeue().play(this); - } - - // Default - playAnimation(Subtitle.TYPE_NONE, DEFAULT_ANIMATION, ""); - - this.loading = false; - // onPlayingStateChange(); - this.randomAnimations.unlockFor("loadAndPlay"); - } - } - - private System.Object LOCKER_PLAYING = new System.Object(); - - /* Sincroniza as legendas com as animações. */ - IEnumerator handleStates() - { - lock (LOCKER_PLAYING) - { - UnityEngine.Debug.Log("GPM:hS()"); - - this.randomAnimations.lockFor("handleStates"); - this.playing = true; - onPlayingStateChange(); - - bool isNotEmpty; - lock (this.animQueue) { isNotEmpty = this.animQueue.Count > 0; } - - // Animação anterior a atual - AnimationReference endedAnimation = null; - - // Enquanto estiver executando a corotina "loadAndPlay" - // ou existir animações na fila de reprodução - while (loading || isNotEmpty) - { - // Se não houver animações na fila, espera - if (isNotEmpty) - { - // Pega primeira animação - AnimationReference reference; - lock (this.animQueue) { reference = this.animQueue.Peek(); } - - // Se estiver sendo reproduzida - if (COMPONENT_ANIMATION.IsPlaying(reference.name)) - { - Debug.Log("GPM:hS(): Playing " + reference.name); - this.subtitles.setText(reference.subtitle); - - // Animação seguinte - AnimationReference next = null; - lock (this.animQueue) - { - this.animationPlaying = this.animQueue.Dequeue(); - - if (this.animQueue.Count > 0) - next = this.animQueue.Peek(); - } - - while (true) - { - // Se a próxima animação estiver sendo reproduzida (no fade) - if (next != null && COMPONENT_ANIMATION.IsPlaying(next.name)) - { - // Se a animação anterior a atual não tiver acabado, - // espera acabar e só então conta o tempo - if (endedAnimation != null) - while (COMPONENT_ANIMATION.IsPlaying(endedAnimation.name)) - yield return null; - - // Tempo para pular para a legenda da próxima animação - yield return new WaitForSeconds(0.4F); - - // Deprecated - // yield return WaitForContinuousMillis.Wait(this, 300); - - endedAnimation = reference; - break; - } - - else if (COMPONENT_ANIMATION.IsPlaying(reference.name)) - yield return null; - - else break; - } - - reference = null; - } - - // Se a animação não tiver sido liberada e seu AnimationState for nulo, - // a animação será liberada - if (reference != null && reference.state == null) - lock (this.animQueue) { this.animQueue.Dequeue(); } - else - yield return null; - } - else yield return null; - - lock (this.animQueue) { isNotEmpty = this.animQueue.Count > 0; } - } - UnityEngine.Debug.Log("GPM:sH(): All done."); - - this.subtitles.setText(""); - - resetStates(); - this.randomAnimations.unlockFor("handleStates"); - } - } - - public void resetStates() - { - this.animationPlaying = null; - this.playing = false; - this.paused = false; - - onPlayingStateChange(); - } - -} diff --git a/Assets/Scripts/GenericPlayerManager.cs.meta b/Assets/Scripts/GenericPlayerManager.cs.meta deleted file mode 100644 index 90d6205..0000000 --- a/Assets/Scripts/GenericPlayerManager.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 953c1d9124325ab4099d246d3cbfb780 -timeCreated: 1440187017 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Message.cs b/Assets/Scripts/Message.cs new file mode 100644 index 0000000..eceb813 --- /dev/null +++ b/Assets/Scripts/Message.cs @@ -0,0 +1,24 @@ +using System; + +public class Message { + + private string text = ""; + private long time = 0; + + public Message(string message) + { + string[] tokens = message.Split('#'); + + if (tokens.Length > 0) + { + this.text = tokens[0]; + + if (tokens.Length > 1) + this.time = Int64.Parse(tokens[1]); + } + } + + public string Text { get { return text; } } + public long Time { get { return time; } } + +} \ No newline at end of file diff --git a/Assets/Scripts/Message.cs.meta b/Assets/Scripts/Message.cs.meta new file mode 100644 index 0000000..fd0454f --- /dev/null +++ b/Assets/Scripts/Message.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a20a670dddb80ae409e79be805b6a1e9 +timeCreated: 1445377277 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/PlayerManager.cs b/Assets/Scripts/PlayerManager.cs index 6621008..6dd8ace 100644 --- a/Assets/Scripts/PlayerManager.cs +++ b/Assets/Scripts/PlayerManager.cs @@ -13,6 +13,8 @@ public class PlayerManager : GenericPlayerManager { private Server server = null; private Semaphore serverSemaphore = null; + + private volatile Queue messages = new Queue(); private volatile bool toFinalize = false; public override void Start() @@ -20,9 +22,12 @@ public class PlayerManager : GenericPlayerManager { base.Start(); string[] args = Environment.GetCommandLineArgs(); - if (args.Length >= 2) + if (args.Length >= 5) { - float speedRate = (int.Parse(args[1]) + 100F) / 100F; + float speedRate = (int.Parse(args[4]) + 100F) / 100F; + + if (speedRate > 100) + base.fadeLength = 0.5F; DefaultSignSpeed ds = base.subtitles.DefaultWordSpeed; base.subtitles.DefaultWordSpeed = new DefaultSignSpeed( @@ -30,33 +35,26 @@ public class PlayerManager : GenericPlayerManager { ds.Max * speedRate ); } - if (args.Length >= 3) + + if (args.Length >= 6) { - float speedRate = (int.Parse(args[2]) + 100F) / 100F; + float speedRate = (int.Parse(args[5]) + 100F) / 100F; - DefaultSignSpeed ds = base.subtitles.DefaultLetterSpeed; - base.subtitles.DefaultLetterSpeed = new DefaultSignSpeed( - ds.Speed * speedRate, - ds.Max * speedRate - ); + if (speedRate > 100F) + base.fadeLength = 0.5F; - ds = base.subtitles.DefaultFirstLetterSpeed; + DefaultSignSpeed ds = base.subtitles.DefaultFirstLetterSpeed; base.subtitles.DefaultFirstLetterSpeed = new DefaultSignSpeed( ds.Speed * speedRate, ds.Max * speedRate ); - ds = base.subtitles.DefaultNumberSpeed; - base.subtitles.DefaultNumberSpeed = new DefaultSignSpeed( + ds = base.subtitles.DefaultLetterSpeed; + base.subtitles.DefaultLetterSpeed = new DefaultSignSpeed( ds.Speed * speedRate, ds.Max * speedRate ); } - if (args.Length >= 4) - { - if (int.Parse(args[3]) == 1) - base.SUBTITLES.gameObject.SetActive(true); - } serverSemaphore = new Semaphore(0, 1); server = new Server(serverSemaphore, this); @@ -65,15 +63,50 @@ public class PlayerManager : GenericPlayerManager { serverSemaphore.WaitOne(); + //UnityEngine.Debug.Log("Datapath: " + Application.dataPath); + Screen.SetResolution(800, 600, false); } protected void Update() { - if (toFinalize) Application.Quit(); + if (toFinalize) + { + UnityEngine.Debug.Log("Update -> toFinalize == " + toFinalize); + Application.Quit(); + } } - public void playMessage(string message) { - base.playQueued(message.ToUpper()); + public void enqueueMessage(Message message) { + //UnityEngine.Debug.Log("PlayerManager.enqueueMessage( " + message.Text + " )"); + messages.Enqueue(message); + } + + public void finishConnection() { + //UnityEngine.Debug.Log("PlayerManager.finishConnection()"); + StartCoroutine(MessageChecker()); + } + + IEnumerator MessageChecker() + { + CameraCapture.capture = true; + foreach (Message message in messages) + { + while ((CameraCapture.frameNumber * 1000) / CameraCapture.frameRate < message.Time) + yield return null; + + UnityEngine.Debug.Log("Loading " + message.Text); + base.playQueued(message.Text); + } + + while (base.isPlaying() || base.isLoading()) + yield return null; + + UnityEngine.Debug.Log("ALL DONE!"); + server.sendFinalizeToCore(); + CameraCapture.capture = false; + UnityEngine.Debug.Log("CameraCapture.capture == " + CameraCapture.capture); + toFinalize = true; + UnityEngine.Debug.Log("toFinalize == " + toFinalize); } public override WWW loadAssetBundle(string aniName) @@ -81,13 +114,9 @@ public class PlayerManager : GenericPlayerManager { string assetPath = Application.dataPath + "/Bundles/" + aniName; if ( ! File.Exists(assetPath)) - { - UnityEngine.Debug.Log("PM:lAB(" + aniName + "): File at " + assetPath + " doesn't exists"); return null; - } try { - UnityEngine.Debug.Log("PM:lAB(" + aniName + "): Loading file at " + assetPath); WWW www = new WWW("file://" + assetPath); return www; } catch (Exception e) { @@ -99,8 +128,6 @@ public class PlayerManager : GenericPlayerManager { public override void onPlayingStateChange() { } - public override void onConnectionError(string gloss, string word) { - UnityEngine.Debug.Log("PM:oCE: " + gloss + " / " + word); - } + public override void onConnectionError(string gloss, string word) { } } diff --git a/Assets/Scripts/PlayerManager/AnimationReference.cs.meta b/Assets/Scripts/PlayerManager/AnimationReference.cs.meta index ffa1311..c1d63bd 100644 --- a/Assets/Scripts/PlayerManager/AnimationReference.cs.meta +++ b/Assets/Scripts/PlayerManager/AnimationReference.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: df5e8cf8b3eb49c4cb1286ca5dcbedb4 -timeCreated: 1461076407 +guid: 0a79f85598da5e245b6beae9133a8a26 +timeCreated: 1457644367 licenseType: Pro MonoImporter: serializedVersion: 2 diff --git a/Assets/Scripts/PlayerManager/DefaultSignSpeed.cs.meta b/Assets/Scripts/PlayerManager/DefaultSignSpeed.cs.meta index a142257..44685ef 100644 --- a/Assets/Scripts/PlayerManager/DefaultSignSpeed.cs.meta +++ b/Assets/Scripts/PlayerManager/DefaultSignSpeed.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 7d1d6b6ae0a940f4e81b74d8f4b0157a -timeCreated: 1461076406 +guid: 65beafb116ad9fe4fbf6eee8d0253b39 +timeCreated: 1457644367 licenseType: Pro MonoImporter: serializedVersion: 2 diff --git a/Assets/Scripts/PlayerManager/GenericPlayerManager.cs b/Assets/Scripts/PlayerManager/GenericPlayerManager.cs new file mode 100644 index 0000000..9472baa --- /dev/null +++ b/Assets/Scripts/PlayerManager/GenericPlayerManager.cs @@ -0,0 +1,704 @@ +/** Gerenciador genérico e principal dos players. + * + * Versão 2.1 + * - Acompanhamento da legenda + * Corrigido problema na soletração quando a velocidade ultrapassava ~1. + * + * Versão 2.2 + * - Acompanhamento da legenda + * Corrigido problema na soletração quando o estado muda para pausado. + * + * Versão 2.3 + * - Legenda + * A letras acentuadas reproduzem a mesma sem o acento. + * + * Versão 2.4 + * - Legenda + * "Ç" reproduz "C". + * - Reprodução + * Quando não há acesso aos bundles dos sinais de pontuação, eles são ignorados. + * Ç adicionado como TYPE_WORD. + */ + +//Log Dir http://docs.unity3d.com/Manual/LogFiles.html +using UnityEngine; +using System.Collections; +using System.Collections.Generic; +using System; +using System.Threading; +using System.IO; +using System.Text; +using System.Runtime.InteropServices; +using UnityEngine.UI; + +public abstract class GenericPlayerManager : MonoBehaviour { + + private const string DEFAULT_ANIMATION = "_default"; + private const string DEFAULT_ANIMATION_MIDDLE = "_default_middle"; + + public float fadeLength = 0.6F; + public string gloss = ""; + + // Referencia para o avatar + private GameObject AVATAR; + // Referencia para o componente animador do avatar + private Animation COMPONENT_ANIMATION; + public Text SUBTITLES; + + // Guarda os nomes das palavras já carregadas + private HashSet loadedAssetBundles = new HashSet(); + // Guarda os nomes das palavras que não tem assetbundle + private HashSet nonexistentAssetBundles = new HashSet(); + + // Fila de animações para reprodução + // Utilizada para alterar velocidade e apresentar a legenda + private Queue animQueue = new Queue(); + + // Sinais de intervalo de animações: não sinaliza reprodução na UI + private HashSet intervalAnimations = new HashSet(); + // Sinais ignorados na apresentação de legenda + private HashSet flags = new HashSet(); + + // True quando está na função LoadAndPlay + private volatile bool loading = false; + // True quando está reproduzindo qualquer animação + private volatile bool playing = false; + // True quando é chamada a função de pausa + private volatile bool paused = false; + + // Se diferente de null, não está reproduzindo animação de intervalo + private AnimationState intervalAnimationState = null; + // Usado para pausar quando comandado + private AnimationReference animationPlaying = null; + + // Gerenciador de animações de intervalo + public RandomAnimations randomAnimations; + // Gerenciados de legendas + public Subtitle subtitles = null; + + private bool[] lastLetterAnimations = new bool[256]; + + public virtual void Start() + { + // Configuração de velocidade das animações + subtitles = new Subtitle(SUBTITLES); + subtitles.DefaultWordSpeed = new DefaultSignSpeed(); + subtitles.DefaultFirstLetterSpeed = new DefaultSignSpeed(2.1F, 2.8F); + subtitles.DefaultLetterSpeed = new DefaultSignSpeed(3F, 4.3F); + subtitles.DefaultNumberSpeed = new DefaultSignSpeed(1.5F, 2.9F); + + AVATAR = GameObject.FindGameObjectWithTag("avatar"); + COMPONENT_ANIMATION = AVATAR.GetComponent(); + + // Sinais ignorados na legenda + string[] flags = new string[] { + "[PONTO]", + "[INTERROGAÇÃO]", + "[EXCLAMAÇÃO]" + }; + foreach (string flag in flags) + this.flags.Add(flag); + + string[] preloadedAnims = new string[] { + "A", "B", "C", "Ç", "D", "E", "F", "G", "H", "I", + "J", "K", "L", "M", "N", "O", "P", "Q", "R", + "S", "T", "U", "V", "W", "X", "Y", "Z", + "0", "1", "2", "3", "4", + "5", "6", "7", "8", "9", + "," + }; + + // Duplica sinais para diferenciar quando há repetidos + foreach (string anim in preloadedAnims) + COMPONENT_ANIMATION.AddClip(COMPONENT_ANIMATION[anim].clip, "d_" + anim); + + foreach (string anim in preloadedAnims) + this.loadedAssetBundles.Add(anim); + + // Cria novo _default chamado _default_middle para pausas dentro de uma glosa + // Impede que a animação default seja confundida com não-reprodução na UI + COMPONENT_ANIMATION.AddClip(COMPONENT_ANIMATION[DEFAULT_ANIMATION].clip, DEFAULT_ANIMATION_MIDDLE); + } + + public bool isPlayingIntervalAnimation() { return intervalAnimationState != null; } + public bool isLoading() { return loading; } + public bool isPlaying() { return playing; } + public bool isPaused() { return paused; } + public bool isRepeatable() { return ! String.IsNullOrEmpty(gloss); } + + public virtual void setSubtitle(string text) { + this.subtitles.setText(text); + } + + /* Configura as animações de intervalo */ + public void setRandomAnimations(string[] intervalAnimations) + { + foreach (string name in intervalAnimations) + { + this.intervalAnimations.Add(name); + this.loadedAssetBundles.Add(name); + } + + this.randomAnimations.setAnimations(intervalAnimations); + } + + /* Define a velocidade das animacões com base no slider da GUI */ + public void setSlider(float sliderPosition) + { + subtitles.SliderPosition = sliderPosition; + subtitles.updateWordSpeed(); + subtitles.updateLetterSpeed(); + subtitles.updateNumberSpeed(); + + // Altera a velocidade de todas as animações em reprodução + if ( ! paused) lock (this.animQueue) + { + foreach (AnimationReference reference in this.animQueue) + if (reference.type != Subtitle.TYPE_NONE && reference.state != null) + reference.state.speed = getSpeedByType(reference.type); + } + } + + /* Retorna a velocidade para o tipo */ + private float getSpeedByType(short type) + { + switch (type) + { + case Subtitle.TYPE_WORD: return subtitles.WordSpeed; + case Subtitle.TYPE_LETTER: return subtitles.LetterSpeed; + case Subtitle.TYPE_NUMBER: return subtitles.NumberSpeed; + } + + return 2F; + } + + /* Para carregamento e animações */ + public void stopAll() + { + StopCoroutine("loadAndPlay"); + this.randomAnimations.unlockFor("loadAndPlay"); + loading = false; + + stopAnimations(); + } + + /* Para animações */ + public void stopAnimations() + { + StopCoroutine("handleStates"); + this.randomAnimations.unlockFor("handleStates"); + this.subtitles.setText(""); + + lock (this.animQueue) { this.animQueue.Clear(); } + COMPONENT_ANIMATION.CrossFadeQueued(DEFAULT_ANIMATION, fadeLength, QueueMode.PlayNow); + + resetStates(); + } + + /* Repete animações */ + public void repeat() { + repeat(true); + } + + /* Repete animações se now == true ou se não estiver carregando glosa */ + public void repeat(bool now) + { + if (now || ! this.loading) + playNow(this.gloss); + } + + /* Manda reproduzir animação e adiciona a file de animações a serem reproduzidas */ + private AnimationState playAnimation(short type, string name, string subtitle, float speed) + { + try + { + AnimationState state = COMPONENT_ANIMATION.CrossFadeQueued(name, fadeLength, QueueMode.CompleteOthers); + state.speed = speed; + + lock (this.animQueue) { + this.animQueue.Enqueue(new AnimationReference(name, subtitle, state, type)); + } + + return state; + } + catch (NullReferenceException nre) { + UnityEngine.Debug.Log("'" + name + "' não foi encontrado!\n" + nre.ToString()); + } + + return null; + } + private AnimationState playAnimation(short type, string name, string subtitle) { + return playAnimation(type, name, subtitle, getSpeedByType(type)); + } + private AnimationState playAnimation(short type, string name) { + return playAnimation(type, name, name); + } + + /* Enfileira em reprodução a animação de intervalo */ + private void playDefaultAnimation() { + playDefaultAnimation(false); + } + + /* Enfileira em reprodução a animação padrão se now == true, ou reproduz imediatamente */ + private void playDefaultAnimation(bool now) { + COMPONENT_ANIMATION.CrossFadeQueued(DEFAULT_ANIMATION, fadeLength, now ? QueueMode.PlayNow : QueueMode.CompleteOthers); + } + + + /** + * Returns the asset bundle named aniName. + * + * @return AssetBundle - se for encontrado. + * null - se ocorrer num erro. + */ + public abstract WWW loadAssetBundle(string aniName); + + /** + * Listen to changes in the playing status. + */ + public abstract void onConnectionError(string gloss, string word); + + /** + * Listen to changes in the playing status. + */ + public abstract void onPlayingStateChange(); + + + /* Pause or continue animations */ + public void setPauseState(bool paused) + { + if (this.paused != paused) + { + this.paused = paused; + + lock (this.animQueue) + { + if (this.animationPlaying != null && this.animationPlaying.state != null) + this.animationPlaying.state.speed = paused ? 0F : getSpeedByType(this.animationPlaying.type); + + foreach (AnimationReference reference in this.animQueue) + if (reference.state != null) + reference.state.speed = paused ? 0F : getSpeedByType(reference.type); + } + } + + onPlayingStateChange(); + } + + public void setAnimationEnabled(bool enabled) { + COMPONENT_ANIMATION.enabled = enabled; + } + + /* Pause or continue animations */ + public void switchPauseState() { + setPauseState( ! this.paused); + } + + private System.Object LOCKER_PLAY = new System.Object(); + + /* Play if anything loading or playing */ + public bool playIfEmpty(string gloss) + { + lock (LOCKER_PLAY) + { + if (this.loading || this.playing) + return false; + + StartCoroutine("loadAndPlay", gloss); + } + + return true; + } + + private System.Object LOCKER_GLOSS_WATING = new System.Object(); + private int numGlossWating = 0; + public void setGlossWaiting(bool inc) { lock (LOCKER_GLOSS_WATING) { numGlossWating += inc ? 1 : -1; } } + public bool hasGlossWaiting() { lock (LOCKER_GLOSS_WATING) { return this.numGlossWating > 0; } } + + /* Enqueue animations for playing */ + public void playQueued(string gloss) + { + lock (LOCKER_PLAY) + { + setGlossWaiting(true); + StartCoroutine("loadAndPlay", gloss); + } + } + + /* Stop all and play */ + public void playNow(string gloss) + { + lock (LOCKER_PLAY) + { + stopAll(); + StartCoroutine("loadAndPlay", gloss); + } + } + + /* Reproduz animação de intervalo */ + public bool playIntervalAnimation(string name) + { + if ( ! Monitor.TryEnter(LOCKER_PLAY)) + return false; + + lock (LOCKER_PLAY) + { + playDefaultAnimation(true); + this.intervalAnimationState = COMPONENT_ANIMATION.CrossFadeQueued(name, fadeLength, QueueMode.CompleteOthers); + playDefaultAnimation(false); + } + + return true; + } + + private string nextLetterAnimation(char letter) + { + string animation = (this.lastLetterAnimations[letter] ? "" : "d_") + letter.ToString(); + this.lastLetterAnimations[letter] = ! this.lastLetterAnimations[letter]; + + return animation; + } + + private static short getType(char c) + { + // Se for uma letra + if (c >= 65 && c <= 90) + return Subtitle.TYPE_LETTER; + + // Se for um número + else if (c >= 48 && c <= 57) + return Subtitle.TYPE_NUMBER; + + // Se for uma vírgula + else if (c == 44 || c == 'Ç') + return Subtitle.TYPE_WORD; + + else + return Subtitle.TYPE_NONE; + } + + /* Enfileira soletração de palavra */ + private string spellWord(Queue toPlayQueue, string word) + { + string lastAnimationSubtitle = ""; + bool defaultPlayed = false; + + // A reprodução da primeira letra deve ser longa para não ser cortada no fade + this.subtitles.updateLetterSpeed(); + + for (int i = 0; i < word.Length; i++) + { + lastAnimationSubtitle = Subtitle.highlight(word, i); + char anim = word[i]; + + switch (word[i]) + { + case 'Á': + case 'Â': + case 'À': + case 'Ã': anim = 'A'; + break; + case 'É': + case 'Ê': anim = 'E'; + break; + case 'Í': anim = 'I'; + break; + case 'Ó': + case 'Ô': + case 'Õ': anim = 'O'; + break; + case 'Ú': anim = 'U'; + break; + } + + short type = getType(anim); + string animName = nextLetterAnimation(anim); + + // Não há animação + if (type == Subtitle.TYPE_NONE) + { + // Reproduz animação default apenas uma vez + if ( ! defaultPlayed) + { + defaultPlayed = true; + toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_WORD, DEFAULT_ANIMATION_MIDDLE, lastAnimationSubtitle, this)); + + // A reprodução da próxima letra deve ser longa para não ser cortada no fade + this.subtitles.updateLetterSpeed(); + } + + UnityEngine.Debug.Log("Animação \"" + animName + "\" inexistente."); + } + else + { + toPlayQueue.Enqueue(new ToPlay(type, animName, lastAnimationSubtitle, this)); + + defaultPlayed = false; + this.subtitles.updateLetterSpeed(); + } + } + + return lastAnimationSubtitle; + } + + /* Instruções para reprodução de aninmação */ + private struct ToPlay + { + private short type; + private string name; + private string subtitle; + private float speed; + + public ToPlay(short type, string name, string subtitle, float speed) + { + this.type = type; + this.name = name; + this.subtitle = subtitle; + this.speed = speed; + } + public ToPlay(short type, string name, string subtitle, GenericPlayerManager context) + : this(type, name, subtitle, 0F) { + this.speed = context.getSpeedByType(type); + } + public ToPlay(short type, string name, GenericPlayerManager context) + : this(type, name, name, context) { } + + public void play(GenericPlayerManager context) { + context.playAnimation(this.type, this.name, this.subtitle, this.speed); + } + } + + private System.Object LOCKER_LOADING = new System.Object(); + + /* Carrega animações e reproduz */ + private IEnumerator loadAndPlay(string gloss) + { + lock (LOCKER_LOADING) + { + this.randomAnimations.lockFor("loadAndPlay"); + this.loading = true; + setGlossWaiting(false); + // onPlayingStateChange(); + + string lastAnimationSubtitle = ""; + bool spelled = false; + + if ( ! this.playing) + StartCoroutine("handleStates"); + + String[] stringPos = gloss.Split(' '); + + Queue toPlayQueue = new Queue(); + int wordsCount = 0; + toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION, "", this)); + + foreach (string aniName in stringPos) + { + wordsCount++; + if (String.IsNullOrEmpty(aniName)) continue; + + bool nonexistent = nonexistentAssetBundles.Contains(aniName); + bool loaded = loadedAssetBundles.Contains(aniName); + + if ( ! nonexistent && ! loaded) + { + // Função loadAssetBundle é definida pela classe filha + WWW www = loadAssetBundle(aniName); + + if (www != null) + { + yield return www; + + AssetBundle bundle = null; + + if (www.error == null) + { + bundle = www.assetBundle; + + if (bundle != null && ! String.IsNullOrEmpty(bundle.mainAsset.name)) + { + AnimationClip aniClip = bundle.mainAsset as AnimationClip; + bundle.Unload(false); + + if (aniClip) + { + COMPONENT_ANIMATION.AddClip(aniClip, aniName); + + loadedAssetBundles.Add(aniName); + loaded = true; + + Debug.Log("Bundle \"" + aniName + "\" loaded!"); + } + else UnityEngine.Debug.Log ("Sinal \"" + aniName + "\" foi não carregado corretamente."); + } + } + else onConnectionError(gloss, aniName); + } + else onConnectionError(gloss, aniName); + } + + // Reproduz palavra + if (loaded) + { + if (spelled) + { + // Default + toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION, lastAnimationSubtitle, this)); + spelled = false; + } + + if (this.flags.Contains(aniName) || this.intervalAnimations.Contains(aniName)) + { + lastAnimationSubtitle = ""; + toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_WORD, aniName, "", this)); + } + else + { + lastAnimationSubtitle = aniName; + toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_WORD, aniName, this)); + } + } + + // Soletra palavra + else + { + // Se a animação não foi carregada e nem está marcada como não existente, + // adiciona ao set de animações não existentes + if ( ! nonexistent) + nonexistentAssetBundles.Add(aniName); + + UnityEngine.Debug.Log("~~ To spell: " + aniName); + + if (this.flags.Contains(aniName) || this.intervalAnimations.Contains(aniName)) + { + toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION_MIDDLE, "", 1.6F)); + spelled = false; + } + else + { + // Se já houve o soletramento de alguma palavra, reproduz animação default + if (spelled) + toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION_MIDDLE, "", 1.6F)); + else + spelled = true; + + lastAnimationSubtitle = spellWord(toPlayQueue, aniName); + } + } + + if (toPlayQueue.Count > 4 || wordsCount == stringPos.Length) + while (toPlayQueue.Count > 0) + toPlayQueue.Dequeue().play(this); + } + + // Default + playAnimation(Subtitle.TYPE_NONE, DEFAULT_ANIMATION, ""); + + this.loading = false; + // onPlayingStateChange(); + this.randomAnimations.unlockFor("loadAndPlay"); + } + } + + private System.Object LOCKER_PLAYING = new System.Object(); + + /* Sincroniza as legendas com as animações. */ + IEnumerator handleStates() + { + lock (LOCKER_PLAYING) + { + this.randomAnimations.lockFor("handleStates"); + this.playing = true; + onPlayingStateChange(); + + bool isNotEmpty; + lock (this.animQueue) { isNotEmpty = this.animQueue.Count > 0; } + + // Animação anterior a atual + AnimationReference endedAnimation = null; + + // Enquanto estiver executando a corotina "loadAndPlay" + // ou existir animações na fila de reprodução + while (loading || isNotEmpty) + { + // Se não houver animações na fila, espera + if (isNotEmpty) + { + // Pega primeira animação + AnimationReference reference; + lock (this.animQueue) { reference = this.animQueue.Peek(); } + + // Se estiver sendo reproduzida + if (COMPONENT_ANIMATION.IsPlaying(reference.name)) + { + this.subtitles.setText(reference.subtitle); + + // Animação seguinte + AnimationReference next = null; + lock (this.animQueue) + { + this.animationPlaying = this.animQueue.Dequeue(); + + if (this.animQueue.Count > 0) + next = this.animQueue.Peek(); + } + + while (true) + { + // Se a próxima animação estiver sendo reproduzida (no fade) + if (next != null && COMPONENT_ANIMATION.IsPlaying(next.name)) + { + // Se a animação anterior a atual não tiver acabado, + // espera acabar e só então conta o tempo + if (endedAnimation != null) + while (COMPONENT_ANIMATION.IsPlaying(endedAnimation.name)) + yield return null; + + // Tempo para pular para a legenda da próxima animação + yield return new WaitForSeconds(0.4F); + + // Deprecated + // yield return WaitForContinuousMillis.Wait(this, 300); + + endedAnimation = reference; + break; + } + + else if (COMPONENT_ANIMATION.IsPlaying(reference.name)) + yield return null; + + else break; + } + + reference = null; + } + + // Se a animação não tiver sido liberada e seu AnimationState for nulo, + // a animação será liberada + if (reference != null && reference.state == null) + lock (this.animQueue) { this.animQueue.Dequeue(); } + else + yield return null; + } + else yield return null; + + lock (this.animQueue) { isNotEmpty = this.animQueue.Count > 0; } + } + + this.subtitles.setText(""); + + resetStates(); + this.randomAnimations.unlockFor("handleStates"); + } + } + + public void resetStates() + { + this.animationPlaying = null; + this.playing = false; + this.paused = false; + + onPlayingStateChange(); + } + +} diff --git a/Assets/Scripts/PlayerManager/GenericPlayerManager.cs.meta b/Assets/Scripts/PlayerManager/GenericPlayerManager.cs.meta new file mode 100644 index 0000000..3a2e9c8 --- /dev/null +++ b/Assets/Scripts/PlayerManager/GenericPlayerManager.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 953c1d9124325ab4099d246d3cbfb780 +timeCreated: 1457644367 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/PlayerManager/RandomAnimations.cs b/Assets/Scripts/PlayerManager/RandomAnimations.cs index 606811b..4578c4e 100644 --- a/Assets/Scripts/PlayerManager/RandomAnimations.cs +++ b/Assets/Scripts/PlayerManager/RandomAnimations.cs @@ -60,37 +60,36 @@ public class RandomAnimations : MonoBehaviour { { while (true) { - // Espera enquanto estiver reproduzindo animações de intervalo - do { yield return null; } - while (this.playerManager.isPlayingIntervalAnimation()); + while (this.playerManager.isPlayingIntervalAnimation()) + yield return new WaitForSeconds(1); - // Se houver bloqueio, espera acabar - while (true) + bool isNotBlocked; + lock (this.blockingObjects) { + isNotBlocked = this.blockingObjects.Count == 0; + } + + if (isNotBlocked) { + yield return new WaitForSeconds(this.time); + lock (this.blockingObjects) { - if (this.blockingObjects.Count == 0) - break; + if (this.blockingObjects.Count > 0) + continue; } - yield return null; - } + int index = sortIndex(); - // Espera time - yield return new WaitForSeconds(this.time); + if (index != -1) + { + if (index == this.lastIndex) + index = sortIndex(); - // Se houver bloqueio, volta a esperar - lock (this.blockingObjects) { - if (this.blockingObjects.Count > 0) - continue; + //this.playerManager.play(this.names[index], true, false, true); + this.playerManager.playIntervalAnimation(this.names[index]); + } } - - int index = sortIndex(); - - if (index != -1 && index == this.lastIndex) - index = sortIndex(); - - if (index != -1) - this.playerManager.playIntervalAnimation(this.names[index]); + + yield return null; } } diff --git a/Assets/Scripts/PlayerManager/RandomAnimations.cs.meta b/Assets/Scripts/PlayerManager/RandomAnimations.cs.meta index 9fbdce4..8f56ec8 100644 --- a/Assets/Scripts/PlayerManager/RandomAnimations.cs.meta +++ b/Assets/Scripts/PlayerManager/RandomAnimations.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 9993e87cd59cf32489da3d2de0ecd84b -timeCreated: 1461076406 +guid: 9d4b654b474c35d4592a9c87c9fe817b +timeCreated: 1457644367 licenseType: Pro MonoImporter: serializedVersion: 2 diff --git a/Assets/Scripts/PlayerManager/Subtitle.cs.meta b/Assets/Scripts/PlayerManager/Subtitle.cs.meta index b1706b6..7f3bde0 100644 --- a/Assets/Scripts/PlayerManager/Subtitle.cs.meta +++ b/Assets/Scripts/PlayerManager/Subtitle.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 6a1e9f523e8ff7843a43c3167886faf2 -timeCreated: 1461076406 +guid: f97b63181c1ec5f488126f3f9fd68141 +timeCreated: 1457644367 licenseType: Pro MonoImporter: serializedVersion: 2 diff --git a/Assets/Scripts/Server.cs b/Assets/Scripts/Server.cs index 32ca813..7701ec4 100644 --- a/Assets/Scripts/Server.cs +++ b/Assets/Scripts/Server.cs @@ -40,7 +40,7 @@ public class Server { client = server.AcceptTcpClient(); // Accepts a pending connection request. stream = client.GetStream(); - serverSemaphore.Release(); // Releases InspectorScript.Start() [Connection] + serverSemaphore.Release (); // Releases InspectorScript.Start() [Connection] getPTSFromCore(); } @@ -71,6 +71,10 @@ public class Server { int i; Byte[] sendToCore; + /*Loop to receive all the data from Core + util get the string "FINALIZE\0" + '\0' for c++*/ + Debug.Log("getPTSFromCore"); while ((i = stream.Read(bytes, 0, bytes.Length)) != 0) @@ -80,10 +84,17 @@ public class Server { sendToCore = System.Text.UTF8Encoding.UTF8.GetBytes("OK\0"); // allows Core to send next stream stream.Write(sendToCore, 0, sendToCore.Length); - Debug.Log(data); + Message message = new Message(data); + + Debug.Log("gPFC: received: " + message.Text); - if ( ! data.Equals("FINALIZE")) - inspector.playMessage(data); + if (message.Text.Equals("FINALIZE")) + { + inspector.finishConnection(); + break; + } + else + inspector.enqueueMessage(message); } Debug.Log("~~ getPTSFromCore"); @@ -97,6 +108,7 @@ public class Server { public void sendFinalizeToCore(){ Byte[] sendToCore = System.Text.UTF8Encoding.UTF8.GetBytes("FINALIZE\0"); // ativar para o core stream.Write(sendToCore, 0, sendToCore.Length); + //closeConnections(); } public void closeConnections(){ diff --git a/Assets/Scripts/SwitchSubActiveStatus.cs b/Assets/Scripts/SwitchSubActiveStatus.cs new file mode 100644 index 0000000..19b55e1 --- /dev/null +++ b/Assets/Scripts/SwitchSubActiveStatus.cs @@ -0,0 +1,12 @@ +using UnityEngine; +using System; + +public class SwitchSubActiveStatus : MonoBehaviour { + + void Start() + { + string[] strArg = Environment.GetCommandLineArgs(); + gameObject.SetActive(strArg.Length < 3 || strArg[2].Equals("1")); + } + +} \ No newline at end of file diff --git a/Assets/Scripts/SwitchSubActiveStatus.cs.meta b/Assets/Scripts/SwitchSubActiveStatus.cs.meta new file mode 100644 index 0000000..99225a6 --- /dev/null +++ b/Assets/Scripts/SwitchSubActiveStatus.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f2c282fe94d95b544b4585b0af90077b +timeCreated: 1441833015 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: -- libgit2 0.21.2