From 7cd731697a379b4ebbd6e6dafee21b7a27a7dce5 Mon Sep 17 00:00:00 2001 From: Morgan - 6 Freedom Date: Sat, 27 Jan 2024 13:19:56 +0100 Subject: [PATCH] WIP of room manager --- Assets/Scripts/GameManager.cs | 31 ++++++++ Assets/Scripts/GameManager.cs.meta | 11 +++ Assets/Scripts/RoomManager.cs | 123 ++++++++++++++++++++++++++++- 3 files changed, 161 insertions(+), 4 deletions(-) create mode 100644 Assets/Scripts/GameManager.cs create mode 100644 Assets/Scripts/GameManager.cs.meta diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs new file mode 100644 index 0000000..241d70d --- /dev/null +++ b/Assets/Scripts/GameManager.cs @@ -0,0 +1,31 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class GameManager : MonoBehaviour +{ + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + + } +} + +public enum GameState +{ + EnteringName, + WaitingForOtherPlayers, + Explanation, + MakeProposition, + PropositionSent, + VotingTime, + Ending +} + + diff --git a/Assets/Scripts/GameManager.cs.meta b/Assets/Scripts/GameManager.cs.meta new file mode 100644 index 0000000..26ada3c --- /dev/null +++ b/Assets/Scripts/GameManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 27a435387a7644784a6fc6ae538b68e5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/RoomManager.cs b/Assets/Scripts/RoomManager.cs index 715ad5a..aeb1abf 100644 --- a/Assets/Scripts/RoomManager.cs +++ b/Assets/Scripts/RoomManager.cs @@ -4,16 +4,131 @@ public class RoomManager : MonoBehaviour { + private RoomState currentState; + private List players; - // Start is called before the first frame update - void Start() + public float propositionTime = 60; + public float votingTime = 20; + + private float propositionCurrentTime = 0; + private float votingCurrentTime = 0; + + /// + /// Contain the infos about the current displayed question (during votes) + /// + private Question currentQuestion; + + private List questions; + + /// + /// When this is equal to questions.Count, go to score page + /// + private int numberOfQuestionVoted = 0; + + + private void Start() + { + propositionCurrentTime = propositionTime; + votingCurrentTime = votingTime; + } + + public void PlayerSendProposition(Proposition _proposition) { } - // Update is called once per frame - void Update() + /// + /// Called when the first player clicked "Start" + /// + public void HostStartGame() { } + + /// + /// Start the proposition timer + /// + public void StartPropositionTimer() + { + + } + + + /// + /// Automatically called when the proposition timer has finished + /// + public void PropositionTimerFinished() + { + + } + + /// + /// Start the voting timer + /// + public void StartVotingTimer() + { + + } + + + /// + /// Automatically called when the voting timer has finished + /// + public void VotingTimerFinished() + { + + } + + /// + /// Automatically called when a proposition is updated (someone has voted or a picture has been proposed) + /// + public void OnPropositionUpdate() + { + + } + + /// + /// Will generate a question with a prompt and two owners + /// + public void GenerateQuestion() + { + + } + + /// + /// Generate all the player pairs + /// (players should not play against themself. + /// (players should not play twice with the same person) + /// + public void GenerateCouples() + { + + } + + /// + /// is automatically called when a player connect to the room + /// + /// + public void PlayerConnect(Player _player) + { + + } + + [ContextMenu("Fake Player Connection")] + private void FakePlayerConnection() + { + Player temp = new Player(); + temp.id = System.Guid.NewGuid().ToString(); + temp.SetName("Momo"); + } + +} + +public enum RoomState +{ + WaitingForPlayer, + WaitingForPropositions, + ShowPropositions, + ShowVoters, + Score }