This repository has been archived on 2023-09-13. You can view files and clone it, but cannot push or open issues or pull requests.
station_obscurum_unity/Assets/Scripts/MainMenu/LobbyManager.cs

55 lines
1.2 KiB
C#
Raw Permalink Normal View History

2023-06-02 06:30:58 +02:00
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();
}
}
}
}