47 lines
1.2 KiB
C#
47 lines
1.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class VictoryVideoState : IState
|
|
{
|
|
IState nextState;
|
|
float startTime;
|
|
float videoLength;
|
|
|
|
public VictoryVideoState(IState nextState)
|
|
{
|
|
this.nextState = nextState;
|
|
}
|
|
|
|
public void enter()
|
|
{
|
|
VideoUtility.PlayEnding(); VideoUtility.PlayEnding();
|
|
SoundManager.instance.music.mute = true;
|
|
SoundManager.instance.SetMusicVolumeToVideo();
|
|
startTime = Time.time;
|
|
videoLength = VideoUtility.victoryLength;
|
|
}
|
|
|
|
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(nextState);
|
|
}
|
|
}
|
|
}
|