mirror of
https://github.com/DerTyp7/defrain-shooter-unity.git
synced 2025-10-29 12:52:07 +01:00
Ready Up and Clean Up
This commit is contained in:
@@ -38,7 +38,7 @@ RenderSettings:
|
|||||||
m_ReflectionIntensity: 1
|
m_ReflectionIntensity: 1
|
||||||
m_CustomReflection: {fileID: 0}
|
m_CustomReflection: {fileID: 0}
|
||||||
m_Sun: {fileID: 0}
|
m_Sun: {fileID: 0}
|
||||||
m_IndirectSpecularColor: {r: 0.44657826, g: 0.49641263, b: 0.57481676, a: 1}
|
m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
|
||||||
m_UseRadianceAmbientProbe: 0
|
m_UseRadianceAmbientProbe: 0
|
||||||
--- !u!157 &3
|
--- !u!157 &3
|
||||||
LightmapSettings:
|
LightmapSettings:
|
||||||
@@ -1100,7 +1100,7 @@ Camera:
|
|||||||
m_GameObject: {fileID: 958699927}
|
m_GameObject: {fileID: 958699927}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_ClearFlags: 1
|
m_ClearFlags: 3
|
||||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||||
m_projectionMatrixMode: 1
|
m_projectionMatrixMode: 1
|
||||||
m_GateFitMode: 2
|
m_GateFitMode: 2
|
||||||
@@ -1122,7 +1122,7 @@ Camera:
|
|||||||
m_Depth: -1
|
m_Depth: -1
|
||||||
m_CullingMask:
|
m_CullingMask:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Bits: 4294967295
|
m_Bits: 32
|
||||||
m_RenderingPath: -1
|
m_RenderingPath: -1
|
||||||
m_TargetTexture: {fileID: 0}
|
m_TargetTexture: {fileID: 0}
|
||||||
m_TargetDisplay: 0
|
m_TargetDisplay: 0
|
||||||
@@ -1604,7 +1604,7 @@ GameObject:
|
|||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 0
|
m_IsActive: 1
|
||||||
--- !u!224 &1223089884
|
--- !u!224 &1223089884
|
||||||
RectTransform:
|
RectTransform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -2094,7 +2094,7 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
m_Material: {fileID: 0}
|
m_Material: {fileID: 0}
|
||||||
m_Color: {r: 0.17254902, g: 0.18431373, b: 0.2, a: 1}
|
m_Color: {r: 0.13314347, g: 0.13314347, b: 0.1509434, a: 1}
|
||||||
m_RaycastTarget: 1
|
m_RaycastTarget: 1
|
||||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||||
m_Maskable: 1
|
m_Maskable: 1
|
||||||
@@ -2203,7 +2203,7 @@ GameObject:
|
|||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 1
|
m_IsActive: 0
|
||||||
--- !u!224 &1813956224
|
--- !u!224 &1813956224
|
||||||
RectTransform:
|
RectTransform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -993,6 +993,10 @@ PrefabInstance:
|
|||||||
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_CallState
|
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_CallState
|
||||||
value: 2
|
value: 2
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8076035533974620946, guid: a973691757099224ca132b32daabf67c, type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: RdyBtnText
|
||||||
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: a973691757099224ca132b32daabf67c, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: a973691757099224ca132b32daabf67c, type: 3}
|
||||||
--- !u!224 &594583494 stripped
|
--- !u!224 &594583494 stripped
|
||||||
@@ -1000,6 +1004,17 @@ RectTransform:
|
|||||||
m_CorrespondingSourceObject: {fileID: 2454942472495841689, guid: a973691757099224ca132b32daabf67c, type: 3}
|
m_CorrespondingSourceObject: {fileID: 2454942472495841689, guid: a973691757099224ca132b32daabf67c, type: 3}
|
||||||
m_PrefabInstance: {fileID: 594583493}
|
m_PrefabInstance: {fileID: 594583493}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
--- !u!114 &594583495 stripped
|
||||||
|
MonoBehaviour:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 1513820883277351791, guid: a973691757099224ca132b32daabf67c, type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 594583493}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
--- !u!1 &949082596
|
--- !u!1 &949082596
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -1238,6 +1253,11 @@ CanvasRenderer:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1185775522}
|
m_GameObject: {fileID: 1185775522}
|
||||||
m_CullTransparentMesh: 1
|
m_CullTransparentMesh: 1
|
||||||
|
--- !u!1 &1197550804 stripped
|
||||||
|
GameObject:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 759482234963316101, guid: a973691757099224ca132b32daabf67c, type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 594583493}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
--- !u!1 &1234182190
|
--- !u!1 &1234182190
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -2330,6 +2350,14 @@ PrefabInstance:
|
|||||||
propertyPath: sceneId
|
propertyPath: sceneId
|
||||||
value: 2342159728
|
value: 2342159728
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7129514368576730103, guid: af2b86e6ca1c8404a857e6bfa4294f3c, type: 3}
|
||||||
|
propertyPath: rdyButton
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 1197550804}
|
||||||
|
- target: {fileID: 7129514368576730103, guid: af2b86e6ca1c8404a857e6bfa4294f3c, type: 3}
|
||||||
|
propertyPath: rdyButtonText
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 594583495}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: af2b86e6ca1c8404a857e6bfa4294f3c, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: af2b86e6ca1c8404a857e6bfa4294f3c, type: 3}
|
||||||
--- !u!1001 &7946605864942981377
|
--- !u!1001 &7946605864942981377
|
||||||
|
|||||||
@@ -1,26 +1,62 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Mirror;
|
using Mirror;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
|
|
||||||
|
|
||||||
|
/* TODO:
|
||||||
|
* - Changing Lobby Title Objects causes bugs on client
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The Lobby Class is used to give all LobbyPlayer an instance above them for managing purposes.
|
||||||
|
* You could write this into a NetworkManager, but I thought it would be nicer in a seperate script.
|
||||||
|
*/
|
||||||
|
|
||||||
public class Lobby : NetworkBehaviour
|
public class Lobby : NetworkBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField]
|
// Sync Vars
|
||||||
public List<LobbyPlayer> LobbyPlayers = new List<LobbyPlayer>();
|
[SyncVar] //A list of all connected player
|
||||||
|
public List<LobbyPlayer> LobbyPlayers = new List<LobbyPlayer>(); // All player a register themselves when they join (LobbyPlayer.cs)
|
||||||
|
|
||||||
[SyncVar(hook = "ChangeTitle")]
|
[SyncVar(hook = "ChangeTitle")]
|
||||||
[SerializeField] private string lobbyTitle;
|
[SerializeField] string lobbyTitle; // Title/Name of the Lobby; Can only be changed by the host, because of "AuthHost"
|
||||||
|
|
||||||
public bool AuthHost(LobbyPlayer player)
|
[SyncVar]
|
||||||
|
public bool allReady = false; // All players are ready?
|
||||||
|
|
||||||
|
|
||||||
|
void Update()
|
||||||
{
|
{
|
||||||
if(LobbyPlayers.IndexOf(player) == 0)
|
CheckLobbyPlayers(); // Checking the LobbyPlayer List
|
||||||
|
allReady = CheckAllReady(); // Continous checking if all player are ready
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StartGame() // initializes the In-Game Scene and converts LobbyPlayers to GamePlayers
|
||||||
|
{
|
||||||
|
Debug.Log("START");
|
||||||
|
/* https://youtu.be/HZIzGLe-2f4?t=586
|
||||||
|
* Start Loading Panel
|
||||||
|
* Destroy LobbyPlayer
|
||||||
|
* Instatiate Player Objects and connect them to "conn"
|
||||||
|
* Switch Scene
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
#region LobbyPlayer Interaction (Public)
|
||||||
|
/* Public (Where the LobbyPlayer interacts with) */
|
||||||
|
public bool AuthHost(LobbyPlayer player) // Checks if player is the host
|
||||||
|
{
|
||||||
|
// In theory the host should always be the first connected player, which means he is index 0 in the LobbyPlayers-List
|
||||||
|
if (LobbyPlayers.IndexOf(player) == 0)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetTitle(LobbyPlayer player, string text)
|
public void SetTitle(LobbyPlayer player, string text) // the host can set the LobbyTitle
|
||||||
{
|
{
|
||||||
if (AuthHost(player))
|
if (AuthHost(player))
|
||||||
{
|
{
|
||||||
@@ -28,13 +64,44 @@ public class Lobby : NetworkBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegisterPlayer(LobbyPlayer player)
|
public void RegisterPlayer(LobbyPlayer player) // Where a Player can register himself
|
||||||
{
|
{
|
||||||
LobbyPlayers.Add(player);
|
LobbyPlayers.Add(player);
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
public void ChangeTitle(string oldTitle, string newTitle)
|
#region checks
|
||||||
|
/* Checks */
|
||||||
|
bool CheckAllReady() // Checks if all players are ready
|
||||||
|
{
|
||||||
|
// Check if all players are ready (if a player is not ready)
|
||||||
|
foreach (LobbyPlayer player in LobbyPlayers)
|
||||||
|
{
|
||||||
|
if (!player.ready)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CheckLobbyPlayers() // Checks if all LobbyPlayers in the list are still connected (having a GameObject) -> Clears missing players
|
||||||
|
{
|
||||||
|
foreach(LobbyPlayer player in LobbyPlayers)
|
||||||
|
{
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
LobbyPlayers.Remove(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region hooks
|
||||||
|
/* HOOKS */
|
||||||
|
void ChangeTitle(string oldTitle, string newTitle) // Changes the Title Object
|
||||||
{
|
{
|
||||||
GameObject.Find("title").GetComponent<TextMeshProUGUI>().text = newTitle;
|
GameObject.Find("title").GetComponent<TextMeshProUGUI>().text = newTitle;
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,74 +1,116 @@
|
|||||||
using Mirror;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI; // For <Button>
|
||||||
|
using Mirror;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine.UI;
|
|
||||||
|
/*
|
||||||
|
* This class manages the LobbyPlayer, which is the player object while the player is connected only to the lobby
|
||||||
|
* AND is not IN-GAME (just a text-based player)!
|
||||||
|
* this LobbyPlayer will get converted into a Player/GamePlayer for in-game use.
|
||||||
|
*/
|
||||||
|
|
||||||
public class LobbyPlayer : NetworkBehaviour
|
public class LobbyPlayer : NetworkBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField] private Button rdyBtn;
|
// UI Objects
|
||||||
[SerializeField] private TextMeshProUGUI usernameText;
|
[SerializeField] Button rdyBtn; // Button Object for listeners
|
||||||
[SerializeField] private TextMeshProUGUI rdyText;
|
[SerializeField] TextMeshProUGUI rdyButtonText; // Seperatly getting the text, because it's safer instead of "rdy.Btn.getChild..."
|
||||||
|
|
||||||
[SerializeField] private Button team1Btn;
|
[SerializeField] TextMeshProUGUI usernameText; // Username Text Object -> Where the Username of every LobbyPlayer will get displayed
|
||||||
[SerializeField] private Button team2Btn;
|
[SerializeField] TextMeshProUGUI rdyText; // Ready Text Object -> Where the Ready-State of every LobbyPlayer will get displayed
|
||||||
|
|
||||||
|
[SerializeField] Button team1Btn; // Join Team 1 Button
|
||||||
|
[SerializeField] Button team2Btn; // Join Team 2 Button
|
||||||
|
|
||||||
|
// Sync vars
|
||||||
[SyncVar(hook = "DisplayPlayerName")]
|
[SyncVar(hook = "DisplayPlayerName")]
|
||||||
[SerializeField] public string username;
|
[SerializeField] public string username;
|
||||||
|
|
||||||
[SyncVar(hook = "ChangeReadyState")]
|
[SyncVar(hook = "ChangeReadyState")]
|
||||||
[SerializeField] bool ready = false;
|
public bool ready = false; // is the LobbyPlayer ready?
|
||||||
|
|
||||||
[SyncVar(hook = "ChangeDisplayTeam")]
|
[SyncVar(hook = "ChangeDisplayTeam")]
|
||||||
[SerializeField] int teamId = 0;
|
[SerializeField] int teamId = 0; // which team did the player choose?
|
||||||
|
|
||||||
|
// Vars
|
||||||
Lobby lobby;
|
Lobby lobby;
|
||||||
|
|
||||||
public override void OnStartClient()
|
public override void OnStartClient()
|
||||||
{
|
{
|
||||||
lobby = GameObject.Find("LobbyManager").GetComponent<Lobby>();
|
lobby = GameObject.Find("LobbyManager").GetComponent<Lobby>(); // Get the Lobby Object in Scene
|
||||||
lobby.RegisterPlayer(this);
|
lobby.RegisterPlayer(this); // Register the LobbyPlayer, so the lobby can store him in a list for future use
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
if (isLocalPlayer)
|
if (isLocalPlayer)
|
||||||
{
|
{
|
||||||
VariableSaver vs = GameObject.FindGameObjectWithTag("VariableSaver").GetComponent<VariableSaver>();
|
/*
|
||||||
|
* The Varaible Saver is used to store vars across different scenes and Player-Objects(LobbyPlayer/GamePlayer).
|
||||||
|
* In this case it's used to get the values of the players BEFORE they joined the server.
|
||||||
|
* -> username input field
|
||||||
|
*/
|
||||||
|
VariableSaver vs = GameObject.FindGameObjectWithTag("VariableSaver").GetComponent<VariableSaver>();
|
||||||
|
|
||||||
|
// Find GameObjects in Scene BY NAME
|
||||||
rdyBtn = GameObject.Find("ReadyButton").GetComponent<Button>();
|
rdyBtn = GameObject.Find("ReadyButton").GetComponent<Button>();
|
||||||
rdyBtn.onClick.AddListener(CmdChangeReady);
|
rdyButtonText = GameObject.Find("RdyBtnText").GetComponent<TextMeshProUGUI>();
|
||||||
CmdSendName(vs.username);
|
|
||||||
lobby.SetTitle(this, "Game Of\n" + username);
|
|
||||||
team1Btn = GameObject.Find("Team1Btn").GetComponent<Button>();
|
team1Btn = GameObject.Find("Team1Btn").GetComponent<Button>();
|
||||||
team2Btn = GameObject.Find("Team2Btn").GetComponent<Button>();
|
team2Btn = GameObject.Find("Team2Btn").GetComponent<Button>();
|
||||||
|
|
||||||
|
// Set Button Listeners
|
||||||
|
rdyBtn.onClick.AddListener(CmdChangeReady);
|
||||||
team1Btn.onClick.AddListener(delegate { SelectTeam(1); });
|
team1Btn.onClick.AddListener(delegate { SelectTeam(1); });
|
||||||
team2Btn.onClick.AddListener(delegate { SelectTeam(2); });
|
team2Btn.onClick.AddListener(delegate { SelectTeam(2); });
|
||||||
|
|
||||||
|
// Send the username from the local variable saver to the synced var
|
||||||
|
CmdSendName(vs.username);
|
||||||
|
|
||||||
|
// Set the lobby title -> only works if you're the host
|
||||||
|
lobby.SetTitle(this, "Game Of\n" + username);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command]
|
void Update()
|
||||||
public void CmdSendName(string playerName)
|
|
||||||
{
|
{
|
||||||
username = playerName;
|
if (isLocalPlayer)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Update the "Ready-Button":
|
||||||
|
* Change the text based on host or client / ready or not ready.
|
||||||
|
* Adds and removes Start Listener to the hosts button
|
||||||
|
*/
|
||||||
|
|
||||||
|
rdyBtn.onClick.RemoveListener(CmdStartGame); // Clear listener
|
||||||
|
if (lobby.AuthHost(this) && lobby.allReady) // If all players are ready and your the host
|
||||||
|
{
|
||||||
|
rdyBtn.onClick.AddListener(CmdStartGame);
|
||||||
|
rdyButtonText.SetText("Start");
|
||||||
|
}
|
||||||
|
else // You are not the host OR not all Players are ready
|
||||||
|
{
|
||||||
|
if (ready) // You are already ready
|
||||||
|
{
|
||||||
|
rdyButtonText.SetText("Un-Ready");
|
||||||
|
}
|
||||||
|
else // You are not ready
|
||||||
|
{
|
||||||
|
rdyButtonText.SetText("Ready");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command]
|
#region hooks
|
||||||
public void CmdChangeReady()
|
/* HOOKS */
|
||||||
|
public void DisplayPlayerName(string oldName, string newName) // Changes the text value of the Player-Username-GameObject
|
||||||
{
|
{
|
||||||
ready = !ready;
|
Debug.Log("Player changed name from " + oldName + " to " + newName); // Just for debug -> No future use
|
||||||
|
usernameText.text = newName; // sets the new text in the gameobject
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command]
|
public void ChangeReadyState(bool oldState, bool newState) // Changes the Ready-Text-Object of the player
|
||||||
public void SelectTeam(int _teamId)
|
|
||||||
{
|
|
||||||
teamId = _teamId;
|
|
||||||
}
|
|
||||||
public void DisplayPlayerName(string oldName, string newName)
|
|
||||||
{
|
|
||||||
Debug.Log("Player changed name from " + oldName + " to " + newName);
|
|
||||||
usernameText.text = newName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ChangeReadyState(bool oldState, bool newState)
|
|
||||||
{
|
{
|
||||||
|
// sets the new text based on the ready state of the player
|
||||||
if (newState)
|
if (newState)
|
||||||
{
|
{
|
||||||
rdyText.text = "Ready";
|
rdyText.text = "Ready";
|
||||||
@@ -77,17 +119,49 @@ public class LobbyPlayer : NetworkBehaviour
|
|||||||
{
|
{
|
||||||
rdyText.text = "Not Ready";
|
rdyText.text = "Not Ready";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ChangeDisplayTeam(int oldTeamId, int newTeamId)
|
public void ChangeDisplayTeam(int oldTeamId, int newTeamId) // moves the player into the correct team-list
|
||||||
{
|
{
|
||||||
if(newTeamId == 1)
|
// moves the player based on which team he has choosen
|
||||||
|
if (newTeamId == 1)
|
||||||
{
|
{
|
||||||
gameObject.transform.parent = GameObject.FindGameObjectWithTag("Team1List").transform;
|
gameObject.transform.parent = GameObject.FindGameObjectWithTag("Team1List").transform;
|
||||||
}else if(newTeamId == 2)
|
}
|
||||||
|
else if (newTeamId == 2)
|
||||||
{
|
{
|
||||||
gameObject.transform.parent = GameObject.FindGameObjectWithTag("Team2List").transform;
|
gameObject.transform.parent = GameObject.FindGameObjectWithTag("Team2List").transform;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region commands
|
||||||
|
/* COMMANDS */
|
||||||
|
[Command]
|
||||||
|
void CmdStartGame()
|
||||||
|
{
|
||||||
|
if (lobby.AuthHost(this))
|
||||||
|
{
|
||||||
|
lobby.StartGame();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command]
|
||||||
|
void CmdSendName(string playerName) //Send/Set the username from local to the synced var
|
||||||
|
{
|
||||||
|
username = playerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command]
|
||||||
|
void CmdChangeReady() // Updates the Ready-State of the Player (Synced Var)
|
||||||
|
{
|
||||||
|
ready = !ready;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command]
|
||||||
|
void SelectTeam(int _teamId) // Updates the team of the Player (Synced Var)
|
||||||
|
{
|
||||||
|
teamId = _teamId;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: c84dd6fea7b1a564dac024e85dee0f66
|
guid: 8200a488f55a39a46852e1266a825379
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
18
Assets/Scripts/Lobby/LobbyStartGame.cs
Normal file
18
Assets/Scripts/Lobby/LobbyStartGame.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class ReadyUp : MonoBehaviour
|
||||||
|
{
|
||||||
|
// Start is called before the first frame update
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/Lobby/LobbyStartGame.cs.meta
Normal file
11
Assets/Scripts/Lobby/LobbyStartGame.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 435efa23db9058e4ba98afefb0f5f72e
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 887196b8fb0b9eb4d9672b1ca0861e34
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -119,7 +119,7 @@ MonoBehaviour:
|
|||||||
m_MinSize: {x: 300, y: 200}
|
m_MinSize: {x: 300, y: 200}
|
||||||
m_MaxSize: {x: 24288, y: 16192}
|
m_MaxSize: {x: 24288, y: 16192}
|
||||||
vertical: 0
|
vertical: 0
|
||||||
controlID: 185
|
controlID: 72
|
||||||
--- !u!114 &6
|
--- !u!114 &6
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 52
|
m_ObjectHideFlags: 52
|
||||||
@@ -139,12 +139,12 @@ MonoBehaviour:
|
|||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
x: 0
|
x: 0
|
||||||
y: 0
|
y: 0
|
||||||
width: 1527
|
width: 1480
|
||||||
height: 939
|
height: 939
|
||||||
m_MinSize: {x: 200, y: 200}
|
m_MinSize: {x: 200, y: 200}
|
||||||
m_MaxSize: {x: 16192, y: 16192}
|
m_MaxSize: {x: 16192, y: 16192}
|
||||||
vertical: 1
|
vertical: 1
|
||||||
controlID: 186
|
controlID: 73
|
||||||
--- !u!114 &7
|
--- !u!114 &7
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 52
|
m_ObjectHideFlags: 52
|
||||||
@@ -164,12 +164,12 @@ MonoBehaviour:
|
|||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
x: 0
|
x: 0
|
||||||
y: 0
|
y: 0
|
||||||
width: 1527
|
width: 1480
|
||||||
height: 564
|
height: 572
|
||||||
m_MinSize: {x: 200, y: 100}
|
m_MinSize: {x: 200, y: 100}
|
||||||
m_MaxSize: {x: 16192, y: 8096}
|
m_MaxSize: {x: 16192, y: 8096}
|
||||||
vertical: 0
|
vertical: 0
|
||||||
controlID: 238
|
controlID: 47
|
||||||
--- !u!114 &8
|
--- !u!114 &8
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 52
|
m_ObjectHideFlags: 52
|
||||||
@@ -187,10 +187,10 @@ MonoBehaviour:
|
|||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
x: 0
|
x: 0
|
||||||
y: 0
|
y: 0
|
||||||
width: 277
|
width: 324
|
||||||
height: 564
|
height: 572
|
||||||
m_MinSize: {x: 200, y: 200}
|
m_MinSize: {x: 201, y: 221}
|
||||||
m_MaxSize: {x: 4000, y: 4000}
|
m_MaxSize: {x: 4001, y: 4021}
|
||||||
m_ActualView: {fileID: 13}
|
m_ActualView: {fileID: 13}
|
||||||
m_Panes:
|
m_Panes:
|
||||||
- {fileID: 13}
|
- {fileID: 13}
|
||||||
@@ -211,12 +211,12 @@ MonoBehaviour:
|
|||||||
m_Children: []
|
m_Children: []
|
||||||
m_Position:
|
m_Position:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
x: 277
|
x: 324
|
||||||
y: 0
|
y: 0
|
||||||
width: 1250
|
width: 1156
|
||||||
height: 564
|
height: 572
|
||||||
m_MinSize: {x: 200, y: 200}
|
m_MinSize: {x: 202, y: 221}
|
||||||
m_MaxSize: {x: 4000, y: 4000}
|
m_MaxSize: {x: 4002, y: 4021}
|
||||||
m_ActualView: {fileID: 12}
|
m_ActualView: {fileID: 12}
|
||||||
m_Panes:
|
m_Panes:
|
||||||
- {fileID: 14}
|
- {fileID: 14}
|
||||||
@@ -239,9 +239,9 @@ MonoBehaviour:
|
|||||||
m_Position:
|
m_Position:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
x: 0
|
x: 0
|
||||||
y: 564
|
y: 572
|
||||||
width: 1527
|
width: 1480
|
||||||
height: 375
|
height: 367
|
||||||
m_MinSize: {x: 231, y: 271}
|
m_MinSize: {x: 231, y: 271}
|
||||||
m_MaxSize: {x: 10001, y: 10021}
|
m_MaxSize: {x: 10001, y: 10021}
|
||||||
m_ActualView: {fileID: 15}
|
m_ActualView: {fileID: 15}
|
||||||
@@ -265,12 +265,12 @@ MonoBehaviour:
|
|||||||
m_Children: []
|
m_Children: []
|
||||||
m_Position:
|
m_Position:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
x: 1527
|
x: 1480
|
||||||
y: 0
|
y: 0
|
||||||
width: 393
|
width: 440
|
||||||
height: 939
|
height: 939
|
||||||
m_MinSize: {x: 275, y: 50}
|
m_MinSize: {x: 276, y: 71}
|
||||||
m_MaxSize: {x: 4000, y: 4000}
|
m_MaxSize: {x: 4001, y: 4021}
|
||||||
m_ActualView: {fileID: 17}
|
m_ActualView: {fileID: 17}
|
||||||
m_Panes:
|
m_Panes:
|
||||||
- {fileID: 17}
|
- {fileID: 17}
|
||||||
@@ -296,10 +296,10 @@ MonoBehaviour:
|
|||||||
m_Tooltip:
|
m_Tooltip:
|
||||||
m_Pos:
|
m_Pos:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
x: 277
|
x: 324
|
||||||
y: 73
|
y: 73
|
||||||
width: 1248
|
width: 1154
|
||||||
height: 543
|
height: 551
|
||||||
m_ViewDataDictionary: {fileID: 0}
|
m_ViewDataDictionary: {fileID: 0}
|
||||||
m_OverlayCanvas:
|
m_OverlayCanvas:
|
||||||
m_LastAppliedPresetName: Default
|
m_LastAppliedPresetName: Default
|
||||||
@@ -310,7 +310,7 @@ MonoBehaviour:
|
|||||||
m_ShowGizmos: 0
|
m_ShowGizmos: 0
|
||||||
m_TargetDisplay: 0
|
m_TargetDisplay: 0
|
||||||
m_ClearColor: {r: 0, g: 0, b: 0, a: 0}
|
m_ClearColor: {r: 0, g: 0, b: 0, a: 0}
|
||||||
m_TargetSize: {x: 928, y: 522}
|
m_TargetSize: {x: 942, y: 530}
|
||||||
m_TextureFilterMode: 0
|
m_TextureFilterMode: 0
|
||||||
m_TextureHideFlags: 61
|
m_TextureHideFlags: 61
|
||||||
m_RenderIMGUI: 1
|
m_RenderIMGUI: 1
|
||||||
@@ -325,10 +325,10 @@ MonoBehaviour:
|
|||||||
m_VRangeLocked: 0
|
m_VRangeLocked: 0
|
||||||
hZoomLockedByDefault: 0
|
hZoomLockedByDefault: 0
|
||||||
vZoomLockedByDefault: 0
|
vZoomLockedByDefault: 0
|
||||||
m_HBaseRangeMin: -464
|
m_HBaseRangeMin: -471
|
||||||
m_HBaseRangeMax: 464
|
m_HBaseRangeMax: 471
|
||||||
m_VBaseRangeMin: -261
|
m_VBaseRangeMin: -265
|
||||||
m_VBaseRangeMax: 261
|
m_VBaseRangeMax: 265
|
||||||
m_HAllowExceedBaseRangeMin: 1
|
m_HAllowExceedBaseRangeMin: 1
|
||||||
m_HAllowExceedBaseRangeMax: 1
|
m_HAllowExceedBaseRangeMax: 1
|
||||||
m_VAllowExceedBaseRangeMin: 1
|
m_VAllowExceedBaseRangeMin: 1
|
||||||
@@ -346,23 +346,23 @@ MonoBehaviour:
|
|||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
x: 0
|
x: 0
|
||||||
y: 21
|
y: 21
|
||||||
width: 1248
|
width: 1154
|
||||||
height: 522
|
height: 530
|
||||||
m_Scale: {x: 1, y: 1}
|
m_Scale: {x: 1, y: 1}
|
||||||
m_Translation: {x: 624, y: 261}
|
m_Translation: {x: 577, y: 265}
|
||||||
m_MarginLeft: 0
|
m_MarginLeft: 0
|
||||||
m_MarginRight: 0
|
m_MarginRight: 0
|
||||||
m_MarginTop: 0
|
m_MarginTop: 0
|
||||||
m_MarginBottom: 0
|
m_MarginBottom: 0
|
||||||
m_LastShownAreaInsideMargins:
|
m_LastShownAreaInsideMargins:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
x: -624
|
x: -577
|
||||||
y: -261
|
y: -265
|
||||||
width: 1248
|
width: 1154
|
||||||
height: 522
|
height: 530
|
||||||
m_MinimalGUI: 1
|
m_MinimalGUI: 1
|
||||||
m_defaultScale: 1
|
m_defaultScale: 1
|
||||||
m_LastWindowPixelSize: {x: 1248, y: 543}
|
m_LastWindowPixelSize: {x: 1154, y: 551}
|
||||||
m_ClearInEditMode: 1
|
m_ClearInEditMode: 1
|
||||||
m_NoCameraWarning: 1
|
m_NoCameraWarning: 1
|
||||||
m_LowResolutionForAspectRatios: 01000000000000000000
|
m_LowResolutionForAspectRatios: 01000000000000000000
|
||||||
@@ -390,8 +390,8 @@ MonoBehaviour:
|
|||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
x: 0
|
x: 0
|
||||||
y: 73
|
y: 73
|
||||||
width: 276
|
width: 323
|
||||||
height: 543
|
height: 551
|
||||||
m_ViewDataDictionary: {fileID: 0}
|
m_ViewDataDictionary: {fileID: 0}
|
||||||
m_OverlayCanvas:
|
m_OverlayCanvas:
|
||||||
m_LastAppliedPresetName: Default
|
m_LastAppliedPresetName: Default
|
||||||
@@ -399,9 +399,9 @@ MonoBehaviour:
|
|||||||
m_SceneHierarchy:
|
m_SceneHierarchy:
|
||||||
m_TreeViewState:
|
m_TreeViewState:
|
||||||
scrollPos: {x: 0, y: 0}
|
scrollPos: {x: 0, y: 0}
|
||||||
m_SelectedIDs: a40d0000
|
m_SelectedIDs: a65f0000
|
||||||
m_LastClickedID: 0
|
m_LastClickedID: 0
|
||||||
m_ExpandedIDs: 80d3ffff26f5ffff2afbffffc25e0000
|
m_ExpandedIDs: 5af4ffff2afbffff
|
||||||
m_RenameOverlay:
|
m_RenameOverlay:
|
||||||
m_UserAcceptedRename: 0
|
m_UserAcceptedRename: 0
|
||||||
m_Name:
|
m_Name:
|
||||||
@@ -417,7 +417,7 @@ MonoBehaviour:
|
|||||||
m_IsRenaming: 0
|
m_IsRenaming: 0
|
||||||
m_OriginalEventType: 11
|
m_OriginalEventType: 11
|
||||||
m_IsRenamingFilename: 0
|
m_IsRenamingFilename: 0
|
||||||
m_ClientGUIView: {fileID: 8}
|
m_ClientGUIView: {fileID: 9}
|
||||||
m_SearchString:
|
m_SearchString:
|
||||||
m_ExpandedScenes: []
|
m_ExpandedScenes: []
|
||||||
m_CurrenRootInstanceID: 0
|
m_CurrenRootInstanceID: 0
|
||||||
@@ -445,10 +445,10 @@ MonoBehaviour:
|
|||||||
m_Tooltip:
|
m_Tooltip:
|
||||||
m_Pos:
|
m_Pos:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
x: 277
|
x: 324
|
||||||
y: 73
|
y: 73
|
||||||
width: 1248
|
width: 1154
|
||||||
height: 543
|
height: 551
|
||||||
m_ViewDataDictionary: {fileID: 0}
|
m_ViewDataDictionary: {fileID: 0}
|
||||||
m_OverlayCanvas:
|
m_OverlayCanvas:
|
||||||
m_LastAppliedPresetName: Default
|
m_LastAppliedPresetName: Default
|
||||||
@@ -661,9 +661,9 @@ MonoBehaviour:
|
|||||||
m_PlayAudio: 0
|
m_PlayAudio: 0
|
||||||
m_AudioPlay: 0
|
m_AudioPlay: 0
|
||||||
m_Position:
|
m_Position:
|
||||||
m_Target: {x: -1.4526107, y: 2.736337, z: 75.25916}
|
m_Target: {x: -5.779419, y: 0.3400351, z: 1.0832585}
|
||||||
speed: 2
|
speed: 2
|
||||||
m_Value: {x: -1.4526107, y: 2.736337, z: 75.25916}
|
m_Value: {x: -5.779419, y: 0.3400351, z: 1.0832585}
|
||||||
m_RenderMode: 0
|
m_RenderMode: 0
|
||||||
m_CameraMode:
|
m_CameraMode:
|
||||||
drawMode: 0
|
drawMode: 0
|
||||||
@@ -714,9 +714,9 @@ MonoBehaviour:
|
|||||||
speed: 2
|
speed: 2
|
||||||
m_Value: {x: 0, y: 0, z: 0, w: 1}
|
m_Value: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_Size:
|
m_Size:
|
||||||
m_Target: 6.4150777
|
m_Target: 2.015038
|
||||||
speed: 2
|
speed: 2
|
||||||
m_Value: 6.4150777
|
m_Value: 2.015038
|
||||||
m_Ortho:
|
m_Ortho:
|
||||||
m_Target: 1
|
m_Target: 1
|
||||||
speed: 2
|
speed: 2
|
||||||
@@ -762,9 +762,9 @@ MonoBehaviour:
|
|||||||
m_Pos:
|
m_Pos:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
x: 0
|
x: 0
|
||||||
y: 637
|
y: 645
|
||||||
width: 1526
|
width: 1479
|
||||||
height: 354
|
height: 346
|
||||||
m_ViewDataDictionary: {fileID: 0}
|
m_ViewDataDictionary: {fileID: 0}
|
||||||
m_OverlayCanvas:
|
m_OverlayCanvas:
|
||||||
m_LastAppliedPresetName: Default
|
m_LastAppliedPresetName: Default
|
||||||
@@ -782,22 +782,22 @@ MonoBehaviour:
|
|||||||
m_SkipHidden: 0
|
m_SkipHidden: 0
|
||||||
m_SearchArea: 1
|
m_SearchArea: 1
|
||||||
m_Folders:
|
m_Folders:
|
||||||
- Assets/Scripts/HomeMenu/Lobby
|
- Assets/Scenes
|
||||||
m_Globs: []
|
m_Globs: []
|
||||||
m_OriginalText:
|
m_OriginalText:
|
||||||
m_ViewMode: 1
|
m_ViewMode: 1
|
||||||
m_StartGridSize: 64
|
m_StartGridSize: 64
|
||||||
m_LastFolders:
|
m_LastFolders:
|
||||||
- Assets/Scripts/HomeMenu/Lobby
|
- Assets/Scenes
|
||||||
m_LastFoldersGridSize: -1
|
m_LastFoldersGridSize: -1
|
||||||
m_LastProjectPath: M:\Programs\Unity\PROJECTS\defrain
|
m_LastProjectPath: M:\Programs\Unity\PROJECTS\defrain
|
||||||
m_LockTracker:
|
m_LockTracker:
|
||||||
m_IsLocked: 0
|
m_IsLocked: 0
|
||||||
m_FolderTreeState:
|
m_FolderTreeState:
|
||||||
scrollPos: {x: 0, y: 6}
|
scrollPos: {x: 0, y: 14}
|
||||||
m_SelectedIDs: 825f0000
|
m_SelectedIDs: 925f0000
|
||||||
m_LastClickedID: 24450
|
m_LastClickedID: 24466
|
||||||
m_ExpandedIDs: 00000000f85e0000fc5e0000fe5e0000005f000000ca9a3b
|
m_ExpandedIDs: 000000001a5f00001c5f00001e5f000000ca9a3b
|
||||||
m_RenameOverlay:
|
m_RenameOverlay:
|
||||||
m_UserAcceptedRename: 0
|
m_UserAcceptedRename: 0
|
||||||
m_Name:
|
m_Name:
|
||||||
@@ -825,7 +825,7 @@ MonoBehaviour:
|
|||||||
scrollPos: {x: 0, y: 0}
|
scrollPos: {x: 0, y: 0}
|
||||||
m_SelectedIDs:
|
m_SelectedIDs:
|
||||||
m_LastClickedID: 0
|
m_LastClickedID: 0
|
||||||
m_ExpandedIDs: 00000000f85e0000fa5e0000fc5e0000fe5e0000005f000000ca9a3b
|
m_ExpandedIDs: 000000001a5f00001c5f00001e5f0000
|
||||||
m_RenameOverlay:
|
m_RenameOverlay:
|
||||||
m_UserAcceptedRename: 0
|
m_UserAcceptedRename: 0
|
||||||
m_Name:
|
m_Name:
|
||||||
@@ -901,10 +901,10 @@ MonoBehaviour:
|
|||||||
m_Tooltip:
|
m_Tooltip:
|
||||||
m_Pos:
|
m_Pos:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
x: 0
|
x: -1920
|
||||||
y: 637
|
y: 666
|
||||||
width: 1526
|
width: 1526
|
||||||
height: 354
|
height: 373
|
||||||
m_ViewDataDictionary: {fileID: 0}
|
m_ViewDataDictionary: {fileID: 0}
|
||||||
m_OverlayCanvas:
|
m_OverlayCanvas:
|
||||||
m_LastAppliedPresetName: Default
|
m_LastAppliedPresetName: Default
|
||||||
@@ -929,9 +929,9 @@ MonoBehaviour:
|
|||||||
m_Tooltip:
|
m_Tooltip:
|
||||||
m_Pos:
|
m_Pos:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
x: 1527
|
x: 1480
|
||||||
y: 73
|
y: 73
|
||||||
width: 392
|
width: 439
|
||||||
height: 918
|
height: 918
|
||||||
m_ViewDataDictionary: {fileID: 0}
|
m_ViewDataDictionary: {fileID: 0}
|
||||||
m_OverlayCanvas:
|
m_OverlayCanvas:
|
||||||
|
|||||||
Reference in New Issue
Block a user