// Update is called once per frame
void Update()
{
lightSwitch.isOn = isOn;
if (backgroundPlayer.GetCurrentState() != MediaPlayerCtrl.MEDIAPLAYER_STATE.PLAYING)
{
return;
}
if (!isRendered && backgroundPlayer.GetSeekPosition() > 1000)
{
GameObject.Find("Theater").transform.localScale = new Vector3(30, 30, 30);
isRendered = true;
backgroundPlayer.Pause();
backgroundPlayer.SeekTo(0);
GameObject.Find("Music").GetComponent <AudioSource> ().Play();
}
if (isOn)
{
int currentPosition = backgroundPlayer.GetSeekPosition();
Debug.Log("lightSwitch position: " + currentPosition);
if (currentPosition + 100 >= backgroundPlayer.GetDuration())
{
backgroundPlayer.Pause();
}
}
else
{
int currentPosition = backgroundPlayer.GetSeekPosition();
Debug.Log("lightSwitch position: " + currentPosition);
if (currentPosition >= lightOffEndSeekPosition)
{
backgroundPlayer.Pause();
}
}
}