Commit 439c3d4af513f9eb09ab47f5869ac38d7a1a62f4

Authored by ClaudiomarAraujo
1 parent a5bae0ec
Exists in master and in 1 other branch devel

Parametro de velocidade de reproducao alterado

Showing 1 changed file with 23 additions and 5 deletions   Show diff stats
Assets/Scripts/InspectorScript.cs
1 1 //Log Dir http://docs.unity3d.com/Manual/LogFiles.html
  2 +
  3 +
  4 +/*---------------------------------------------------------
  5 +AnimationState-speed Doc
  6 +http://docs.unity3d.com/ScriptReference/AnimationState-speed.html
  7 +-----------------------------------------------------------*/
  8 +
2 9 using UnityEngine;
3 10 using System;
4 11 using System.Collections;
... ... @@ -8,7 +15,12 @@ using System.Net.Sockets;
8 15 using System.Threading;
9 16  
10 17 public class InspectorScript : MonoBehaviour {
11   -
  18 +
  19 + // 1 is the normal animation speed, i.e, unity reproduces it without changing the speed
  20 + // 1.5 means +50% speed. It was the most appropriate speed as reported by deaf testers
  21 + // Please, se speed method of AnimationState class in unity docs in link above
  22 + const float PLAYER_DEFAULT_SPEED = 1.5f;
  23 +
12 24 public Boolean isCaptionsActive = true;
13 25 string alfabeto = "0123456789,ABCDEFGHIJKLMNOPQRSTUVWXYZ";
14 26 string aniName = "";
... ... @@ -27,11 +39,12 @@ public class InspectorScript : MonoBehaviour {
27 39 string[] strArg;
28 40  
29 41 void Start(){
  42 +
30 43 strArg = Environment.GetCommandLineArgs();
  44 +
31 45 if(strArg.Length == 4)
32   - playerSpeed = 1+((float.Parse(strArg[3]))/100);
33   - else
34   - playerSpeed = 1.5f;
  46 + playerSpeed = float.Parse(strArg[3]);
  47 +
35 48 serverSemaphore = new Semaphore (0, 1);
36 49 glosaQueue = new Queue<String>();
37 50 subtitleQueue = new Queue<SubtitleInfo>();
... ... @@ -121,7 +134,12 @@ public class InspectorScript : MonoBehaviour {
121 134 }
122 135 }
123 136 foreach(AnimationState animState in COMPONENT_ANIMATION){
124   - animState.speed = playerSpeed;
  137 +
  138 + // Expects to receive this speed limitation [ 0 < speed <=1 ]
  139 + if(playerSpeed > 0 && playerSpeed <= 1)
  140 + animState.speed = 1 + playerSpeed; // explained on PLAYER_DEFAULT_SPEED declaration
  141 + else // uses the default speed;
  142 + animState.speed = PLAYER_DEFAULT_SPEED;
125 143 }
126 144 } // sendToPlayer
127 145 } // InspectorIscript
128 146 \ No newline at end of file
... ...