Sync() public méthode

public Sync ( ) : void
Résultat void
	// Updates audio according to playState & playDirection
	
	void UpdateAudio()
	{
		if (enableAudio && audioAttached)
		{
			if (scrubbing)
			{
				myAudio.Stop();
			}
			else
			{
				if(playState == UVT_PlayState.Playing)
				{	
					switch (playDirection)
					{
					case UVT_PlayDirection.forward:
						myAudio.frameIndex = index;
						myAudio.Sync();
						myAudio.Play();
						break;
						
					case UVT_PlayDirection.backward:
						myAudio.Stop();
						break;
					}
				}	
				else
					myAudio.Stop();
			}
		}
	}
Exemple #2
0
    void Update()
    {
        // Forces audio sync on first play (helpful for some devices)

        if ((firstPlay) && (index < firstFrame + 1) && enableAudio)
        {
            myAudio.frameIndex = index;
            myAudio.Sync();
            myAudio.Play();
        }

        if (Input.GetMouseButtonDown(0) && enableReplay)
        {
            index = firstFrame;
            if (audioAttached && enableAudio)
            {
                myAudio.frameIndex = index;
                myAudio.Sync();
                myAudio.Play();
            }
        }

        index += FPS * Time.deltaTime;

        intIndex = (int)index;

        if (index >= lastFrame)
        {
            index = lastFrame;
        }

        if (intIndex != lastIndex)
        {
            indexStr = string.Format("{0:" + digitsFormat + "}", intIndex);

            if (DigitsLocation == digitsLocation.Postfix)
            {
                newTex = Resources.Load(FileName + indexStr) as Texture;
            }
            else
            {
                newTex = Resources.Load(indexStr + FileName) as Texture;
            }

            lastIndex = intIndex;
        }
    }