//Log Dir http://docs.unity3d.com/Manual/LogFiles.html using UnityEngine; using System.Collections; using System.Collections.Generic; using System; using System.IO; using System.Runtime.InteropServices; public class WebScript : MonoBehaviour { public static float hSliderValue = 1.1f; public Boolean isCaptionsActive = true; string alfabeto = "0123456789,ABCDEFGHIJKLMNOPQRSTUVWXYZ"; public static string[] stringPos = {"_default"}; AnimationClip aniClip; public string glosa = " _default "; GameObject ICARO; Animation COMPONENT_ANIMATION; void Start( ){ Application.ExternalCall("onLoadPlayer"); ICARO = GameObject.FindGameObjectWithTag("avatar"); COMPONENT_ANIMATION = ICARO.GetComponent(); addAlpha( ); } public void setSlider( float x ){ hSliderValue = x; } void addAlpha( ){ foreach( char letter in alfabeto ){ aniClip = Resources.Load ("ANIMS/alpha/"+letter); if( aniClip ) COMPONENT_ANIMATION.AddClip(aniClip, ""+letter); else Debug.Log("Anim "+letter+" not found"); } }//addAlpha void Update( ){ foreach(AnimationState anim in COMPONENT_ANIMATION) anim.speed = hSliderValue; } public void animStop( ){ COMPONENT_ANIMATION.Stop(); aniClip = Resources.Load("ANIMS/anims/_default"); COMPONENT_ANIMATION.CrossFade("_default", 0.6F, PlayMode.StopAll ); } public void catchGlosa(){ animStop( ); this.glosa = " _default "+glosa+" _default "; webPlay(); } public void webPlay(){ Debug.Log("ReadFromDLL"); Debug.Log( "Running on "+Application.platform ); //if( Application.platform == RuntimePlatform.OS ) animStop(); catchGlosa( ); stringPos = glosa.Split(' '); foreach( string aniName in stringPos ){ aniClip = Resources.Load("ANIMS/anims/"+aniName); if( aniClip ){ COMPONENT_ANIMATION.AddClip(aniClip, aniName); COMPONENT_ANIMATION.CrossFadeQueued( aniName, 0.6F, QueueMode.CompleteOthers );//0.4 //COMPONENT_ANIMATION.CrossFade(aniName, 0.6F ); //COMPONENT_ANIMATION.RemoveClip( aniName ); }else foreach(char letter in aniName) COMPONENT_ANIMATION.CrossFadeQueued(""+letter, 0.6F, QueueMode.CompleteOthers); //COMPONENT_ANIMATION.CrossFade(""+aniName, 0.6F ); }//foreach string aniName aniClip = Resources.Load("ANIMS/anims/_default"); COMPONENT_ANIMATION.AddClip(aniClip, "_default"); } public void closedCaptions( ){ isCaptionsActive = !isCaptionsActive; } void InutilFunc(){ Destroy(ICARO.GetComponent()); ICARO.AddComponent(); } }