55 lines
1.2 KiB
C#
55 lines
1.2 KiB
C#
|
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();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|