40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
using UnityEngine;
|
|
|
|
public class PromoState : IState
|
|
{
|
|
float startTime;
|
|
float videoLength;
|
|
public void enter()
|
|
{
|
|
|
|
LightUtility.Promo();
|
|
VideoUtility.PlayAds(); VideoUtility.PlayAds();
|
|
SoundManager.instance.music.mute = true;
|
|
SoundManager.instance.SetPromoVolumeToVideo();
|
|
startTime = Time.time;
|
|
videoLength = VideoUtility.adsLength;
|
|
}
|
|
|
|
public void exit()
|
|
{
|
|
VideoUtility.PlayFon();
|
|
SoundManager.instance.music.mute = false;
|
|
}
|
|
|
|
public void update()
|
|
{
|
|
bool anyInput = In.GetButtonDownAnyPlayer(PlayerAction.left) ||
|
|
In.GetButtonDownAnyPlayer(PlayerAction.right) ||
|
|
In.GetButtonDownAnyPlayer(PlayerAction.down) ||
|
|
In.GetButtonDown(InSignal.startOnePlayer) ||
|
|
In.GetButtonDown(InSignal.startTwoPlayers);
|
|
|
|
bool kinoVse = (Time.time - startTime) > videoLength;
|
|
|
|
if (anyInput || kinoVse)
|
|
{
|
|
GameManager.instance.stateMachine.ChangeState(new MenuState());
|
|
}
|
|
}
|
|
}
|