Browse Source

Had the remove lives in the } instead of outside :S tested and confirmed

changed the start prefab so i dont have to play like 20 rounds of the game until i can die, will change back after more testing
Josh_Dev_branch
Claire Peta 4 years ago
parent
commit
09108d3a1f
5 changed files with 1231 additions and 1160 deletions
  1. +1217
    -1137
      Assets/Prefabs/Map Sections/Start 4-player.prefab
  2. +2
    -2
      Assets/Scenes/Client Scenes/ClientScene.unity
  3. +2
    -2
      Assets/Scripts/Character.cs
  4. +8
    -7
      Assets/Scripts/Managers/GameManager.cs
  5. +2
    -12
      Assets/Scripts/Networking/Server/ClientList.cs

+ 1217
- 1137
Assets/Prefabs/Map Sections/Start 4-player.prefab
File diff suppressed because it is too large
View File


+ 2
- 2
Assets/Scenes/Client Scenes/ClientScene.unity View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:18d4101b77a4debce58be4d79cde998867da2e07e181f9e819dae5d4830b4545
size 14794
oid sha256:3e55348964c1073b8e4e4df12713bbc057b4f46974790e00d2983c9c1485aa82
size 15370

+ 2
- 2
Assets/Scripts/Character.cs View File

@ -73,8 +73,8 @@ public class Character : MonoBehaviour
{
if(lives < 1)
{
this.enabled = false;
gameObject.SetActive(false);
//this.enabled = false;
//gameObject.SetActive(false);
}
}

+ 8
- 7
Assets/Scripts/Managers/GameManager.cs View File

@ -126,18 +126,19 @@ public class GameManager : MonoBehaviour
//Let Gamemode know all players have moved
gameMode.AllPlayersMoved(playerDataAsArray.ToArray());
//decrease lives here!!
foreach(PlayerData player in playerDataAsArray)
{
gameMode.PlayerKilled(player);
}
playerDataAsArray.ForEach(p => p.client.SendLives()); //Update the players score
//if Game is over break out of loop
if (gameMode.isGameOver(playerDataAsArray))
break;
}
//decrease lives here!!
foreach (PlayerData player in playerDataAsArray)
{
gameMode.PlayerKilled(player);
}
playerDataAsArray.ForEach(p => p.client.SendLives()); //Update the players score
//Let GameMode know that Round is Over
gameMode.RoundEnd(playerDataAsArray.ToArray());

+ 2
- 12
Assets/Scripts/Networking/Server/ClientList.cs View File

@ -6,7 +6,6 @@ using UnityEngine.Networking;
namespace Networking.Server
{
[CreateAssetMenu(menuName = "Major Project/Networking/ClientList", order = 150)]
public class ClientList : ScriptableObject, IEnumerable<ClientData>
{
@ -69,7 +68,6 @@ namespace Networking.Server
{
this.server = serverObject.server;
Reset();
server.RegisterHandler(MsgType.Connect, OnClientConnect);
server.RegisterHandler(MsgType.Disconnect, OnClientDisconnect);
server.RegisterHandler(LoginProtocols.SendingLoginDetails, OnClientLogin);
@ -93,7 +91,6 @@ namespace Networking.Server
public void OnClientDisconnect(NetworkMessage msg)
{
PotentialClients.RemoveAll(p => p == msg.conn);
if (!ConnectedClients.Any(p => p.ID == msg.conn.connectionId))
@ -105,7 +102,6 @@ namespace Networking.Server
ClientData client = ConnectedClients.FirstOrDefault(p => p.ID == msg.conn.connectionId);
ConnectedClients.Remove(client);
DisconnectedClients.Add(client);
ConnectedClients.ForEach(p => p.conn.Send(LoginProtocols.OtherClientDisconnected, new LoginProtocols.LoginMsg(client.Name, client.Color, client.characterAnimal)));
PotentialClients.ForEach(p => p.Send(LoginProtocols.OtherClientDisconnected, new LoginProtocols.LoginMsg(client.Name, client.Color, client.characterAnimal)));
@ -140,7 +136,6 @@ namespace Networking.Server
Debug.Log("new Connection: " + loginMsg.Name);
newClient = new ClientData();
newClient.Inventory = Inventory.Clone(StartInventory);
}
newClient.Color = loginMsg.Color;
@ -159,14 +154,9 @@ namespace Networking.Server
newClient.SendInventory();
newClient.SendLives();
newClient.ChangeScene("WaitScene");
}
#region IEnumerable Implementation
public IEnumerator<ClientData> GetEnumerator()
{
@ -212,7 +202,7 @@ namespace Networking.Server
/// <summary>
/// Clients Current Lives
/// </summary>
public int Lives;
public int Lives = 3;
/// <summary>
/// Clients character animal - needed for instantiation

Loading…
Cancel
Save