Assemblied created
This commit is contained in:
27
Assets/Scripts/MainMenu/CryopodSpawnComponent.cs
Normal file
27
Assets/Scripts/MainMenu/CryopodSpawnComponent.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CryopodSpawnComponent : MonoBehaviour
|
||||
{
|
||||
public string playerName;
|
||||
[SerializeField]
|
||||
private TMPro.TMP_Text text;
|
||||
[SerializeField]
|
||||
private Transform spawn;
|
||||
private bool isOccupied = false;
|
||||
public bool IsOccupied { get { return isOccupied; } }
|
||||
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
text.text = playerName;
|
||||
}
|
||||
}
|
11
Assets/Scripts/MainMenu/CryopodSpawnComponent.cs.meta
Normal file
11
Assets/Scripts/MainMenu/CryopodSpawnComponent.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c7086bfdc301caf4a98920a939f3de3e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
55
Assets/Scripts/MainMenu/LobbyManager.cs
Normal file
55
Assets/Scripts/MainMenu/LobbyManager.cs
Normal file
@ -0,0 +1,55 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class LobbyManager : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private Animator[] lights;
|
||||
[SerializeField]
|
||||
private int playersInSession = 0;
|
||||
|
||||
|
||||
|
||||
public bool AddPlayer()
|
||||
{
|
||||
if (playersInSession>= lights.Length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
lights[playersInSession].SetBool("IsPowered", true);
|
||||
playersInSession++;
|
||||
return true;
|
||||
}
|
||||
public bool RemovePlayer()
|
||||
{
|
||||
if (playersInSession <=0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
playersInSession--;
|
||||
lights[playersInSession].SetBool("IsPowered", false);
|
||||
|
||||
return true;
|
||||
}
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetKeyUp(KeyCode.LeftShift))
|
||||
{
|
||||
AddPlayer();
|
||||
}else if(Input.GetKeyUp(KeyCode.RightShift))
|
||||
{
|
||||
RemovePlayer();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/MainMenu/LobbyManager.cs.meta
Normal file
11
Assets/Scripts/MainMenu/LobbyManager.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 52ac200e0a2b1f243be15a82558aa6e7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,3 +1,4 @@
|
||||
using Mono.CompilerServices.SymbolWriter;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
@ -5,72 +6,75 @@ using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class MainMenuManager : MonoBehaviour
|
||||
namespace UI
|
||||
{
|
||||
[SerializeField] private TMP_Text title;
|
||||
|
||||
[SerializeField] private List<TMP_Text> textList = new();
|
||||
|
||||
[SerializeField] private float dilateSpeed = 0.1f;
|
||||
|
||||
[SerializeField] private Animator cover;
|
||||
|
||||
private readonly string component = "_FaceDilate";
|
||||
private float dilate = -1;
|
||||
private readonly List<float> dilates = new();
|
||||
private float initDilate;
|
||||
private readonly List<float> initDilates = new();
|
||||
private bool transitioning;
|
||||
|
||||
// Start is called before the first frame update
|
||||
private void Start()
|
||||
public class MainMenuManager : MonoBehaviour
|
||||
{
|
||||
//initDilate = title.fontSharedMaterials[0].GetFloat(component);
|
||||
initDilate = title.fontMaterials[0].GetFloat(component);
|
||||
[SerializeField] private TMP_Text title;
|
||||
|
||||
[SerializeField] private List<TMP_Text> textList = new();
|
||||
|
||||
foreach (var text in textList)
|
||||
[SerializeField] private float dilateSpeed = 0.1f;
|
||||
|
||||
[SerializeField] private Animator cover;
|
||||
|
||||
private readonly string component = "_FaceDilate";
|
||||
private float dilate = -1;
|
||||
private readonly List<float> dilates = new();
|
||||
private float initDilate;
|
||||
private readonly List<float> initDilates = new();
|
||||
private bool transitioning;
|
||||
|
||||
// Start is called before the first frame update
|
||||
private void Start()
|
||||
{
|
||||
initDilates.Add(text.fontMaterials[0].GetFloat(component));
|
||||
dilates.Add(-1f);
|
||||
//initDilate = title.fontSharedMaterials[0].GetFloat(component);
|
||||
initDilate = title.fontMaterials[0].GetFloat(component);
|
||||
|
||||
|
||||
foreach (var text in textList)
|
||||
{
|
||||
initDilates.Add(text.fontMaterials[0].GetFloat(component));
|
||||
dilates.Add(-1f);
|
||||
}
|
||||
|
||||
textList[0].GetComponent<Button>().onClick.AddListener(LoadFirstLevel);
|
||||
textList[2].GetComponent<Button>().onClick.AddListener(ExitApp);
|
||||
}
|
||||
|
||||
textList[0].GetComponent<Button>().onClick.AddListener(LoadFirstLevel);
|
||||
textList[2].GetComponent<Button>().onClick.AddListener(ExitApp);
|
||||
}
|
||||
|
||||
|
||||
// Update is called once per frame
|
||||
private void Update()
|
||||
{
|
||||
//dilate = Mathf.Min(initDilate, dilate += Time.deltaTime);
|
||||
dilate = Mathf.Lerp(dilate, initDilate, Time.deltaTime * dilateSpeed);
|
||||
title.fontMaterials[0].SetFloat(component, dilate);
|
||||
for (var i = 0; i < textList.Count; i++)
|
||||
// Update is called once per frame
|
||||
private void Update()
|
||||
{
|
||||
dilates[i] = Mathf.Lerp(dilates[i], initDilates[i], Time.deltaTime * dilateSpeed);
|
||||
textList[i].fontMaterials[0].SetFloat(component, dilates[i]);
|
||||
//dilate = Mathf.Min(initDilate, dilate += Time.deltaTime);
|
||||
dilate = Mathf.Lerp(dilate, initDilate, Time.deltaTime * dilateSpeed);
|
||||
title.fontMaterials[0].SetFloat(component, dilate);
|
||||
for (var i = 0; i < textList.Count; i++)
|
||||
{
|
||||
dilates[i] = Mathf.Lerp(dilates[i], initDilates[i], Time.deltaTime * dilateSpeed);
|
||||
textList[i].fontMaterials[0].SetFloat(component, dilates[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadFirstLevel()
|
||||
{
|
||||
if (!transitioning)
|
||||
{
|
||||
cover.Play("Cover_load_out");
|
||||
transitioning = true;
|
||||
StartCoroutine(_LoadFirstLevel());
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator _LoadFirstLevel()
|
||||
{
|
||||
yield return new WaitForSeconds(4);
|
||||
SceneManager.LoadScene(1);
|
||||
}
|
||||
|
||||
private void ExitApp()
|
||||
{
|
||||
Application.Quit();
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadFirstLevel()
|
||||
{
|
||||
if (!transitioning)
|
||||
{
|
||||
cover.Play("Cover_load_out");
|
||||
transitioning = true;
|
||||
StartCoroutine(_LoadFirstLevel());
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator _LoadFirstLevel()
|
||||
{
|
||||
yield return new WaitForSeconds(4);
|
||||
SceneManager.LoadScene(1);
|
||||
}
|
||||
|
||||
private void ExitApp()
|
||||
{
|
||||
Application.Quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user