Анимации ожидания в main

This commit is contained in:
Vladislav Likhenko 2024-07-31 01:47:53 +03:00
parent cb269cfa70
commit 6081db5b15
10 changed files with 119 additions and 0 deletions

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 02e42aa68a49ffe40b9d552c186984a1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0e475b941203345428a8c460bc5f93a3
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5b3cf7e41a22e904c930fca6e6585282
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 64f540471671d3e4bbc9c15ed87ef659
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 9100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,76 @@
using UnityEngine;
using UnityEngine.InputSystem;
public class TimerOnInactiveScript : MonoBehaviour
{
[SerializeField] float _ValueTargetTime = 30.0f;
[SerializeField] private Animator _Animator;
[SerializeField] GameObject _UIActive;
[SerializeField] GameObject _UIInactive;
private float _TargetTime;
private bool _CanMoveFrom;
private void Awake()
{
_CanMoveFrom = false;
_TargetTime = _ValueTargetTime;
}
private void Update()
{
_TargetTime -= Time.deltaTime;
if (_TargetTime <= 0.0f)
{
//Debug.Log("Òàéìåð Çàêîí÷èëñÿ");
_CanMoveFrom = true;
MoveCameraToRound();
}
if (Gamepad.current.wasUpdatedThisFrame)
{
//Debug.Log("êíîïêà íàæàòà");
ResetTimer();
MoveCameraFromRound();
}
}
void MoveCameraToRound()
{
_UIActive.SetActive(false);
//Debug.Log("Ïåðåìåñòèëñÿ ê");
_Animator.Play("MoveCameraToRound");
}
void MoveCameraFromRound()
{
if (_CanMoveFrom)
{
_UIInactive.SetActive(false);
_Animator.Play("MoveCameraFromRound");
//Debug.Log("Ïåðåìåñòèëñÿ îò");
ResetTimer();
}
}
public void SetActiveInactive()
{
_UIInactive.SetActive(true);
}
public void SetActiveActive()
{
_UIActive.SetActive(true);
}
void ResetTimer()
{
_TargetTime = _ValueTargetTime;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 078165a11ead93242a8bd350c42fb2db
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: