Commit 3451c726e6e58320e34096f3b2fd779bbcb21936

Authored by Mateus Lustosa
1 parent b565c376
Exists in devel

Correção do player

Assets/Bundles/[EXCLAMACAO] 0 → 100644
No preview for this file type
Assets/Bundles/[INTERROGACAO] 0 → 100644
No preview for this file type
Assets/Bundles/[PONTO] 0 → 100644
No preview for this file type
Assets/Scenes/Scene.unity
@@ -85,6 +85,30 @@ NavMeshSettings: @@ -85,6 +85,30 @@ NavMeshSettings:
85 cellSize: 0.16666666 85 cellSize: 0.16666666
86 manualCellSize: 0 86 manualCellSize: 0
87 m_NavMeshData: {fileID: 0} 87 m_NavMeshData: {fileID: 0}
  88 +--- !u!1 &179627316 stripped
  89 +GameObject:
  90 + m_PrefabParentObject: {fileID: 149102, guid: cd81d95d2fa8dc448b18a415b9009d43, type: 2}
  91 + m_PrefabInternal: {fileID: 1610759364}
  92 +--- !u!114 &179627317
  93 +MonoBehaviour:
  94 + m_ObjectHideFlags: 0
  95 + m_PrefabParentObject: {fileID: 0}
  96 + m_PrefabInternal: {fileID: 0}
  97 + m_GameObject: {fileID: 179627316}
  98 + m_Enabled: 1
  99 + m_EditorHideFlags: 0
  100 + m_Script: {fileID: 11500000, guid: 9d4b654b474c35d4592a9c87c9fe817b, type: 3}
  101 + m_Name:
  102 + m_EditorClassIdentifier:
  103 + playerManager: {fileID: 179627318}
  104 + time: 3
  105 + probability: 0.3
  106 +--- !u!114 &179627318 stripped
  107 +MonoBehaviour:
  108 + m_PrefabParentObject: {fileID: 11412866, guid: cd81d95d2fa8dc448b18a415b9009d43,
  109 + type: 2}
  110 + m_PrefabInternal: {fileID: 1610759364}
  111 + m_Script: {fileID: 11500000, guid: eeb6a455eb0dfd94aa6bc3484e5fecff, type: 3}
88 --- !u!1001 &548561263 112 --- !u!1001 &548561263
89 Prefab: 113 Prefab:
90 m_ObjectHideFlags: 0 114 m_ObjectHideFlags: 0
@@ -192,56 +216,52 @@ Prefab: @@ -192,56 +216,52 @@ Prefab:
192 propertyPath: m_FontData.m_Font 216 propertyPath: m_FontData.m_Font
193 value: 217 value:
194 objectReference: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 218 objectReference: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
195 - - target: {fileID: 137754, guid: 12db97f21fb2a7d4cb537ec5395de1b9, type: 2}  
196 - propertyPath: m_IsActive  
197 - value: 0  
198 - objectReference: {fileID: 0}  
199 - m_RemovedComponents:  
200 - - {fileID: 11489032, guid: 12db97f21fb2a7d4cb537ec5395de1b9, type: 2} 219 + m_RemovedComponents: []
201 m_ParentPrefab: {fileID: 100100000, guid: 12db97f21fb2a7d4cb537ec5395de1b9, type: 2} 220 m_ParentPrefab: {fileID: 100100000, guid: 12db97f21fb2a7d4cb537ec5395de1b9, type: 2}
202 m_IsPrefabParent: 0 221 m_IsPrefabParent: 0
203 ---- !u!1001 &1610172986  
204 -Prefab: 222 +--- !u!1 &910950038 stripped
  223 +GameObject:
  224 + m_PrefabParentObject: {fileID: 100138, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  225 + m_PrefabInternal: {fileID: 1733333329}
  226 +--- !u!114 &910950040
  227 +MonoBehaviour:
205 m_ObjectHideFlags: 0 228 m_ObjectHideFlags: 0
206 - serializedVersion: 2  
207 - m_Modification:  
208 - m_TransformParent: {fileID: 0}  
209 - m_Modifications:  
210 - - target: {fileID: 451132, guid: 00197fc9877daa14c963e5917de36124, type: 2}  
211 - propertyPath: m_LocalPosition.x  
212 - value: 0  
213 - objectReference: {fileID: 0}  
214 - - target: {fileID: 451132, guid: 00197fc9877daa14c963e5917de36124, type: 2}  
215 - propertyPath: m_LocalPosition.y  
216 - value: 0  
217 - objectReference: {fileID: 0}  
218 - - target: {fileID: 451132, guid: 00197fc9877daa14c963e5917de36124, type: 2}  
219 - propertyPath: m_LocalPosition.z  
220 - value: -2  
221 - objectReference: {fileID: 0}  
222 - - target: {fileID: 451132, guid: 00197fc9877daa14c963e5917de36124, type: 2}  
223 - propertyPath: m_LocalRotation.x  
224 - value: 0  
225 - objectReference: {fileID: 0}  
226 - - target: {fileID: 451132, guid: 00197fc9877daa14c963e5917de36124, type: 2}  
227 - propertyPath: m_LocalRotation.y  
228 - value: 1  
229 - objectReference: {fileID: 0}  
230 - - target: {fileID: 451132, guid: 00197fc9877daa14c963e5917de36124, type: 2}  
231 - propertyPath: m_LocalRotation.z  
232 - value: 0  
233 - objectReference: {fileID: 0}  
234 - - target: {fileID: 451132, guid: 00197fc9877daa14c963e5917de36124, type: 2}  
235 - propertyPath: m_LocalRotation.w  
236 - value: -0.00000016292068  
237 - objectReference: {fileID: 0}  
238 - - target: {fileID: 451132, guid: 00197fc9877daa14c963e5917de36124, type: 2}  
239 - propertyPath: m_RootOrder  
240 - value: 3  
241 - objectReference: {fileID: 0}  
242 - m_RemovedComponents: []  
243 - m_ParentPrefab: {fileID: 100100000, guid: 00197fc9877daa14c963e5917de36124, type: 2}  
244 - m_IsPrefabParent: 0 229 + m_PrefabParentObject: {fileID: 0}
  230 + m_PrefabInternal: {fileID: 0}
  231 + m_GameObject: {fileID: 910950038}
  232 + m_Enabled: 1
  233 + m_EditorHideFlags: 0
  234 + m_Script: {fileID: 11500000, guid: 701cf09d2ce13d246afd85b88eb177ca, type: 3}
  235 + m_Name:
  236 + m_EditorClassIdentifier:
  237 + smr: {fileID: 0}
  238 + ctrlBocaCanto_L: {fileID: 0}
  239 + ctrlLabioCentroInfer: {fileID: 0}
  240 + ctrlLabioCentroSuper: {fileID: 0}
  241 + ctrlBocaCanto_R: {fileID: 0}
  242 + ctrlSobrancelha_L: {fileID: 0}
  243 + ctrlSobrancelha_R: {fileID: 0}
  244 + ctrlSobrancCentro: {fileID: 0}
  245 + ctrlBochecha_L: {fileID: 0}
  246 + ctrlBochecha_R: {fileID: 0}
  247 + BnMandibula: {fileID: 0}
  248 +--- !u!1 &1498521122 stripped
  249 +GameObject:
  250 + m_PrefabParentObject: {fileID: 108984, guid: f5631cabe28f9db4c90e0e4e65a7d077, type: 2}
  251 + m_PrefabInternal: {fileID: 2002657203}
  252 +--- !u!114 &1498521125
  253 +MonoBehaviour:
  254 + m_ObjectHideFlags: 0
  255 + m_PrefabParentObject: {fileID: 0}
  256 + m_PrefabInternal: {fileID: 0}
  257 + m_GameObject: {fileID: 1498521122}
  258 + m_Enabled: 1
  259 + m_EditorHideFlags: 0
  260 + m_Script: {fileID: 11500000, guid: da8d7baf88931274abdb48afffacd98d, type: 3}
  261 + m_Name:
  262 + m_EditorClassIdentifier:
  263 + folder: ScreenCaptures
  264 + sizeMultiplier: 1
245 --- !u!1001 &1610759364 265 --- !u!1001 &1610759364
246 Prefab: 266 Prefab:
247 m_ObjectHideFlags: 0 267 m_ObjectHideFlags: 0
@@ -359,7 +379,7 @@ Prefab: @@ -359,7 +379,7 @@ Prefab:
359 - target: {fileID: 11412866, guid: cd81d95d2fa8dc448b18a415b9009d43, type: 2} 379 - target: {fileID: 11412866, guid: cd81d95d2fa8dc448b18a415b9009d43, type: 2}
360 propertyPath: randomAnimations 380 propertyPath: randomAnimations
361 value: 381 value:
362 - objectReference: {fileID: 1853098954} 382 + objectReference: {fileID: 179627317}
363 m_RemovedComponents: [] 383 m_RemovedComponents: []
364 m_ParentPrefab: {fileID: 100100000, guid: cd81d95d2fa8dc448b18a415b9009d43, type: 2} 384 m_ParentPrefab: {fileID: 100100000, guid: cd81d95d2fa8dc448b18a415b9009d43, type: 2}
365 m_IsPrefabParent: 0 385 m_IsPrefabParent: 0
@@ -369,30 +389,276 @@ MonoBehaviour: @@ -369,30 +389,276 @@ MonoBehaviour:
369 type: 2} 389 type: 2}
370 m_PrefabInternal: {fileID: 548561263} 390 m_PrefabInternal: {fileID: 548561263}
371 m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 391 m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
372 ---- !u!1 &1853098951 stripped  
373 -GameObject:  
374 - m_PrefabParentObject: {fileID: 149102, guid: cd81d95d2fa8dc448b18a415b9009d43, type: 2}  
375 - m_PrefabInternal: {fileID: 1610759364}  
376 ---- !u!114 &1853098952 stripped  
377 -MonoBehaviour:  
378 - m_PrefabParentObject: {fileID: 11412866, guid: cd81d95d2fa8dc448b18a415b9009d43,  
379 - type: 2}  
380 - m_PrefabInternal: {fileID: 1610759364}  
381 - m_Script: {fileID: 11500000, guid: eeb6a455eb0dfd94aa6bc3484e5fecff, type: 3}  
382 ---- !u!114 &1853098954  
383 -MonoBehaviour: 392 +--- !u!1001 &1733333329
  393 +Prefab:
384 m_ObjectHideFlags: 0 394 m_ObjectHideFlags: 0
385 - m_PrefabParentObject: {fileID: 0}  
386 - m_PrefabInternal: {fileID: 0}  
387 - m_GameObject: {fileID: 1853098951}  
388 - m_Enabled: 1  
389 - m_EditorHideFlags: 0  
390 - m_Script: {fileID: 11500000, guid: 9993e87cd59cf32489da3d2de0ecd84b, type: 3}  
391 - m_Name:  
392 - m_EditorClassIdentifier:  
393 - playerManager: {fileID: 1853098952}  
394 - time: 3  
395 - probability: 0.3 395 + serializedVersion: 2
  396 + m_Modification:
  397 + m_TransformParent: {fileID: 0}
  398 + m_Modifications:
  399 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  400 + propertyPath: m_Animations.Array.size
  401 + value: 41
  402 + objectReference: {fileID: 0}
  403 + - target: {fileID: 400002, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  404 + propertyPath: m_LocalPosition.x
  405 + value: 0
  406 + objectReference: {fileID: 0}
  407 + - target: {fileID: 400002, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  408 + propertyPath: m_LocalPosition.y
  409 + value: 0
  410 + objectReference: {fileID: 0}
  411 + - target: {fileID: 400002, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  412 + propertyPath: m_LocalPosition.z
  413 + value: -2
  414 + objectReference: {fileID: 0}
  415 + - target: {fileID: 400002, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  416 + propertyPath: m_LocalRotation.x
  417 + value: 0
  418 + objectReference: {fileID: 0}
  419 + - target: {fileID: 400002, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  420 + propertyPath: m_LocalRotation.y
  421 + value: 1
  422 + objectReference: {fileID: 0}
  423 + - target: {fileID: 400002, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  424 + propertyPath: m_LocalRotation.z
  425 + value: 0
  426 + objectReference: {fileID: 0}
  427 + - target: {fileID: 400002, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  428 + propertyPath: m_LocalRotation.w
  429 + value: -0.00000016292068
  430 + objectReference: {fileID: 0}
  431 + - target: {fileID: 400002, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  432 + propertyPath: m_RootOrder
  433 + value: 3
  434 + objectReference: {fileID: 0}
  435 + - target: {fileID: 400124, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  436 + propertyPath: m_LocalRotation.x
  437 + value: 0.61669433
  438 + objectReference: {fileID: 0}
  439 + - target: {fileID: 400124, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  440 + propertyPath: m_LocalRotation.y
  441 + value: 0.6080088
  442 + objectReference: {fileID: 0}
  443 + - target: {fileID: 400124, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  444 + propertyPath: m_LocalRotation.z
  445 + value: 0.2701214
  446 + objectReference: {fileID: 0}
  447 + - target: {fileID: 400124, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  448 + propertyPath: m_LocalRotation.w
  449 + value: -0.42077065
  450 + objectReference: {fileID: 0}
  451 + - target: {fileID: 100002, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  452 + propertyPath: m_Name
  453 + value: Avatar
  454 + objectReference: {fileID: 0}
  455 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  456 + propertyPath: m_Animation
  457 + value:
  458 + objectReference: {fileID: 7400000, guid: 35ee7a5071a56c640b2b61ae5973eead, type: 2}
  459 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  460 + propertyPath: m_Animations.Array.data[0]
  461 + value:
  462 + objectReference: {fileID: 7400000, guid: 35ee7a5071a56c640b2b61ae5973eead, type: 2}
  463 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  464 + propertyPath: m_Animations.Array.data[1]
  465 + value:
  466 + objectReference: {fileID: 7400000, guid: d8f000ca18e5a0e4f9171a316b924a3b, type: 2}
  467 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  468 + propertyPath: m_Animations.Array.data[2]
  469 + value:
  470 + objectReference: {fileID: 7400000, guid: 792d3b1f44997994fbd38470b5f868c2, type: 2}
  471 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  472 + propertyPath: m_Animations.Array.data[3]
  473 + value:
  474 + objectReference: {fileID: 7400000, guid: 479af3282b6855e449e35e63adb41da2, type: 2}
  475 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  476 + propertyPath: m_Animations.Array.data[4]
  477 + value:
  478 + objectReference: {fileID: 7400000, guid: d9f262c9534ee6244972a17d67c29b83, type: 2}
  479 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  480 + propertyPath: m_Animations.Array.data[5]
  481 + value:
  482 + objectReference: {fileID: 7400000, guid: 538613ae094f2914ab9f6ec8a697cd5e, type: 2}
  483 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  484 + propertyPath: m_Animations.Array.data[6]
  485 + value:
  486 + objectReference: {fileID: 7400000, guid: d9b0d9978ce268a46becbdd2d2caf90e, type: 2}
  487 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  488 + propertyPath: m_Animations.Array.data[7]
  489 + value:
  490 + objectReference: {fileID: 7400000, guid: 04f57f8f049424247a0d8faaab769985, type: 2}
  491 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  492 + propertyPath: m_Animations.Array.data[8]
  493 + value:
  494 + objectReference: {fileID: 7400000, guid: e8abf409e0a6f27458e2d474e0073f63, type: 2}
  495 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  496 + propertyPath: m_Animations.Array.data[9]
  497 + value:
  498 + objectReference: {fileID: 7400000, guid: 06c0e40f369ab494fb4b1b6516cee9ff, type: 2}
  499 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  500 + propertyPath: m_Animations.Array.data[10]
  501 + value:
  502 + objectReference: {fileID: 7400000, guid: a6764523d031de24386c8992d8b0148a, type: 2}
  503 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  504 + propertyPath: m_Animations.Array.data[11]
  505 + value:
  506 + objectReference: {fileID: 7400000, guid: 25e12e29b690fa24db0698ea457b95ab, type: 2}
  507 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  508 + propertyPath: m_Animations.Array.data[12]
  509 + value:
  510 + objectReference: {fileID: 7400000, guid: 659679ee3e71e1e46ad94c140edf96b1, type: 2}
  511 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  512 + propertyPath: m_Animations.Array.data[13]
  513 + value:
  514 + objectReference: {fileID: 7400000, guid: 82cc47b25dcd647458f3da9451bc8329, type: 2}
  515 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  516 + propertyPath: m_Animations.Array.data[14]
  517 + value:
  518 + objectReference: {fileID: 7400000, guid: 0e708e085310804448d4fe7ab20d1054, type: 2}
  519 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  520 + propertyPath: m_Animations.Array.data[15]
  521 + value:
  522 + objectReference: {fileID: 7400000, guid: 26706413fed069048aaabc7b392c699f, type: 2}
  523 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  524 + propertyPath: m_Animations.Array.data[16]
  525 + value:
  526 + objectReference: {fileID: 7400000, guid: 2afaecc193478e74a976b31fa19bcaa8, type: 2}
  527 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  528 + propertyPath: m_Animations.Array.data[17]
  529 + value:
  530 + objectReference: {fileID: 7400000, guid: 3049e4c690605a1448cf783adc260818, type: 2}
  531 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  532 + propertyPath: m_Animations.Array.data[18]
  533 + value:
  534 + objectReference: {fileID: 7400000, guid: 445d6b38bd83f2944a05f654f03676c2, type: 2}
  535 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  536 + propertyPath: m_Animations.Array.data[19]
  537 + value:
  538 + objectReference: {fileID: 7400000, guid: 464d942596b490249b64f64e22c6ab19, type: 2}
  539 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  540 + propertyPath: m_Animations.Array.data[20]
  541 + value:
  542 + objectReference: {fileID: 7400000, guid: 4c1a3a084aaa38e46975e9ca8fad2dd5, type: 2}
  543 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  544 + propertyPath: m_Animations.Array.data[21]
  545 + value:
  546 + objectReference: {fileID: 7400000, guid: 5434ebcd194f58341ba9a7b3a120649c, type: 2}
  547 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  548 + propertyPath: m_Animations.Array.data[22]
  549 + value:
  550 + objectReference: {fileID: 7400000, guid: 686f09b2b79152f4bb6f0462b9318a2c, type: 2}
  551 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  552 + propertyPath: m_Animations.Array.data[23]
  553 + value:
  554 + objectReference: {fileID: 7400000, guid: 6cdfc8f2c7bd79044a1e44b86fd006ac, type: 2}
  555 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  556 + propertyPath: m_Animations.Array.data[24]
  557 + value:
  558 + objectReference: {fileID: 7400000, guid: 77000653c2e90bc4891d57bf65ebd80f, type: 2}
  559 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  560 + propertyPath: m_Animations.Array.data[25]
  561 + value:
  562 + objectReference: {fileID: 7400000, guid: 78c429ef57436aa42bebcc5ba0238a8a, type: 2}
  563 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  564 + propertyPath: m_Animations.Array.data[26]
  565 + value:
  566 + objectReference: {fileID: 7400000, guid: 82b56df7fb4c2474fa954d8d217d4874, type: 2}
  567 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  568 + propertyPath: m_Animations.Array.data[27]
  569 + value:
  570 + objectReference: {fileID: 7400000, guid: 86cf580ca0d08444693989bf70d4390a, type: 2}
  571 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  572 + propertyPath: m_Animations.Array.data[28]
  573 + value:
  574 + objectReference: {fileID: 7400000, guid: 959c2b9c657b5b949bb5dc6a12b78a42, type: 2}
  575 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  576 + propertyPath: m_Animations.Array.data[29]
  577 + value:
  578 + objectReference: {fileID: 7400000, guid: b98281f0ef5689d42a24663641eb8666, type: 2}
  579 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  580 + propertyPath: m_Animations.Array.data[30]
  581 + value:
  582 + objectReference: {fileID: 7400000, guid: bcb5b826971f467438ab07355237ad23, type: 2}
  583 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  584 + propertyPath: m_Animations.Array.data[31]
  585 + value:
  586 + objectReference: {fileID: 7400000, guid: bd75cc7221b6ef54689b0aed6506c2f3, type: 2}
  587 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  588 + propertyPath: m_Animations.Array.data[32]
  589 + value:
  590 + objectReference: {fileID: 7400000, guid: c461e1a2c8d5b4b4ba25eae95d4304b8, type: 2}
  591 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  592 + propertyPath: m_Animations.Array.data[33]
  593 + value:
  594 + objectReference: {fileID: 7400000, guid: caf9b70dfccae734197c871d778b7387, type: 2}
  595 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  596 + propertyPath: m_Animations.Array.data[34]
  597 + value:
  598 + objectReference: {fileID: 7400000, guid: cb2ba4c4e0b1f8e4da2512e403510364, type: 2}
  599 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  600 + propertyPath: m_Animations.Array.data[35]
  601 + value:
  602 + objectReference: {fileID: 7400000, guid: d7b55d01eaa71f240bfa1b5274250757, type: 2}
  603 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  604 + propertyPath: m_Animations.Array.data[36]
  605 + value:
  606 + objectReference: {fileID: 7400000, guid: dd71fb38e3865c34bbe898cb661da9ab, type: 2}
  607 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  608 + propertyPath: m_Animations.Array.data[37]
  609 + value:
  610 + objectReference: {fileID: 7400000, guid: e422f6e6a13f6114fb6a40cc691c71df, type: 2}
  611 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  612 + propertyPath: m_Animations.Array.data[38]
  613 + value:
  614 + objectReference: {fileID: 7400000, guid: ef4ef0a64c4fc684295a28cec1a32a72, type: 2}
  615 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  616 + propertyPath: m_Animations.Array.data[39]
  617 + value:
  618 + objectReference: {fileID: 7400000, guid: ef7413ebb20766c49b1bd92d5fec878b, type: 2}
  619 + - target: {fileID: 11100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  620 + propertyPath: m_Animations.Array.data[40]
  621 + value:
  622 + objectReference: {fileID: 7400000, guid: b4cddd8331fe7f547ae2a4cae99d96f1, type: 2}
  623 + - target: {fileID: 13700004, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  624 + propertyPath: m_Materials.Array.data[0]
  625 + value:
  626 + objectReference: {fileID: 2100000, guid: f59307a7307ee684c9b51e79ef13b71c, type: 2}
  627 + - target: {fileID: 13700002, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  628 + propertyPath: m_Materials.Array.data[0]
  629 + value:
  630 + objectReference: {fileID: 2100000, guid: fd6cc31e0eefe15409b9165f257181d0, type: 2}
  631 + - target: {fileID: 13700000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  632 + propertyPath: m_Materials.Array.data[1]
  633 + value:
  634 + objectReference: {fileID: 2100000, guid: fd6cc31e0eefe15409b9165f257181d0, type: 2}
  635 + - target: {fileID: 13700000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  636 + propertyPath: m_Materials.Array.data[0]
  637 + value:
  638 + objectReference: {fileID: 2100000, guid: 3e98fe09c9ac4ae4dbe731872ff7687a, type: 2}
  639 + - target: {fileID: 13700016, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  640 + propertyPath: m_Materials.Array.data[0]
  641 + value:
  642 + objectReference: {fileID: 2100000, guid: 3e98fe09c9ac4ae4dbe731872ff7687a, type: 2}
  643 + - target: {fileID: 13700014, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  644 + propertyPath: m_Materials.Array.data[0]
  645 + value:
  646 + objectReference: {fileID: 2100000, guid: 3e98fe09c9ac4ae4dbe731872ff7687a, type: 2}
  647 + - target: {fileID: 13700012, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  648 + propertyPath: m_Materials.Array.data[1]
  649 + value:
  650 + objectReference: {fileID: 2100000, guid: 2ea2853b4c338874ead33e59c519216c, type: 2}
  651 + - target: {fileID: 13700006, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  652 + propertyPath: m_Materials.Array.data[0]
  653 + value:
  654 + objectReference: {fileID: 2100000, guid: 1e19ab6c967fd3348be10315b0d06b1b, type: 2}
  655 + - target: {fileID: 100002, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  656 + propertyPath: m_TagString
  657 + value: avatar
  658 + objectReference: {fileID: 0}
  659 + m_RemovedComponents: []
  660 + m_ParentPrefab: {fileID: 100100000, guid: 714c639770278b249bb7d0850bac50fc, type: 3}
  661 + m_IsPrefabParent: 0
396 --- !u!1001 &2002657203 662 --- !u!1001 &2002657203
397 Prefab: 663 Prefab:
398 m_ObjectHideFlags: 0 664 m_ObjectHideFlags: 0
Assets/Scripts/CameraCapture.cs 0 → 100644
@@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
  1 +using UnityEngine;
  2 +using System;
  3 +using System.Threading;
  4 +
  5 +public class CameraCapture : MonoBehaviour
  6 +{
  7 + public static bool capture = false;
  8 +
  9 + // The folder we place all screenshots inside.
  10 + // If the folder exists we will append numbers to create an empty folder.
  11 + public string folder = "ScreenCaptures";
  12 + public static int frameRate = 30;
  13 + public int sizeMultiplier = 1;
  14 + //string[] strArg;
  15 + public static int frameNumber = 0;
  16 +
  17 + void Start()
  18 + {
  19 + string[] strArg = Environment.GetCommandLineArgs();
  20 +
  21 + if (strArg.Length >= 2)
  22 + folder = strArg[1];
  23 +
  24 + // Create the folder
  25 + folder = Application.persistentDataPath + "/" + folder;
  26 + System.IO.Directory.CreateDirectory(folder);
  27 + Debug.Log("ScreenCaptures to " + folder);
  28 +
  29 + if (strArg.Length >= 4)
  30 + frameRate = int.Parse(strArg[3]);
  31 +
  32 + Time.captureFramerate = frameRate;
  33 + }
  34 +
  35 + void Update()
  36 + {
  37 + if (capture)
  38 + {
  39 + var name = string.Format("{0}/frame_{1}.png", folder, frameNumber++); // Time.frameCount);
  40 + Application.CaptureScreenshot(name, sizeMultiplier);
  41 + }
  42 + }
  43 +
  44 +} // class
  45 +
Assets/Scripts/CameraCapture.cs.meta 0 → 100644
@@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
  1 +fileFormatVersion: 2
  2 +guid: da8d7baf88931274abdb48afffacd98d
  3 +timeCreated: 1444936132
  4 +licenseType: Pro
  5 +MonoImporter:
  6 + serializedVersion: 2
  7 + defaultReferences: []
  8 + executionOrder: 0
  9 + icon: {instanceID: 0}
  10 + userData:
  11 + assetBundleName:
  12 + assetBundleVariant:
Assets/Scripts/FacialExpressions.js.meta
1 fileFormatVersion: 2 1 fileFormatVersion: 2
2 guid: 701cf09d2ce13d246afd85b88eb177ca 2 guid: 701cf09d2ce13d246afd85b88eb177ca
3 -timeCreated: 1461080653 3 +timeCreated: 1461097232
4 licenseType: Pro 4 licenseType: Pro
5 MonoImporter: 5 MonoImporter:
6 serializedVersion: 2 6 serializedVersion: 2
Assets/Scripts/GenericPlayerManager.cs
@@ -1,705 +0,0 @@ @@ -1,705 +0,0 @@
1 -/** Gerenciador genérico e principal dos players.  
2 - *  
3 - * Versão 2.1  
4 - * - Acompanhamento da legenda  
5 - * Corrigido problema na soletração quando a velocidade ultrapassava ~1.  
6 - *  
7 - * Versão 2.2  
8 - * - Acompanhamento da legenda  
9 - * Corrigido problema na soletração quando o estado muda para pausado.  
10 - *  
11 - * Versão 2.3  
12 - * - Legenda  
13 - * A letras acentuadas reproduzem a mesma sem o acento.  
14 - *  
15 - * Versão 2.4  
16 - * - Legenda  
17 - * "Ç" reproduz "C".  
18 - * - Reprodução  
19 - * Quando não há acesso aos bundles dos sinais de pontuação, eles são ignorados.  
20 - * Ç adicionado como TYPE_WORD.  
21 - */  
22 -  
23 -//Log Dir http://docs.unity3d.com/Manual/LogFiles.html  
24 -using UnityEngine;  
25 -using System.Collections;  
26 -using System.Collections.Generic;  
27 -using System;  
28 -using System.Threading;  
29 -using System.IO;  
30 -using System.Text;  
31 -using System.Runtime.InteropServices;  
32 -using UnityEngine.UI;  
33 -  
34 -public abstract class GenericPlayerManager : MonoBehaviour {  
35 -  
36 - private const string DEFAULT_ANIMATION = "_default";  
37 - private const string DEFAULT_ANIMATION_MIDDLE = "_default_middle";  
38 -  
39 - public float fadeLength = 0.6F;  
40 - public string gloss = "";  
41 -  
42 - // Referencia para o avatar  
43 - private GameObject AVATAR;  
44 - // Referencia para o componente animador do avatar  
45 - private Animation COMPONENT_ANIMATION;  
46 - public Text SUBTITLES;  
47 -  
48 - // Guarda os nomes das palavras já carregadas  
49 - private HashSet<string> loadedAssetBundles = new HashSet<string>();  
50 - // Guarda os nomes das palavras que não tem assetbundle  
51 - private HashSet<string> nonexistentAssetBundles = new HashSet<string>();  
52 -  
53 - // Fila de animações para reprodução  
54 - // Utilizada para alterar velocidade e apresentar a legenda  
55 - private Queue<AnimationReference> animQueue = new Queue<AnimationReference>();  
56 -  
57 - // Sinais de intervalo de animações: não sinaliza reprodução na UI  
58 - private HashSet<string> intervalAnimations = new HashSet<string>();  
59 - // Sinais ignorados na apresentação de legenda  
60 - private HashSet<string> flags = new HashSet<string>();  
61 -  
62 - // True quando está na função LoadAndPlay  
63 - private volatile bool loading = false;  
64 - // True quando está reproduzindo qualquer animação  
65 - private volatile bool playing = false;  
66 - // True quando é chamada a função de pausa  
67 - private volatile bool paused = false;  
68 -  
69 - // Se diferente de null, não está reproduzindo animação de intervalo  
70 - private AnimationState intervalAnimationState = null;  
71 - // Usado para pausar quando comandado  
72 - private AnimationReference animationPlaying = null;  
73 -  
74 - // Gerenciador de animações de intervalo  
75 - public RandomAnimations randomAnimations;  
76 - // Gerenciador de legendas  
77 - public Subtitle subtitles = null;  
78 -  
79 - private bool[] lastLetterAnimations = new bool[256];  
80 -  
81 - public virtual void Start()  
82 - {  
83 - // Configuração de velocidade das animações  
84 - subtitles = new Subtitle(SUBTITLES);  
85 - subtitles.DefaultWordSpeed = new DefaultSignSpeed();  
86 - subtitles.DefaultFirstLetterSpeed = new DefaultSignSpeed(2.1F, 2.8F);  
87 - subtitles.DefaultLetterSpeed = new DefaultSignSpeed(3F, 4.3F);  
88 - subtitles.DefaultNumberSpeed = new DefaultSignSpeed(1.5F, 2.9F);  
89 -  
90 - AVATAR = GameObject.FindGameObjectWithTag("avatar");  
91 - COMPONENT_ANIMATION = AVATAR.GetComponent<Animation>();  
92 -  
93 - // Sinais ignorados na legenda  
94 - string[] flags = new string[] {  
95 - "[PONTO]",  
96 - "[INTERROGAÇÃO]",  
97 - "[EXCLAMAÇÃO]"  
98 - };  
99 - foreach (string flag in flags)  
100 - this.flags.Add(flag);  
101 -  
102 - string[] preloadedAnims = new string[] {  
103 - "A", "B", "C", "Ç", "D", "E", "F", "G", "H", "I",  
104 - "J", "K", "L", "M", "N", "O", "P", "Q", "R",  
105 - "S", "T", "U", "V", "W", "X", "Y", "Z",  
106 - "0", "1", "2", "3", "4",  
107 - "5", "6", "7", "8", "9",  
108 - ","  
109 - };  
110 -  
111 - // Duplica sinais para diferenciar quando há repetidos  
112 - foreach (string anim in preloadedAnims)  
113 - COMPONENT_ANIMATION.AddClip(COMPONENT_ANIMATION[anim].clip, "d_" + anim);  
114 -  
115 - foreach (string anim in preloadedAnims)  
116 - this.loadedAssetBundles.Add(anim);  
117 -  
118 - // Cria novo _default chamado _default_middle para pausas dentro de uma glosa  
119 - // Impede que a animação default seja confundida com não-reprodução na UI  
120 - COMPONENT_ANIMATION.AddClip(COMPONENT_ANIMATION[DEFAULT_ANIMATION].clip, DEFAULT_ANIMATION_MIDDLE);  
121 - }  
122 -  
123 - public bool isPlayingIntervalAnimation() { return intervalAnimationState != null; }  
124 - public bool isLoading() { return loading; }  
125 - public bool isPlaying() { return playing; }  
126 - public bool isPaused() { return paused; }  
127 - public bool isRepeatable() { return ! String.IsNullOrEmpty(gloss); }  
128 -  
129 - public virtual void setSubtitle(string text) {  
130 - this.subtitles.setText(text);  
131 - }  
132 -  
133 - /* Configura as animações de intervalo */  
134 - public void setRandomAnimations(string[] intervalAnimations)  
135 - {  
136 - foreach (string name in intervalAnimations)  
137 - {  
138 - this.intervalAnimations.Add(name);  
139 - this.loadedAssetBundles.Add(name);  
140 - }  
141 -  
142 - this.randomAnimations.setAnimations(intervalAnimations);  
143 - }  
144 -  
145 - /* Define a velocidade das animacões com base no slider da GUI */  
146 - public void setSlider(float sliderPosition)  
147 - {  
148 - subtitles.SliderPosition = sliderPosition;  
149 - subtitles.updateWordSpeed();  
150 - subtitles.updateLetterSpeed();  
151 - subtitles.updateNumberSpeed();  
152 -  
153 - // Altera a velocidade de todas as animações em reprodução  
154 - if ( ! paused) lock (this.animQueue)  
155 - {  
156 - foreach (AnimationReference reference in this.animQueue)  
157 - if (reference.type != Subtitle.TYPE_NONE && reference.state != null)  
158 - reference.state.speed = getSpeedByType(reference.type);  
159 - }  
160 - }  
161 -  
162 - /* Retorna a velocidade para o tipo */  
163 - private float getSpeedByType(short type)  
164 - {  
165 - switch (type)  
166 - {  
167 - case Subtitle.TYPE_WORD: return subtitles.WordSpeed;  
168 - case Subtitle.TYPE_LETTER: return subtitles.LetterSpeed;  
169 - case Subtitle.TYPE_NUMBER: return subtitles.NumberSpeed;  
170 - }  
171 -  
172 - return 2F;  
173 - }  
174 -  
175 - /* Para carregamento e animações */  
176 - public void stopAll()  
177 - {  
178 - StopCoroutine("loadAndPlay");  
179 - this.randomAnimations.unlockFor("loadAndPlay");  
180 - loading = false;  
181 -  
182 - stopAnimations();  
183 - }  
184 -  
185 - /* Para animações */  
186 - public void stopAnimations()  
187 - {  
188 - StopCoroutine("handleStates");  
189 - this.randomAnimations.unlockFor("handleStates");  
190 - this.subtitles.setText("");  
191 -  
192 - lock (this.animQueue) { this.animQueue.Clear(); }  
193 - COMPONENT_ANIMATION.CrossFadeQueued(DEFAULT_ANIMATION, fadeLength, QueueMode.PlayNow);  
194 -  
195 - resetStates();  
196 - }  
197 -  
198 - /* Repete animações */  
199 - public void repeat() {  
200 - repeat(true);  
201 - }  
202 -  
203 - /* Repete animações se now == true ou se não estiver carregando glosa */  
204 - public void repeat(bool now)  
205 - {  
206 - if (now || ! this.loading)  
207 - playNow(this.gloss);  
208 - }  
209 -  
210 - /* Manda reproduzir animação e adiciona a file de animações a serem reproduzidas */  
211 - private AnimationState playAnimation(short type, string name, string subtitle, float speed)  
212 - {  
213 - try  
214 - {  
215 - AnimationState state = COMPONENT_ANIMATION.CrossFadeQueued(name, fadeLength, QueueMode.CompleteOthers);  
216 - state.speed = speed;  
217 -  
218 - lock (this.animQueue) {  
219 - this.animQueue.Enqueue(new AnimationReference(name, subtitle, state, type));  
220 - }  
221 -  
222 - return state;  
223 - }  
224 - catch (NullReferenceException nre) {  
225 - UnityEngine.Debug.Log("'" + name + "' não foi encontrado!\n" + nre.ToString());  
226 - }  
227 -  
228 - return null;  
229 - }  
230 - private AnimationState playAnimation(short type, string name, string subtitle) {  
231 - return playAnimation(type, name, subtitle, getSpeedByType(type));  
232 - }  
233 - private AnimationState playAnimation(short type, string name) {  
234 - return playAnimation(type, name, name);  
235 - }  
236 -  
237 - /* Enfileira em reprodução a animação de intervalo */  
238 - private void playDefaultAnimation() {  
239 - playDefaultAnimation(false);  
240 - }  
241 -  
242 - /* Enfileira em reprodução a animação padrão se now == true, ou reproduz imediatamente */  
243 - private void playDefaultAnimation(bool now) {  
244 - COMPONENT_ANIMATION.CrossFadeQueued(DEFAULT_ANIMATION, fadeLength, now ? QueueMode.PlayNow : QueueMode.CompleteOthers);  
245 - }  
246 -  
247 -  
248 - /**  
249 - * Returns the asset bundle named aniName.  
250 - *  
251 - * @return AssetBundle - se for encontrado.  
252 - * null - se ocorrer num erro.  
253 - */  
254 - public abstract WWW loadAssetBundle(string aniName);  
255 -  
256 - /**  
257 - * Listen to changes in the playing status.  
258 - */  
259 - public abstract void onConnectionError(string gloss, string word);  
260 -  
261 - /**  
262 - * Listen to changes in the playing status.  
263 - */  
264 - public abstract void onPlayingStateChange();  
265 -  
266 -  
267 - /* Pause or continue animations */  
268 - public void setPauseState(bool paused)  
269 - {  
270 - if (this.paused != paused)  
271 - {  
272 - this.paused = paused;  
273 -  
274 - lock (this.animQueue)  
275 - {  
276 - if (this.animationPlaying != null && this.animationPlaying.state != null)  
277 - this.animationPlaying.state.speed = paused ? 0F : getSpeedByType(this.animationPlaying.type);  
278 -  
279 - foreach (AnimationReference reference in this.animQueue)  
280 - if (reference.state != null)  
281 - reference.state.speed = paused ? 0F : getSpeedByType(reference.type);  
282 - }  
283 - }  
284 -  
285 - onPlayingStateChange();  
286 - }  
287 -  
288 - public void setAnimationEnabled(bool enabled) {  
289 - COMPONENT_ANIMATION.enabled = enabled;  
290 - }  
291 -  
292 - /* Pause or continue animations */  
293 - public void switchPauseState() {  
294 - setPauseState( ! this.paused);  
295 - }  
296 -  
297 - private System.Object LOCKER_PLAY = new System.Object();  
298 -  
299 - /* Reproduz apenas se não houver algo sendo carregado ou rerpoduzido */  
300 - public bool playIfEmpty(string gloss)  
301 - {  
302 - lock (LOCKER_PLAY)  
303 - {  
304 - if (this.loading || this.playing)  
305 - return false;  
306 -  
307 - StartCoroutine("loadAndPlay", gloss);  
308 - }  
309 -  
310 - return true;  
311 - }  
312 -  
313 - /* Enfieira animações para reprodução */  
314 - public void playQueued(string gloss)  
315 - {  
316 - lock (LOCKER_PLAY)  
317 - {  
318 - Debug.Log("GPM:pQ(" + gloss + ")");  
319 - StartCoroutine("loadAndPlay", gloss);  
320 - }  
321 - }  
322 -  
323 - /* Para todas as animações, limpa a fila e reproduz */  
324 - public void playNow(string gloss)  
325 - {  
326 - lock (LOCKER_PLAY)  
327 - {  
328 - stopAll();  
329 - StartCoroutine("loadAndPlay", gloss);  
330 - }  
331 - }  
332 -  
333 - /* Reproduz animação de intervalo */  
334 - public bool playIntervalAnimation(string name)  
335 - {  
336 - if ( ! Monitor.TryEnter(LOCKER_PLAY))  
337 - return false;  
338 -  
339 - lock (LOCKER_PLAY)  
340 - {  
341 - playDefaultAnimation(true);  
342 - this.intervalAnimationState = COMPONENT_ANIMATION.CrossFadeQueued(name, fadeLength, QueueMode.CompleteOthers);  
343 - playDefaultAnimation(false);  
344 - }  
345 -  
346 - return true;  
347 - }  
348 -  
349 - private string nextLetterAnimation(char letter)  
350 - {  
351 - string animation = (this.lastLetterAnimations[letter] ? "" : "d_") + letter.ToString();  
352 - this.lastLetterAnimations[letter] = ! this.lastLetterAnimations[letter];  
353 -  
354 - return animation;  
355 - }  
356 -  
357 - private static short getType(char c)  
358 - {  
359 - // Se for uma letra  
360 - if (c >= 65 && c <= 90)  
361 - return Subtitle.TYPE_LETTER;  
362 -  
363 - // Se for um número  
364 - else if (c >= 48 && c <= 57)  
365 - return Subtitle.TYPE_NUMBER;  
366 -  
367 - // Se for uma vírgula  
368 - else if (c == 44 || c == 'Ç')  
369 - return Subtitle.TYPE_WORD;  
370 -  
371 - else  
372 - return Subtitle.TYPE_NONE;  
373 - }  
374 -  
375 - /* Enfileira soletração de palavra */  
376 - private string spellWord(Queue<ToPlay> toPlayQueue, string word)  
377 - {  
378 - string lastAnimationSubtitle = "";  
379 - bool defaultPlayed = false;  
380 -  
381 - // A reprodução da primeira letra deve ser longa para não ser cortada no fade  
382 - this.subtitles.updateLetterSpeed();  
383 -  
384 - for (int i = 0; i < word.Length; i++)  
385 - {  
386 - lastAnimationSubtitle = Subtitle.highlight(word, i);  
387 - char anim = word[i];  
388 -  
389 - switch (word[i])  
390 - {  
391 - case 'Á':  
392 - case 'Â':  
393 - case 'À':  
394 - case 'Ã': anim = 'A';  
395 - break;  
396 - case 'É':  
397 - case 'Ê': anim = 'E';  
398 - break;  
399 - case 'Í': anim = 'I';  
400 - break;  
401 - case 'Ó':  
402 - case 'Ô':  
403 - case 'Õ': anim = 'O';  
404 - break;  
405 - case 'Ú': anim = 'U';  
406 - break;  
407 - }  
408 -  
409 - short type = getType(anim);  
410 - string animName = nextLetterAnimation(anim);  
411 -  
412 - // Não há animação  
413 - if (type == Subtitle.TYPE_NONE)  
414 - {  
415 - // Reproduz animação default apenas uma vez  
416 - if ( ! defaultPlayed)  
417 - {  
418 - defaultPlayed = true;  
419 - toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_WORD, DEFAULT_ANIMATION_MIDDLE, lastAnimationSubtitle, this));  
420 -  
421 - // A reprodução da próxima letra deve ser longa para não ser cortada no fade  
422 - this.subtitles.updateLetterSpeed();  
423 - }  
424 -  
425 - UnityEngine.Debug.Log("Animação \"" + animName + "\" inexistente.");  
426 - }  
427 - else  
428 - {  
429 - toPlayQueue.Enqueue(new ToPlay(type, animName, lastAnimationSubtitle, this));  
430 -  
431 - defaultPlayed = false;  
432 - this.subtitles.updateLetterSpeed();  
433 - }  
434 - }  
435 -  
436 - return lastAnimationSubtitle;  
437 - }  
438 -  
439 - /* Instruções para reprodução de aninmação */  
440 - private struct ToPlay  
441 - {  
442 - private short type;  
443 - private string name;  
444 - private string subtitle;  
445 - private float speed;  
446 -  
447 - public ToPlay(short type, string name, string subtitle, float speed)  
448 - {  
449 - this.type = type;  
450 - this.name = name;  
451 - this.subtitle = subtitle;  
452 - this.speed = speed;  
453 - }  
454 - public ToPlay(short type, string name, string subtitle, GenericPlayerManager context)  
455 - : this(type, name, subtitle, 0F) {  
456 - this.speed = context.getSpeedByType(type);  
457 - }  
458 - public ToPlay(short type, string name, GenericPlayerManager context)  
459 - : this(type, name, name, context) { }  
460 -  
461 - public void play(GenericPlayerManager context) {  
462 - context.playAnimation(this.type, this.name, this.subtitle, this.speed);  
463 - }  
464 - }  
465 -  
466 - private System.Object LOCKER_LOADING = new System.Object();  
467 -  
468 - /* Carrega animações e reproduz */  
469 - private IEnumerator loadAndPlay(string gloss)  
470 - {  
471 - lock (LOCKER_LOADING)  
472 - {  
473 - Debug.Log("GPM:lAP(" + gloss + ")");  
474 - this.randomAnimations.lockFor("loadAndPlay");  
475 - this.loading = true;  
476 - // onPlayingStateChange();  
477 -  
478 - string lastAnimationSubtitle = "";  
479 - bool spelled = false;  
480 -  
481 - if ( ! this.playing)  
482 - StartCoroutine("handleStates");  
483 -  
484 - String[] stringPos = gloss.Split(' ');  
485 -  
486 - Queue<ToPlay> toPlayQueue = new Queue<ToPlay>();  
487 - int wordsCount = 0;  
488 - toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION, "", this));  
489 -  
490 - foreach (string aniName in stringPos)  
491 - {  
492 - wordsCount++;  
493 - if (String.IsNullOrEmpty(aniName)) continue;  
494 -  
495 - bool nonexistent = nonexistentAssetBundles.Contains(aniName);  
496 - bool loaded = loadedAssetBundles.Contains(aniName);  
497 -  
498 - if ( ! nonexistent && ! loaded)  
499 - {  
500 - // Função loadAssetBundle é definida pela classe filha  
501 - WWW www = loadAssetBundle(aniName);  
502 -  
503 - if (www != null)  
504 - {  
505 - Debug.Log("GPM:lAP(" + gloss + "): www != null");  
506 - yield return www;  
507 -  
508 - AssetBundle bundle = null;  
509 -  
510 - if (www.error == null)  
511 - {  
512 - Debug.Log("GPM:lAP(" + gloss + "): www.error == null");  
513 - bundle = www.assetBundle;  
514 -  
515 - if (bundle != null && ! String.IsNullOrEmpty(bundle.mainAsset.name))  
516 - {  
517 - AnimationClip aniClip = bundle.mainAsset as AnimationClip;  
518 - bundle.Unload(false);  
519 -  
520 - if (aniClip)  
521 - {  
522 - COMPONENT_ANIMATION.AddClip(aniClip, aniName);  
523 -  
524 - loadedAssetBundles.Add(aniName);  
525 - loaded = true;  
526 -  
527 - Debug.Log("GPM:lAP(" + gloss + "): Bundle \"" + aniName + "\" loaded!");  
528 - }  
529 - else UnityEngine.Debug.Log ("GPM:lAP(" + gloss + "): Sinal \"" + aniName + "\" foi não carregado corretamente.");  
530 - }  
531 - }  
532 - else onConnectionError(gloss, aniName);  
533 - }  
534 - else onConnectionError(gloss, aniName);  
535 - }  
536 -  
537 - // Reproduz palavra  
538 - if (loaded)  
539 - {  
540 - if (spelled)  
541 - {  
542 - // Default  
543 - toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION, lastAnimationSubtitle, this));  
544 - spelled = false;  
545 - }  
546 -  
547 - if (this.flags.Contains(aniName) || this.intervalAnimations.Contains(aniName))  
548 - {  
549 - lastAnimationSubtitle = "";  
550 - toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_WORD, aniName, "", this));  
551 - }  
552 - else  
553 - {  
554 - lastAnimationSubtitle = aniName;  
555 - toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_WORD, aniName, this));  
556 - }  
557 - }  
558 -  
559 - // Soletra palavra  
560 - else  
561 - {  
562 - // Se a animação não foi carregada e nem está marcada como não existente,  
563 - // adiciona ao set de animações não existentes  
564 - if ( ! nonexistent)  
565 - nonexistentAssetBundles.Add(aniName);  
566 -  
567 - UnityEngine.Debug.Log("GPM:lAP(" + gloss + "): To spell: " + aniName);  
568 -  
569 - if (this.flags.Contains(aniName) || this.intervalAnimations.Contains(aniName))  
570 - {  
571 - toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION_MIDDLE, "", 1.6F));  
572 - spelled = false;  
573 - }  
574 - else  
575 - {  
576 - // Se já houve o soletramento de alguma palavra, reproduz animação default  
577 - if (spelled)  
578 - toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION_MIDDLE, "", 1.6F));  
579 - else  
580 - spelled = true;  
581 -  
582 - lastAnimationSubtitle = spellWord(toPlayQueue, aniName);  
583 - }  
584 - }  
585 -  
586 - if (toPlayQueue.Count > 4 || wordsCount == stringPos.Length)  
587 - while (toPlayQueue.Count > 0)  
588 - toPlayQueue.Dequeue().play(this);  
589 - }  
590 -  
591 - // Default  
592 - playAnimation(Subtitle.TYPE_NONE, DEFAULT_ANIMATION, "");  
593 -  
594 - this.loading = false;  
595 - // onPlayingStateChange();  
596 - this.randomAnimations.unlockFor("loadAndPlay");  
597 - }  
598 - }  
599 -  
600 - private System.Object LOCKER_PLAYING = new System.Object();  
601 -  
602 - /* Sincroniza as legendas com as animações. */  
603 - IEnumerator handleStates()  
604 - {  
605 - lock (LOCKER_PLAYING)  
606 - {  
607 - UnityEngine.Debug.Log("GPM:hS()");  
608 -  
609 - this.randomAnimations.lockFor("handleStates");  
610 - this.playing = true;  
611 - onPlayingStateChange();  
612 -  
613 - bool isNotEmpty;  
614 - lock (this.animQueue) { isNotEmpty = this.animQueue.Count > 0; }  
615 -  
616 - // Animação anterior a atual  
617 - AnimationReference endedAnimation = null;  
618 -  
619 - // Enquanto estiver executando a corotina "loadAndPlay"  
620 - // ou existir animações na fila de reprodução  
621 - while (loading || isNotEmpty)  
622 - {  
623 - // Se não houver animações na fila, espera  
624 - if (isNotEmpty)  
625 - {  
626 - // Pega primeira animação  
627 - AnimationReference reference;  
628 - lock (this.animQueue) { reference = this.animQueue.Peek(); }  
629 -  
630 - // Se estiver sendo reproduzida  
631 - if (COMPONENT_ANIMATION.IsPlaying(reference.name))  
632 - {  
633 - Debug.Log("GPM:hS(): Playing " + reference.name);  
634 - this.subtitles.setText(reference.subtitle);  
635 -  
636 - // Animação seguinte  
637 - AnimationReference next = null;  
638 - lock (this.animQueue)  
639 - {  
640 - this.animationPlaying = this.animQueue.Dequeue();  
641 -  
642 - if (this.animQueue.Count > 0)  
643 - next = this.animQueue.Peek();  
644 - }  
645 -  
646 - while (true)  
647 - {  
648 - // Se a próxima animação estiver sendo reproduzida (no fade)  
649 - if (next != null && COMPONENT_ANIMATION.IsPlaying(next.name))  
650 - {  
651 - // Se a animação anterior a atual não tiver acabado,  
652 - // espera acabar e só então conta o tempo  
653 - if (endedAnimation != null)  
654 - while (COMPONENT_ANIMATION.IsPlaying(endedAnimation.name))  
655 - yield return null;  
656 -  
657 - // Tempo para pular para a legenda da próxima animação  
658 - yield return new WaitForSeconds(0.4F);  
659 -  
660 - // Deprecated  
661 - // yield return WaitForContinuousMillis.Wait(this, 300);  
662 -  
663 - endedAnimation = reference;  
664 - break;  
665 - }  
666 -  
667 - else if (COMPONENT_ANIMATION.IsPlaying(reference.name))  
668 - yield return null;  
669 -  
670 - else break;  
671 - }  
672 -  
673 - reference = null;  
674 - }  
675 -  
676 - // Se a animação não tiver sido liberada e seu AnimationState for nulo,  
677 - // a animação será liberada  
678 - if (reference != null && reference.state == null)  
679 - lock (this.animQueue) { this.animQueue.Dequeue(); }  
680 - else  
681 - yield return null;  
682 - }  
683 - else yield return null;  
684 -  
685 - lock (this.animQueue) { isNotEmpty = this.animQueue.Count > 0; }  
686 - }  
687 - UnityEngine.Debug.Log("GPM:sH(): All done.");  
688 -  
689 - this.subtitles.setText("");  
690 -  
691 - resetStates();  
692 - this.randomAnimations.unlockFor("handleStates");  
693 - }  
694 - }  
695 -  
696 - public void resetStates()  
697 - {  
698 - this.animationPlaying = null;  
699 - this.playing = false;  
700 - this.paused = false;  
701 -  
702 - onPlayingStateChange();  
703 - }  
704 -  
705 -}  
Assets/Scripts/GenericPlayerManager.cs.meta
@@ -1,12 +0,0 @@ @@ -1,12 +0,0 @@
1 -fileFormatVersion: 2  
2 -guid: 953c1d9124325ab4099d246d3cbfb780  
3 -timeCreated: 1440187017  
4 -licenseType: Pro  
5 -MonoImporter:  
6 - serializedVersion: 2  
7 - defaultReferences: []  
8 - executionOrder: 0  
9 - icon: {instanceID: 0}  
10 - userData:  
11 - assetBundleName:  
12 - assetBundleVariant:  
Assets/Scripts/Message.cs 0 → 100644
@@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
  1 +using System;
  2 +
  3 +public class Message {
  4 +
  5 + private string text = "";
  6 + private long time = 0;
  7 +
  8 + public Message(string message)
  9 + {
  10 + string[] tokens = message.Split('#');
  11 +
  12 + if (tokens.Length > 0)
  13 + {
  14 + this.text = tokens[0];
  15 +
  16 + if (tokens.Length > 1)
  17 + this.time = Int64.Parse(tokens[1]);
  18 + }
  19 + }
  20 +
  21 + public string Text { get { return text; } }
  22 + public long Time { get { return time; } }
  23 +
  24 +}
0 \ No newline at end of file 25 \ No newline at end of file
Assets/Scripts/Message.cs.meta 0 → 100644
@@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
  1 +fileFormatVersion: 2
  2 +guid: a20a670dddb80ae409e79be805b6a1e9
  3 +timeCreated: 1445377277
  4 +licenseType: Pro
  5 +MonoImporter:
  6 + serializedVersion: 2
  7 + defaultReferences: []
  8 + executionOrder: 0
  9 + icon: {instanceID: 0}
  10 + userData:
  11 + assetBundleName:
  12 + assetBundleVariant:
Assets/Scripts/PlayerManager.cs
@@ -13,6 +13,8 @@ public class PlayerManager : GenericPlayerManager { @@ -13,6 +13,8 @@ public class PlayerManager : GenericPlayerManager {
13 13
14 private Server server = null; 14 private Server server = null;
15 private Semaphore serverSemaphore = null; 15 private Semaphore serverSemaphore = null;
  16 +
  17 + private volatile Queue<Message> messages = new Queue<Message>();
16 private volatile bool toFinalize = false; 18 private volatile bool toFinalize = false;
17 19
18 public override void Start() 20 public override void Start()
@@ -20,9 +22,12 @@ public class PlayerManager : GenericPlayerManager { @@ -20,9 +22,12 @@ public class PlayerManager : GenericPlayerManager {
20 base.Start(); 22 base.Start();
21 string[] args = Environment.GetCommandLineArgs(); 23 string[] args = Environment.GetCommandLineArgs();
22 24
23 - if (args.Length >= 2) 25 + if (args.Length >= 5)
24 { 26 {
25 - float speedRate = (int.Parse(args[1]) + 100F) / 100F; 27 + float speedRate = (int.Parse(args[4]) + 100F) / 100F;
  28 +
  29 + if (speedRate > 100)
  30 + base.fadeLength = 0.5F;
26 31
27 DefaultSignSpeed ds = base.subtitles.DefaultWordSpeed; 32 DefaultSignSpeed ds = base.subtitles.DefaultWordSpeed;
28 base.subtitles.DefaultWordSpeed = new DefaultSignSpeed( 33 base.subtitles.DefaultWordSpeed = new DefaultSignSpeed(
@@ -30,33 +35,26 @@ public class PlayerManager : GenericPlayerManager { @@ -30,33 +35,26 @@ public class PlayerManager : GenericPlayerManager {
30 ds.Max * speedRate 35 ds.Max * speedRate
31 ); 36 );
32 } 37 }
33 - if (args.Length >= 3) 38 +
  39 + if (args.Length >= 6)
34 { 40 {
35 - float speedRate = (int.Parse(args[2]) + 100F) / 100F; 41 + float speedRate = (int.Parse(args[5]) + 100F) / 100F;
36 42
37 - DefaultSignSpeed ds = base.subtitles.DefaultLetterSpeed;  
38 - base.subtitles.DefaultLetterSpeed = new DefaultSignSpeed(  
39 - ds.Speed * speedRate,  
40 - ds.Max * speedRate  
41 - ); 43 + if (speedRate > 100F)
  44 + base.fadeLength = 0.5F;
42 45
43 - ds = base.subtitles.DefaultFirstLetterSpeed; 46 + DefaultSignSpeed ds = base.subtitles.DefaultFirstLetterSpeed;
44 base.subtitles.DefaultFirstLetterSpeed = new DefaultSignSpeed( 47 base.subtitles.DefaultFirstLetterSpeed = new DefaultSignSpeed(
45 ds.Speed * speedRate, 48 ds.Speed * speedRate,
46 ds.Max * speedRate 49 ds.Max * speedRate
47 ); 50 );
48 51
49 - ds = base.subtitles.DefaultNumberSpeed;  
50 - base.subtitles.DefaultNumberSpeed = new DefaultSignSpeed( 52 + ds = base.subtitles.DefaultLetterSpeed;
  53 + base.subtitles.DefaultLetterSpeed = new DefaultSignSpeed(
51 ds.Speed * speedRate, 54 ds.Speed * speedRate,
52 ds.Max * speedRate 55 ds.Max * speedRate
53 ); 56 );
54 } 57 }
55 - if (args.Length >= 4)  
56 - {  
57 - if (int.Parse(args[3]) == 1)  
58 - base.SUBTITLES.gameObject.SetActive(true);  
59 - }  
60 58
61 serverSemaphore = new Semaphore(0, 1); 59 serverSemaphore = new Semaphore(0, 1);
62 server = new Server(serverSemaphore, this); 60 server = new Server(serverSemaphore, this);
@@ -65,15 +63,50 @@ public class PlayerManager : GenericPlayerManager { @@ -65,15 +63,50 @@ public class PlayerManager : GenericPlayerManager {
65 63
66 serverSemaphore.WaitOne(); 64 serverSemaphore.WaitOne();
67 65
  66 + //UnityEngine.Debug.Log("Datapath: " + Application.dataPath);
  67 +
68 Screen.SetResolution(800, 600, false); 68 Screen.SetResolution(800, 600, false);
69 } 69 }
70 70
71 protected void Update() { 71 protected void Update() {
72 - if (toFinalize) Application.Quit(); 72 + if (toFinalize)
  73 + {
  74 + UnityEngine.Debug.Log("Update -> toFinalize == " + toFinalize);
  75 + Application.Quit();
  76 + }
73 } 77 }
74 78
75 - public void playMessage(string message) {  
76 - base.playQueued(message.ToUpper()); 79 + public void enqueueMessage(Message message) {
  80 + //UnityEngine.Debug.Log("PlayerManager.enqueueMessage( " + message.Text + " )");
  81 + messages.Enqueue(message);
  82 + }
  83 +
  84 + public void finishConnection() {
  85 + //UnityEngine.Debug.Log("PlayerManager.finishConnection()");
  86 + StartCoroutine(MessageChecker());
  87 + }
  88 +
  89 + IEnumerator MessageChecker()
  90 + {
  91 + CameraCapture.capture = true;
  92 + foreach (Message message in messages)
  93 + {
  94 + while ((CameraCapture.frameNumber * 1000) / CameraCapture.frameRate < message.Time)
  95 + yield return null;
  96 +
  97 + UnityEngine.Debug.Log("Loading " + message.Text);
  98 + base.playQueued(message.Text);
  99 + }
  100 +
  101 + while (base.isPlaying() || base.isLoading())
  102 + yield return null;
  103 +
  104 + UnityEngine.Debug.Log("ALL DONE!");
  105 + server.sendFinalizeToCore();
  106 + CameraCapture.capture = false;
  107 + UnityEngine.Debug.Log("CameraCapture.capture == " + CameraCapture.capture);
  108 + toFinalize = true;
  109 + UnityEngine.Debug.Log("toFinalize == " + toFinalize);
77 } 110 }
78 111
79 public override WWW loadAssetBundle(string aniName) 112 public override WWW loadAssetBundle(string aniName)
@@ -81,13 +114,9 @@ public class PlayerManager : GenericPlayerManager { @@ -81,13 +114,9 @@ public class PlayerManager : GenericPlayerManager {
81 string assetPath = Application.dataPath + "/Bundles/" + aniName; 114 string assetPath = Application.dataPath + "/Bundles/" + aniName;
82 115
83 if ( ! File.Exists(assetPath)) 116 if ( ! File.Exists(assetPath))
84 - {  
85 - UnityEngine.Debug.Log("PM:lAB(" + aniName + "): File at " + assetPath + " doesn't exists");  
86 return null; 117 return null;
87 - }  
88 118
89 try { 119 try {
90 - UnityEngine.Debug.Log("PM:lAB(" + aniName + "): Loading file at " + assetPath);  
91 WWW www = new WWW("file://" + assetPath); 120 WWW www = new WWW("file://" + assetPath);
92 return www; 121 return www;
93 } catch (Exception e) { 122 } catch (Exception e) {
@@ -99,8 +128,6 @@ public class PlayerManager : GenericPlayerManager { @@ -99,8 +128,6 @@ public class PlayerManager : GenericPlayerManager {
99 128
100 public override void onPlayingStateChange() { } 129 public override void onPlayingStateChange() { }
101 130
102 - public override void onConnectionError(string gloss, string word) {  
103 - UnityEngine.Debug.Log("PM:oCE: " + gloss + " / " + word);  
104 - } 131 + public override void onConnectionError(string gloss, string word) { }
105 132
106 } 133 }
Assets/Scripts/PlayerManager/AnimationReference.cs.meta
1 fileFormatVersion: 2 1 fileFormatVersion: 2
2 -guid: df5e8cf8b3eb49c4cb1286ca5dcbedb4  
3 -timeCreated: 1461076407 2 +guid: 0a79f85598da5e245b6beae9133a8a26
  3 +timeCreated: 1457644367
4 licenseType: Pro 4 licenseType: Pro
5 MonoImporter: 5 MonoImporter:
6 serializedVersion: 2 6 serializedVersion: 2
Assets/Scripts/PlayerManager/DefaultSignSpeed.cs.meta
1 fileFormatVersion: 2 1 fileFormatVersion: 2
2 -guid: 7d1d6b6ae0a940f4e81b74d8f4b0157a  
3 -timeCreated: 1461076406 2 +guid: 65beafb116ad9fe4fbf6eee8d0253b39
  3 +timeCreated: 1457644367
4 licenseType: Pro 4 licenseType: Pro
5 MonoImporter: 5 MonoImporter:
6 serializedVersion: 2 6 serializedVersion: 2
Assets/Scripts/PlayerManager/GenericPlayerManager.cs 0 → 100644
@@ -0,0 +1,704 @@ @@ -0,0 +1,704 @@
  1 +/** Gerenciador genérico e principal dos players.
  2 + *
  3 + * Versão 2.1
  4 + * - Acompanhamento da legenda
  5 + * Corrigido problema na soletração quando a velocidade ultrapassava ~1.
  6 + *
  7 + * Versão 2.2
  8 + * - Acompanhamento da legenda
  9 + * Corrigido problema na soletração quando o estado muda para pausado.
  10 + *
  11 + * Versão 2.3
  12 + * - Legenda
  13 + * A letras acentuadas reproduzem a mesma sem o acento.
  14 + *
  15 + * Versão 2.4
  16 + * - Legenda
  17 + * "Ç" reproduz "C".
  18 + * - Reprodução
  19 + * Quando não há acesso aos bundles dos sinais de pontuação, eles são ignorados.
  20 + * Ç adicionado como TYPE_WORD.
  21 + */
  22 +
  23 +//Log Dir http://docs.unity3d.com/Manual/LogFiles.html
  24 +using UnityEngine;
  25 +using System.Collections;
  26 +using System.Collections.Generic;
  27 +using System;
  28 +using System.Threading;
  29 +using System.IO;
  30 +using System.Text;
  31 +using System.Runtime.InteropServices;
  32 +using UnityEngine.UI;
  33 +
  34 +public abstract class GenericPlayerManager : MonoBehaviour {
  35 +
  36 + private const string DEFAULT_ANIMATION = "_default";
  37 + private const string DEFAULT_ANIMATION_MIDDLE = "_default_middle";
  38 +
  39 + public float fadeLength = 0.6F;
  40 + public string gloss = "";
  41 +
  42 + // Referencia para o avatar
  43 + private GameObject AVATAR;
  44 + // Referencia para o componente animador do avatar
  45 + private Animation COMPONENT_ANIMATION;
  46 + public Text SUBTITLES;
  47 +
  48 + // Guarda os nomes das palavras já carregadas
  49 + private HashSet<string> loadedAssetBundles = new HashSet<string>();
  50 + // Guarda os nomes das palavras que não tem assetbundle
  51 + private HashSet<string> nonexistentAssetBundles = new HashSet<string>();
  52 +
  53 + // Fila de animações para reprodução
  54 + // Utilizada para alterar velocidade e apresentar a legenda
  55 + private Queue<AnimationReference> animQueue = new Queue<AnimationReference>();
  56 +
  57 + // Sinais de intervalo de animações: não sinaliza reprodução na UI
  58 + private HashSet<string> intervalAnimations = new HashSet<string>();
  59 + // Sinais ignorados na apresentação de legenda
  60 + private HashSet<string> flags = new HashSet<string>();
  61 +
  62 + // True quando está na função LoadAndPlay
  63 + private volatile bool loading = false;
  64 + // True quando está reproduzindo qualquer animação
  65 + private volatile bool playing = false;
  66 + // True quando é chamada a função de pausa
  67 + private volatile bool paused = false;
  68 +
  69 + // Se diferente de null, não está reproduzindo animação de intervalo
  70 + private AnimationState intervalAnimationState = null;
  71 + // Usado para pausar quando comandado
  72 + private AnimationReference animationPlaying = null;
  73 +
  74 + // Gerenciador de animações de intervalo
  75 + public RandomAnimations randomAnimations;
  76 + // Gerenciados de legendas
  77 + public Subtitle subtitles = null;
  78 +
  79 + private bool[] lastLetterAnimations = new bool[256];
  80 +
  81 + public virtual void Start()
  82 + {
  83 + // Configuração de velocidade das animações
  84 + subtitles = new Subtitle(SUBTITLES);
  85 + subtitles.DefaultWordSpeed = new DefaultSignSpeed();
  86 + subtitles.DefaultFirstLetterSpeed = new DefaultSignSpeed(2.1F, 2.8F);
  87 + subtitles.DefaultLetterSpeed = new DefaultSignSpeed(3F, 4.3F);
  88 + subtitles.DefaultNumberSpeed = new DefaultSignSpeed(1.5F, 2.9F);
  89 +
  90 + AVATAR = GameObject.FindGameObjectWithTag("avatar");
  91 + COMPONENT_ANIMATION = AVATAR.GetComponent<Animation>();
  92 +
  93 + // Sinais ignorados na legenda
  94 + string[] flags = new string[] {
  95 + "[PONTO]",
  96 + "[INTERROGAÇÃO]",
  97 + "[EXCLAMAÇÃO]"
  98 + };
  99 + foreach (string flag in flags)
  100 + this.flags.Add(flag);
  101 +
  102 + string[] preloadedAnims = new string[] {
  103 + "A", "B", "C", "Ç", "D", "E", "F", "G", "H", "I",
  104 + "J", "K", "L", "M", "N", "O", "P", "Q", "R",
  105 + "S", "T", "U", "V", "W", "X", "Y", "Z",
  106 + "0", "1", "2", "3", "4",
  107 + "5", "6", "7", "8", "9",
  108 + ","
  109 + };
  110 +
  111 + // Duplica sinais para diferenciar quando há repetidos
  112 + foreach (string anim in preloadedAnims)
  113 + COMPONENT_ANIMATION.AddClip(COMPONENT_ANIMATION[anim].clip, "d_" + anim);
  114 +
  115 + foreach (string anim in preloadedAnims)
  116 + this.loadedAssetBundles.Add(anim);
  117 +
  118 + // Cria novo _default chamado _default_middle para pausas dentro de uma glosa
  119 + // Impede que a animação default seja confundida com não-reprodução na UI
  120 + COMPONENT_ANIMATION.AddClip(COMPONENT_ANIMATION[DEFAULT_ANIMATION].clip, DEFAULT_ANIMATION_MIDDLE);
  121 + }
  122 +
  123 + public bool isPlayingIntervalAnimation() { return intervalAnimationState != null; }
  124 + public bool isLoading() { return loading; }
  125 + public bool isPlaying() { return playing; }
  126 + public bool isPaused() { return paused; }
  127 + public bool isRepeatable() { return ! String.IsNullOrEmpty(gloss); }
  128 +
  129 + public virtual void setSubtitle(string text) {
  130 + this.subtitles.setText(text);
  131 + }
  132 +
  133 + /* Configura as animações de intervalo */
  134 + public void setRandomAnimations(string[] intervalAnimations)
  135 + {
  136 + foreach (string name in intervalAnimations)
  137 + {
  138 + this.intervalAnimations.Add(name);
  139 + this.loadedAssetBundles.Add(name);
  140 + }
  141 +
  142 + this.randomAnimations.setAnimations(intervalAnimations);
  143 + }
  144 +
  145 + /* Define a velocidade das animacões com base no slider da GUI */
  146 + public void setSlider(float sliderPosition)
  147 + {
  148 + subtitles.SliderPosition = sliderPosition;
  149 + subtitles.updateWordSpeed();
  150 + subtitles.updateLetterSpeed();
  151 + subtitles.updateNumberSpeed();
  152 +
  153 + // Altera a velocidade de todas as animações em reprodução
  154 + if ( ! paused) lock (this.animQueue)
  155 + {
  156 + foreach (AnimationReference reference in this.animQueue)
  157 + if (reference.type != Subtitle.TYPE_NONE && reference.state != null)
  158 + reference.state.speed = getSpeedByType(reference.type);
  159 + }
  160 + }
  161 +
  162 + /* Retorna a velocidade para o tipo */
  163 + private float getSpeedByType(short type)
  164 + {
  165 + switch (type)
  166 + {
  167 + case Subtitle.TYPE_WORD: return subtitles.WordSpeed;
  168 + case Subtitle.TYPE_LETTER: return subtitles.LetterSpeed;
  169 + case Subtitle.TYPE_NUMBER: return subtitles.NumberSpeed;
  170 + }
  171 +
  172 + return 2F;
  173 + }
  174 +
  175 + /* Para carregamento e animações */
  176 + public void stopAll()
  177 + {
  178 + StopCoroutine("loadAndPlay");
  179 + this.randomAnimations.unlockFor("loadAndPlay");
  180 + loading = false;
  181 +
  182 + stopAnimations();
  183 + }
  184 +
  185 + /* Para animações */
  186 + public void stopAnimations()
  187 + {
  188 + StopCoroutine("handleStates");
  189 + this.randomAnimations.unlockFor("handleStates");
  190 + this.subtitles.setText("");
  191 +
  192 + lock (this.animQueue) { this.animQueue.Clear(); }
  193 + COMPONENT_ANIMATION.CrossFadeQueued(DEFAULT_ANIMATION, fadeLength, QueueMode.PlayNow);
  194 +
  195 + resetStates();
  196 + }
  197 +
  198 + /* Repete animações */
  199 + public void repeat() {
  200 + repeat(true);
  201 + }
  202 +
  203 + /* Repete animações se now == true ou se não estiver carregando glosa */
  204 + public void repeat(bool now)
  205 + {
  206 + if (now || ! this.loading)
  207 + playNow(this.gloss);
  208 + }
  209 +
  210 + /* Manda reproduzir animação e adiciona a file de animações a serem reproduzidas */
  211 + private AnimationState playAnimation(short type, string name, string subtitle, float speed)
  212 + {
  213 + try
  214 + {
  215 + AnimationState state = COMPONENT_ANIMATION.CrossFadeQueued(name, fadeLength, QueueMode.CompleteOthers);
  216 + state.speed = speed;
  217 +
  218 + lock (this.animQueue) {
  219 + this.animQueue.Enqueue(new AnimationReference(name, subtitle, state, type));
  220 + }
  221 +
  222 + return state;
  223 + }
  224 + catch (NullReferenceException nre) {
  225 + UnityEngine.Debug.Log("'" + name + "' não foi encontrado!\n" + nre.ToString());
  226 + }
  227 +
  228 + return null;
  229 + }
  230 + private AnimationState playAnimation(short type, string name, string subtitle) {
  231 + return playAnimation(type, name, subtitle, getSpeedByType(type));
  232 + }
  233 + private AnimationState playAnimation(short type, string name) {
  234 + return playAnimation(type, name, name);
  235 + }
  236 +
  237 + /* Enfileira em reprodução a animação de intervalo */
  238 + private void playDefaultAnimation() {
  239 + playDefaultAnimation(false);
  240 + }
  241 +
  242 + /* Enfileira em reprodução a animação padrão se now == true, ou reproduz imediatamente */
  243 + private void playDefaultAnimation(bool now) {
  244 + COMPONENT_ANIMATION.CrossFadeQueued(DEFAULT_ANIMATION, fadeLength, now ? QueueMode.PlayNow : QueueMode.CompleteOthers);
  245 + }
  246 +
  247 +
  248 + /**
  249 + * Returns the asset bundle named aniName.
  250 + *
  251 + * @return AssetBundle - se for encontrado.
  252 + * null - se ocorrer num erro.
  253 + */
  254 + public abstract WWW loadAssetBundle(string aniName);
  255 +
  256 + /**
  257 + * Listen to changes in the playing status.
  258 + */
  259 + public abstract void onConnectionError(string gloss, string word);
  260 +
  261 + /**
  262 + * Listen to changes in the playing status.
  263 + */
  264 + public abstract void onPlayingStateChange();
  265 +
  266 +
  267 + /* Pause or continue animations */
  268 + public void setPauseState(bool paused)
  269 + {
  270 + if (this.paused != paused)
  271 + {
  272 + this.paused = paused;
  273 +
  274 + lock (this.animQueue)
  275 + {
  276 + if (this.animationPlaying != null && this.animationPlaying.state != null)
  277 + this.animationPlaying.state.speed = paused ? 0F : getSpeedByType(this.animationPlaying.type);
  278 +
  279 + foreach (AnimationReference reference in this.animQueue)
  280 + if (reference.state != null)
  281 + reference.state.speed = paused ? 0F : getSpeedByType(reference.type);
  282 + }
  283 + }
  284 +
  285 + onPlayingStateChange();
  286 + }
  287 +
  288 + public void setAnimationEnabled(bool enabled) {
  289 + COMPONENT_ANIMATION.enabled = enabled;
  290 + }
  291 +
  292 + /* Pause or continue animations */
  293 + public void switchPauseState() {
  294 + setPauseState( ! this.paused);
  295 + }
  296 +
  297 + private System.Object LOCKER_PLAY = new System.Object();
  298 +
  299 + /* Play if anything loading or playing */
  300 + public bool playIfEmpty(string gloss)
  301 + {
  302 + lock (LOCKER_PLAY)
  303 + {
  304 + if (this.loading || this.playing)
  305 + return false;
  306 +
  307 + StartCoroutine("loadAndPlay", gloss);
  308 + }
  309 +
  310 + return true;
  311 + }
  312 +
  313 + private System.Object LOCKER_GLOSS_WATING = new System.Object();
  314 + private int numGlossWating = 0;
  315 + public void setGlossWaiting(bool inc) { lock (LOCKER_GLOSS_WATING) { numGlossWating += inc ? 1 : -1; } }
  316 + public bool hasGlossWaiting() { lock (LOCKER_GLOSS_WATING) { return this.numGlossWating > 0; } }
  317 +
  318 + /* Enqueue animations for playing */
  319 + public void playQueued(string gloss)
  320 + {
  321 + lock (LOCKER_PLAY)
  322 + {
  323 + setGlossWaiting(true);
  324 + StartCoroutine("loadAndPlay", gloss);
  325 + }
  326 + }
  327 +
  328 + /* Stop all and play */
  329 + public void playNow(string gloss)
  330 + {
  331 + lock (LOCKER_PLAY)
  332 + {
  333 + stopAll();
  334 + StartCoroutine("loadAndPlay", gloss);
  335 + }
  336 + }
  337 +
  338 + /* Reproduz animação de intervalo */
  339 + public bool playIntervalAnimation(string name)
  340 + {
  341 + if ( ! Monitor.TryEnter(LOCKER_PLAY))
  342 + return false;
  343 +
  344 + lock (LOCKER_PLAY)
  345 + {
  346 + playDefaultAnimation(true);
  347 + this.intervalAnimationState = COMPONENT_ANIMATION.CrossFadeQueued(name, fadeLength, QueueMode.CompleteOthers);
  348 + playDefaultAnimation(false);
  349 + }
  350 +
  351 + return true;
  352 + }
  353 +
  354 + private string nextLetterAnimation(char letter)
  355 + {
  356 + string animation = (this.lastLetterAnimations[letter] ? "" : "d_") + letter.ToString();
  357 + this.lastLetterAnimations[letter] = ! this.lastLetterAnimations[letter];
  358 +
  359 + return animation;
  360 + }
  361 +
  362 + private static short getType(char c)
  363 + {
  364 + // Se for uma letra
  365 + if (c >= 65 && c <= 90)
  366 + return Subtitle.TYPE_LETTER;
  367 +
  368 + // Se for um número
  369 + else if (c >= 48 && c <= 57)
  370 + return Subtitle.TYPE_NUMBER;
  371 +
  372 + // Se for uma vírgula
  373 + else if (c == 44 || c == 'Ç')
  374 + return Subtitle.TYPE_WORD;
  375 +
  376 + else
  377 + return Subtitle.TYPE_NONE;
  378 + }
  379 +
  380 + /* Enfileira soletração de palavra */
  381 + private string spellWord(Queue<ToPlay> toPlayQueue, string word)
  382 + {
  383 + string lastAnimationSubtitle = "";
  384 + bool defaultPlayed = false;
  385 +
  386 + // A reprodução da primeira letra deve ser longa para não ser cortada no fade
  387 + this.subtitles.updateLetterSpeed();
  388 +
  389 + for (int i = 0; i < word.Length; i++)
  390 + {
  391 + lastAnimationSubtitle = Subtitle.highlight(word, i);
  392 + char anim = word[i];
  393 +
  394 + switch (word[i])
  395 + {
  396 + case 'Á':
  397 + case 'Â':
  398 + case 'À':
  399 + case 'Ã': anim = 'A';
  400 + break;
  401 + case 'É':
  402 + case 'Ê': anim = 'E';
  403 + break;
  404 + case 'Í': anim = 'I';
  405 + break;
  406 + case 'Ó':
  407 + case 'Ô':
  408 + case 'Õ': anim = 'O';
  409 + break;
  410 + case 'Ú': anim = 'U';
  411 + break;
  412 + }
  413 +
  414 + short type = getType(anim);
  415 + string animName = nextLetterAnimation(anim);
  416 +
  417 + // Não há animação
  418 + if (type == Subtitle.TYPE_NONE)
  419 + {
  420 + // Reproduz animação default apenas uma vez
  421 + if ( ! defaultPlayed)
  422 + {
  423 + defaultPlayed = true;
  424 + toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_WORD, DEFAULT_ANIMATION_MIDDLE, lastAnimationSubtitle, this));
  425 +
  426 + // A reprodução da próxima letra deve ser longa para não ser cortada no fade
  427 + this.subtitles.updateLetterSpeed();
  428 + }
  429 +
  430 + UnityEngine.Debug.Log("Animação \"" + animName + "\" inexistente.");
  431 + }
  432 + else
  433 + {
  434 + toPlayQueue.Enqueue(new ToPlay(type, animName, lastAnimationSubtitle, this));
  435 +
  436 + defaultPlayed = false;
  437 + this.subtitles.updateLetterSpeed();
  438 + }
  439 + }
  440 +
  441 + return lastAnimationSubtitle;
  442 + }
  443 +
  444 + /* Instruções para reprodução de aninmação */
  445 + private struct ToPlay
  446 + {
  447 + private short type;
  448 + private string name;
  449 + private string subtitle;
  450 + private float speed;
  451 +
  452 + public ToPlay(short type, string name, string subtitle, float speed)
  453 + {
  454 + this.type = type;
  455 + this.name = name;
  456 + this.subtitle = subtitle;
  457 + this.speed = speed;
  458 + }
  459 + public ToPlay(short type, string name, string subtitle, GenericPlayerManager context)
  460 + : this(type, name, subtitle, 0F) {
  461 + this.speed = context.getSpeedByType(type);
  462 + }
  463 + public ToPlay(short type, string name, GenericPlayerManager context)
  464 + : this(type, name, name, context) { }
  465 +
  466 + public void play(GenericPlayerManager context) {
  467 + context.playAnimation(this.type, this.name, this.subtitle, this.speed);
  468 + }
  469 + }
  470 +
  471 + private System.Object LOCKER_LOADING = new System.Object();
  472 +
  473 + /* Carrega animações e reproduz */
  474 + private IEnumerator loadAndPlay(string gloss)
  475 + {
  476 + lock (LOCKER_LOADING)
  477 + {
  478 + this.randomAnimations.lockFor("loadAndPlay");
  479 + this.loading = true;
  480 + setGlossWaiting(false);
  481 + // onPlayingStateChange();
  482 +
  483 + string lastAnimationSubtitle = "";
  484 + bool spelled = false;
  485 +
  486 + if ( ! this.playing)
  487 + StartCoroutine("handleStates");
  488 +
  489 + String[] stringPos = gloss.Split(' ');
  490 +
  491 + Queue<ToPlay> toPlayQueue = new Queue<ToPlay>();
  492 + int wordsCount = 0;
  493 + toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION, "", this));
  494 +
  495 + foreach (string aniName in stringPos)
  496 + {
  497 + wordsCount++;
  498 + if (String.IsNullOrEmpty(aniName)) continue;
  499 +
  500 + bool nonexistent = nonexistentAssetBundles.Contains(aniName);
  501 + bool loaded = loadedAssetBundles.Contains(aniName);
  502 +
  503 + if ( ! nonexistent && ! loaded)
  504 + {
  505 + // Função loadAssetBundle é definida pela classe filha
  506 + WWW www = loadAssetBundle(aniName);
  507 +
  508 + if (www != null)
  509 + {
  510 + yield return www;
  511 +
  512 + AssetBundle bundle = null;
  513 +
  514 + if (www.error == null)
  515 + {
  516 + bundle = www.assetBundle;
  517 +
  518 + if (bundle != null && ! String.IsNullOrEmpty(bundle.mainAsset.name))
  519 + {
  520 + AnimationClip aniClip = bundle.mainAsset as AnimationClip;
  521 + bundle.Unload(false);
  522 +
  523 + if (aniClip)
  524 + {
  525 + COMPONENT_ANIMATION.AddClip(aniClip, aniName);
  526 +
  527 + loadedAssetBundles.Add(aniName);
  528 + loaded = true;
  529 +
  530 + Debug.Log("Bundle \"" + aniName + "\" loaded!");
  531 + }
  532 + else UnityEngine.Debug.Log ("Sinal \"" + aniName + "\" foi não carregado corretamente.");
  533 + }
  534 + }
  535 + else onConnectionError(gloss, aniName);
  536 + }
  537 + else onConnectionError(gloss, aniName);
  538 + }
  539 +
  540 + // Reproduz palavra
  541 + if (loaded)
  542 + {
  543 + if (spelled)
  544 + {
  545 + // Default
  546 + toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION, lastAnimationSubtitle, this));
  547 + spelled = false;
  548 + }
  549 +
  550 + if (this.flags.Contains(aniName) || this.intervalAnimations.Contains(aniName))
  551 + {
  552 + lastAnimationSubtitle = "";
  553 + toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_WORD, aniName, "", this));
  554 + }
  555 + else
  556 + {
  557 + lastAnimationSubtitle = aniName;
  558 + toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_WORD, aniName, this));
  559 + }
  560 + }
  561 +
  562 + // Soletra palavra
  563 + else
  564 + {
  565 + // Se a animação não foi carregada e nem está marcada como não existente,
  566 + // adiciona ao set de animações não existentes
  567 + if ( ! nonexistent)
  568 + nonexistentAssetBundles.Add(aniName);
  569 +
  570 + UnityEngine.Debug.Log("~~ To spell: " + aniName);
  571 +
  572 + if (this.flags.Contains(aniName) || this.intervalAnimations.Contains(aniName))
  573 + {
  574 + toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION_MIDDLE, "", 1.6F));
  575 + spelled = false;
  576 + }
  577 + else
  578 + {
  579 + // Se já houve o soletramento de alguma palavra, reproduz animação default
  580 + if (spelled)
  581 + toPlayQueue.Enqueue(new ToPlay(Subtitle.TYPE_NONE, DEFAULT_ANIMATION_MIDDLE, "", 1.6F));
  582 + else
  583 + spelled = true;
  584 +
  585 + lastAnimationSubtitle = spellWord(toPlayQueue, aniName);
  586 + }
  587 + }
  588 +
  589 + if (toPlayQueue.Count > 4 || wordsCount == stringPos.Length)
  590 + while (toPlayQueue.Count > 0)
  591 + toPlayQueue.Dequeue().play(this);
  592 + }
  593 +
  594 + // Default
  595 + playAnimation(Subtitle.TYPE_NONE, DEFAULT_ANIMATION, "");
  596 +
  597 + this.loading = false;
  598 + // onPlayingStateChange();
  599 + this.randomAnimations.unlockFor("loadAndPlay");
  600 + }
  601 + }
  602 +
  603 + private System.Object LOCKER_PLAYING = new System.Object();
  604 +
  605 + /* Sincroniza as legendas com as animações. */
  606 + IEnumerator handleStates()
  607 + {
  608 + lock (LOCKER_PLAYING)
  609 + {
  610 + this.randomAnimations.lockFor("handleStates");
  611 + this.playing = true;
  612 + onPlayingStateChange();
  613 +
  614 + bool isNotEmpty;
  615 + lock (this.animQueue) { isNotEmpty = this.animQueue.Count > 0; }
  616 +
  617 + // Animação anterior a atual
  618 + AnimationReference endedAnimation = null;
  619 +
  620 + // Enquanto estiver executando a corotina "loadAndPlay"
  621 + // ou existir animações na fila de reprodução
  622 + while (loading || isNotEmpty)
  623 + {
  624 + // Se não houver animações na fila, espera
  625 + if (isNotEmpty)
  626 + {
  627 + // Pega primeira animação
  628 + AnimationReference reference;
  629 + lock (this.animQueue) { reference = this.animQueue.Peek(); }
  630 +
  631 + // Se estiver sendo reproduzida
  632 + if (COMPONENT_ANIMATION.IsPlaying(reference.name))
  633 + {
  634 + this.subtitles.setText(reference.subtitle);
  635 +
  636 + // Animação seguinte
  637 + AnimationReference next = null;
  638 + lock (this.animQueue)
  639 + {
  640 + this.animationPlaying = this.animQueue.Dequeue();
  641 +
  642 + if (this.animQueue.Count > 0)
  643 + next = this.animQueue.Peek();
  644 + }
  645 +
  646 + while (true)
  647 + {
  648 + // Se a próxima animação estiver sendo reproduzida (no fade)
  649 + if (next != null && COMPONENT_ANIMATION.IsPlaying(next.name))
  650 + {
  651 + // Se a animação anterior a atual não tiver acabado,
  652 + // espera acabar e só então conta o tempo
  653 + if (endedAnimation != null)
  654 + while (COMPONENT_ANIMATION.IsPlaying(endedAnimation.name))
  655 + yield return null;
  656 +
  657 + // Tempo para pular para a legenda da próxima animação
  658 + yield return new WaitForSeconds(0.4F);
  659 +
  660 + // Deprecated
  661 + // yield return WaitForContinuousMillis.Wait(this, 300);
  662 +
  663 + endedAnimation = reference;
  664 + break;
  665 + }
  666 +
  667 + else if (COMPONENT_ANIMATION.IsPlaying(reference.name))
  668 + yield return null;
  669 +
  670 + else break;
  671 + }
  672 +
  673 + reference = null;
  674 + }
  675 +
  676 + // Se a animação não tiver sido liberada e seu AnimationState for nulo,
  677 + // a animação será liberada
  678 + if (reference != null && reference.state == null)
  679 + lock (this.animQueue) { this.animQueue.Dequeue(); }
  680 + else
  681 + yield return null;
  682 + }
  683 + else yield return null;
  684 +
  685 + lock (this.animQueue) { isNotEmpty = this.animQueue.Count > 0; }
  686 + }
  687 +
  688 + this.subtitles.setText("");
  689 +
  690 + resetStates();
  691 + this.randomAnimations.unlockFor("handleStates");
  692 + }
  693 + }
  694 +
  695 + public void resetStates()
  696 + {
  697 + this.animationPlaying = null;
  698 + this.playing = false;
  699 + this.paused = false;
  700 +
  701 + onPlayingStateChange();
  702 + }
  703 +
  704 +}
Assets/Scripts/PlayerManager/GenericPlayerManager.cs.meta 0 → 100644
@@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
  1 +fileFormatVersion: 2
  2 +guid: 953c1d9124325ab4099d246d3cbfb780
  3 +timeCreated: 1457644367
  4 +licenseType: Pro
  5 +MonoImporter:
  6 + serializedVersion: 2
  7 + defaultReferences: []
  8 + executionOrder: 0
  9 + icon: {instanceID: 0}
  10 + userData:
  11 + assetBundleName:
  12 + assetBundleVariant:
Assets/Scripts/PlayerManager/RandomAnimations.cs
@@ -60,37 +60,36 @@ public class RandomAnimations : MonoBehaviour { @@ -60,37 +60,36 @@ public class RandomAnimations : MonoBehaviour {
60 { 60 {
61 while (true) 61 while (true)
62 { 62 {
63 - // Espera enquanto estiver reproduzindo animações de intervalo  
64 - do { yield return null; }  
65 - while (this.playerManager.isPlayingIntervalAnimation()); 63 + while (this.playerManager.isPlayingIntervalAnimation())
  64 + yield return new WaitForSeconds(1);
66 65
67 - // Se houver bloqueio, espera acabar  
68 - while (true) 66 + bool isNotBlocked;
  67 + lock (this.blockingObjects) {
  68 + isNotBlocked = this.blockingObjects.Count == 0;
  69 + }
  70 +
  71 + if (isNotBlocked)
69 { 72 {
  73 + yield return new WaitForSeconds(this.time);
  74 +
70 lock (this.blockingObjects) { 75 lock (this.blockingObjects) {
71 - if (this.blockingObjects.Count == 0)  
72 - break; 76 + if (this.blockingObjects.Count > 0)
  77 + continue;
73 } 78 }
74 79
75 - yield return null;  
76 - } 80 + int index = sortIndex();
77 81
78 - // Espera time  
79 - yield return new WaitForSeconds(this.time); 82 + if (index != -1)
  83 + {
  84 + if (index == this.lastIndex)
  85 + index = sortIndex();
80 86
81 - // Se houver bloqueio, volta a esperar  
82 - lock (this.blockingObjects) {  
83 - if (this.blockingObjects.Count > 0)  
84 - continue; 87 + //this.playerManager.play(this.names[index], true, false, true);
  88 + this.playerManager.playIntervalAnimation(this.names[index]);
  89 + }
85 } 90 }
86 -  
87 - int index = sortIndex();  
88 -  
89 - if (index != -1 && index == this.lastIndex)  
90 - index = sortIndex();  
91 -  
92 - if (index != -1)  
93 - this.playerManager.playIntervalAnimation(this.names[index]); 91 +
  92 + yield return null;
94 } 93 }
95 } 94 }
96 95
Assets/Scripts/PlayerManager/RandomAnimations.cs.meta
1 fileFormatVersion: 2 1 fileFormatVersion: 2
2 -guid: 9993e87cd59cf32489da3d2de0ecd84b  
3 -timeCreated: 1461076406 2 +guid: 9d4b654b474c35d4592a9c87c9fe817b
  3 +timeCreated: 1457644367
4 licenseType: Pro 4 licenseType: Pro
5 MonoImporter: 5 MonoImporter:
6 serializedVersion: 2 6 serializedVersion: 2
Assets/Scripts/PlayerManager/Subtitle.cs.meta
1 fileFormatVersion: 2 1 fileFormatVersion: 2
2 -guid: 6a1e9f523e8ff7843a43c3167886faf2  
3 -timeCreated: 1461076406 2 +guid: f97b63181c1ec5f488126f3f9fd68141
  3 +timeCreated: 1457644367
4 licenseType: Pro 4 licenseType: Pro
5 MonoImporter: 5 MonoImporter:
6 serializedVersion: 2 6 serializedVersion: 2
Assets/Scripts/Server.cs
@@ -40,7 +40,7 @@ public class Server { @@ -40,7 +40,7 @@ public class Server {
40 client = server.AcceptTcpClient(); // Accepts a pending connection request. 40 client = server.AcceptTcpClient(); // Accepts a pending connection request.
41 stream = client.GetStream(); 41 stream = client.GetStream();
42 42
43 - serverSemaphore.Release(); // Releases InspectorScript.Start() [Connection] 43 + serverSemaphore.Release (); // Releases InspectorScript.Start() [Connection]
44 getPTSFromCore(); 44 getPTSFromCore();
45 } 45 }
46 46
@@ -71,6 +71,10 @@ public class Server { @@ -71,6 +71,10 @@ public class Server {
71 int i; 71 int i;
72 Byte[] sendToCore; 72 Byte[] sendToCore;
73 73
  74 + /*Loop to receive all the data from Core
  75 + util get the string "FINALIZE\0"
  76 + '\0' for c++*/
  77 +
74 Debug.Log("getPTSFromCore"); 78 Debug.Log("getPTSFromCore");
75 79
76 while ((i = stream.Read(bytes, 0, bytes.Length)) != 0) 80 while ((i = stream.Read(bytes, 0, bytes.Length)) != 0)
@@ -80,10 +84,17 @@ public class Server { @@ -80,10 +84,17 @@ public class Server {
80 sendToCore = System.Text.UTF8Encoding.UTF8.GetBytes("OK\0"); // allows Core to send next stream 84 sendToCore = System.Text.UTF8Encoding.UTF8.GetBytes("OK\0"); // allows Core to send next stream
81 stream.Write(sendToCore, 0, sendToCore.Length); 85 stream.Write(sendToCore, 0, sendToCore.Length);
82 86
83 - Debug.Log(data); 87 + Message message = new Message(data);
  88 +
  89 + Debug.Log("gPFC: received: " + message.Text);
84 90
85 - if ( ! data.Equals("FINALIZE"))  
86 - inspector.playMessage(data); 91 + if (message.Text.Equals("FINALIZE"))
  92 + {
  93 + inspector.finishConnection();
  94 + break;
  95 + }
  96 + else
  97 + inspector.enqueueMessage(message);
87 } 98 }
88 99
89 Debug.Log("~~ getPTSFromCore"); 100 Debug.Log("~~ getPTSFromCore");
@@ -97,6 +108,7 @@ public class Server { @@ -97,6 +108,7 @@ public class Server {
97 public void sendFinalizeToCore(){ 108 public void sendFinalizeToCore(){
98 Byte[] sendToCore = System.Text.UTF8Encoding.UTF8.GetBytes("FINALIZE\0"); // ativar para o core 109 Byte[] sendToCore = System.Text.UTF8Encoding.UTF8.GetBytes("FINALIZE\0"); // ativar para o core
99 stream.Write(sendToCore, 0, sendToCore.Length); 110 stream.Write(sendToCore, 0, sendToCore.Length);
  111 + //closeConnections();
100 } 112 }
101 public void closeConnections(){ 113 public void closeConnections(){
102 114
Assets/Scripts/SwitchSubActiveStatus.cs 0 → 100644
@@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
  1 +using UnityEngine;
  2 +using System;
  3 +
  4 +public class SwitchSubActiveStatus : MonoBehaviour {
  5 +
  6 + void Start()
  7 + {
  8 + string[] strArg = Environment.GetCommandLineArgs();
  9 + gameObject.SetActive(strArg.Length < 3 || strArg[2].Equals("1"));
  10 + }
  11 +
  12 +}
0 \ No newline at end of file 13 \ No newline at end of file
Assets/Scripts/SwitchSubActiveStatus.cs.meta 0 → 100644
@@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
  1 +fileFormatVersion: 2
  2 +guid: f2c282fe94d95b544b4585b0af90077b
  3 +timeCreated: 1441833015
  4 +licenseType: Pro
  5 +MonoImporter:
  6 + serializedVersion: 2
  7 + defaultReferences: []
  8 + executionOrder: 0
  9 + icon: {instanceID: 0}
  10 + userData:
  11 + assetBundleName:
  12 + assetBundleVariant: