GameManager WIP
This commit is contained in:
parent
c8b7b702d7
commit
01804c4724
@ -1,29 +1,119 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This is the game state manager on the phone side
|
||||||
|
/// </summary>
|
||||||
public class GameManager : MonoBehaviour
|
public class GameManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
// Start is called before the first frame update
|
private GameState currentState;
|
||||||
void Start()
|
private List<Player> players = new List<Player>();
|
||||||
|
|
||||||
|
public float explanationTime = 4f;
|
||||||
|
private float currentExplanationTime = 0;
|
||||||
|
|
||||||
|
public InputField roomCodeField;
|
||||||
|
public TextMeshProUGUI roomError;
|
||||||
|
public InputField playerNameField;
|
||||||
|
public TextMeshProUGUI nameError;
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
currentExplanationTime = explanationTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GameState GetCurrentState()
|
||||||
|
{
|
||||||
|
return currentState;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Send your name and game room to the server
|
||||||
|
/// </summary>
|
||||||
|
public void PlayerValidateNameAndServerRoom()
|
||||||
|
{
|
||||||
|
//check if the room exists, if not display an error message
|
||||||
|
|
||||||
|
//if succeed, then the player to the server
|
||||||
|
|
||||||
|
//if succeed, change the state and change page
|
||||||
|
currentState = GameState.WaitingForOtherPlayersToJoin;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Call this only by the first player
|
||||||
|
/// </summary>
|
||||||
|
public void StartGame()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
/// <summary>
|
||||||
void Update()
|
/// Dislay on the screen the current prompt ask to you and another player
|
||||||
|
/// Also show all the camera stuff
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="_prompt">The prompt to display</param>
|
||||||
|
public void MakeAProposition(Prompt _prompt)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a proposition from the picture taken and send it to server.
|
||||||
|
/// Then go to next proposition (if any) or the page "WaitingForOtherPlayers"
|
||||||
|
/// </summary>
|
||||||
|
public void SubmitProposition()
|
||||||
|
{
|
||||||
|
Proposition temp = new Proposition();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Display the voting page
|
||||||
|
/// </summary>
|
||||||
|
public void StartToVote()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Choose one result and send it to the server
|
||||||
|
/// Then go to the next vote (if any) or to the page "WaitingForOtherPlayers"
|
||||||
|
/// </summary>
|
||||||
|
public void Vote()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Display the UI of the end screen
|
||||||
|
/// </summary>
|
||||||
|
public void DisplayEndScreen()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Automatically called when something change in your room
|
||||||
|
/// </summary>
|
||||||
|
private void OnRoomUpdate()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum GameState
|
public enum GameState
|
||||||
{
|
{
|
||||||
EnteringName,
|
EnteringName,
|
||||||
WaitingForOtherPlayers,
|
WaitingForOtherPlayersToJoin,
|
||||||
Explanation,
|
Explanation,
|
||||||
MakeProposition,
|
MakeProposition,
|
||||||
PropositionSent,
|
PropositionsSent,
|
||||||
|
WaitingForOtherPlayers,
|
||||||
VotingTime,
|
VotingTime,
|
||||||
Ending
|
Ending
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user