diff --git a/Assets/Animations/CharacterController.controller b/Assets/Animations/CharacterController.controller index d879a1f..d5dfe83 100644 --- a/Assets/Animations/CharacterController.controller +++ b/Assets/Animations/CharacterController.controller @@ -18,7 +18,7 @@ AnimatorController: m_Type: 9 m_DefaultFloat: 0 m_DefaultInt: 0 - m_DefaultBool: 0 + m_DefaultBool: 1 m_Controller: {fileID: 0} m_AnimatorLayers: - serializedVersion: 5 diff --git a/Assets/FBX/terrain_Prefabs/terr1.prefab b/Assets/FBX/terrain_Prefabs/terr1.prefab index 5e1220d..09a0966 100644 --- a/Assets/FBX/terrain_Prefabs/terr1.prefab +++ b/Assets/FBX/terrain_Prefabs/terr1.prefab @@ -3462,6 +3462,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 4942003060844008} + - component: {fileID: 114636688854000904} m_Layer: 0 m_Name: terr1 m_TagString: Untagged @@ -16106,6 +16107,18 @@ MeshCollider: m_CookingOptions: 14 m_SkinWidth: 0.01 m_Mesh: {fileID: 4300000, guid: 99d0111f01c394540a69064c1a297091, type: 3} +--- !u!114 &114636688854000904 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1998568239351332} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2301390022f0d72478aae034e36cd8ff, type: 3} + m_Name: + m_EditorClassIdentifier: + LandMarkLocations: [] --- !u!136 &136483726204993768 CapsuleCollider: m_ObjectHideFlags: 1 diff --git a/Assets/FBX/terrain_Prefabs/terr2.prefab b/Assets/FBX/terrain_Prefabs/terr2.prefab index 055a1c3..8bd0d0a 100644 --- a/Assets/FBX/terrain_Prefabs/terr2.prefab +++ b/Assets/FBX/terrain_Prefabs/terr2.prefab @@ -2631,6 +2631,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 4783433737088858} + - component: {fileID: 114744353604177634} m_Layer: 0 m_Name: terr2 m_TagString: Untagged @@ -16313,6 +16314,18 @@ MeshCollider: m_CookingOptions: 14 m_SkinWidth: 0.01 m_Mesh: {fileID: 4300000, guid: 99d0111f01c394540a69064c1a297091, type: 3} +--- !u!114 &114744353604177634 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1743310745419280} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2301390022f0d72478aae034e36cd8ff, type: 3} + m_Name: + m_EditorClassIdentifier: + LandMarkLocations: [] --- !u!136 &136868085561158672 CapsuleCollider: m_ObjectHideFlags: 1 diff --git a/Assets/FBX/terrain_Prefabs/terr3.prefab b/Assets/FBX/terrain_Prefabs/terr3.prefab index 9edfbe1..18d4163 100644 --- a/Assets/FBX/terrain_Prefabs/terr3.prefab +++ b/Assets/FBX/terrain_Prefabs/terr3.prefab @@ -3258,6 +3258,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 4622920038269138} + - component: {fileID: 114695870893068766} m_Layer: 0 m_Name: terr3 m_TagString: Untagged @@ -17345,6 +17346,18 @@ MeshCollider: m_CookingOptions: 14 m_SkinWidth: 0.01 m_Mesh: {fileID: 4300000, guid: 99d0111f01c394540a69064c1a297091, type: 3} +--- !u!114 &114695870893068766 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1826403842147774} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2301390022f0d72478aae034e36cd8ff, type: 3} + m_Name: + m_EditorClassIdentifier: + LandMarkLocations: [] --- !u!136 &136093957553854336 CapsuleCollider: m_ObjectHideFlags: 1 diff --git a/Assets/FBX/terrain_Prefabs/terr4.prefab b/Assets/FBX/terrain_Prefabs/terr4.prefab index 4db4ae4..d3d81c6 100644 --- a/Assets/FBX/terrain_Prefabs/terr4.prefab +++ b/Assets/FBX/terrain_Prefabs/terr4.prefab @@ -1394,6 +1394,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 4594271762715008} + - component: {fileID: 114688868122780174} m_Layer: 0 m_Name: terr4 m_TagString: Untagged @@ -11532,6 +11533,18 @@ MeshCollider: m_CookingOptions: 14 m_SkinWidth: 0.01 m_Mesh: {fileID: 4300000, guid: 42d10c28f3c5cc8489591fcbe44f04cb, type: 3} +--- !u!114 &114688868122780174 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1577805789422060} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2301390022f0d72478aae034e36cd8ff, type: 3} + m_Name: + m_EditorClassIdentifier: + LandMarkLocations: [] --- !u!136 &136068552619605964 CapsuleCollider: m_ObjectHideFlags: 1 diff --git a/Assets/Scipts/Multiplayer/Core/PlayerProtocol.cs b/Assets/Scipts/Multiplayer/Core/PlayerProtocol.cs index d5bac60..4705552 100644 --- a/Assets/Scipts/Multiplayer/Core/PlayerProtocol.cs +++ b/Assets/Scipts/Multiplayer/Core/PlayerProtocol.cs @@ -16,6 +16,7 @@ namespace Multiplayer public const short GameOver = 204; public const short GameStart = 205; public const short QueryPosition = 206; + public const short Vegetable = 207; } public class PlayerMsg : MessageBase @@ -143,4 +144,33 @@ namespace Multiplayer String = reader.ReadString(); } } + + public class VegMsg : PlayerMsg + { + public string String; + public int Int; + + public VegMsg() { } + + public VegMsg(byte PlayerID, string String, int Int) : base(PlayerID) + { + this.String = String; + this.Int = Int; + } + + public override void Serialize(NetworkWriter writer) + { + base.Serialize(writer); + writer.Write(String); + writer.Write(Int); + } + + public override void Deserialize(NetworkReader reader) + { + base.Deserialize(reader); + String = reader.ReadString(); + Int = reader.ReadInt32(); + } + + } } diff --git a/Assets/Scipts/Multiplayer/Server/PlayerServerManager.cs b/Assets/Scipts/Multiplayer/Server/PlayerServerManager.cs index c487996..af8591e 100644 --- a/Assets/Scipts/Multiplayer/Server/PlayerServerManager.cs +++ b/Assets/Scipts/Multiplayer/Server/PlayerServerManager.cs @@ -21,6 +21,7 @@ namespace Multiplayer { ServerManager.Server.RegisterHandler(PlayerMsgID.Position, RecievePosition); ServerManager.Server.RegisterHandler(PlayerMsgID.QueryPosition, QueryPosition); + ServerManager.Server.RegisterHandler(PlayerMsgID.Vegetable, PickUpVeg); } private void RecievePosition(NetworkMessage msg) @@ -71,5 +72,31 @@ namespace Multiplayer } } + private void PickUpVeg(NetworkMessage msg) + { + VegMsg vegMsg; + if (!Utility.ReadMessage(msg, out vegMsg)) + return; + + + if (!ServerManager.AllPlayers.ContainsKey(vegMsg.ID)) + { + Debug.Log("Recieved Veg from unknown player"); + return; + } + + Player player = ServerManager.AllPlayers[vegMsg.ID]; + + + foreach (Player otherPlayer in ServerManager.AllPlayers.Values) + { + if (otherPlayer.Equals(player)) + continue; + + otherPlayer.Connection.Send(PlayerMsgID.Vegetable, vegMsg); + } + + } + } } diff --git a/Assets/Scipts/PlayerControllers/Player.cs b/Assets/Scipts/PlayerControllers/Player.cs index 50de442..6f6202a 100644 --- a/Assets/Scipts/PlayerControllers/Player.cs +++ b/Assets/Scipts/PlayerControllers/Player.cs @@ -58,7 +58,6 @@ public class Player : MonoBehaviour foreach (GameObject dummie in dummies) { dummie.transform.rotation = playerModel.transform.rotation; - Debug.Log(dummieAnims[count]); dummieAnims[count].SetFloat("WalkSpeed", playerAnim.GetFloat("WalkSpeed")); if (playerAnim.GetBool("PickUp")) diff --git a/Assets/Scipts/Recipe.cs b/Assets/Scipts/Recipe.cs index 5dc642c..883e986 100644 --- a/Assets/Scipts/Recipe.cs +++ b/Assets/Scipts/Recipe.cs @@ -4,6 +4,7 @@ using UnityEngine; using UnityEngine.UI; using TMPro; using System; +using Multiplayer; public class Recipe : MonoBehaviour { @@ -31,13 +32,23 @@ public class Recipe : MonoBehaviour { Frames[i].VegetableSpot.sprite = Veggies[i].Image; Frames[i].Qty.text = Qtys[i] + ""; } - localPlayer = Multiplayer.PlayersManager.Instance.LocalPlayer.GetComponent(); - PlayerCount = Multiplayer.PlayersManager.Instance.RemotePlayers.Count + 1; + localPlayer = PlayersManager.Instance.LocalPlayer.GetComponent(); + PlayerCount = PlayersManager.Instance.RemotePlayers.Count + 1; localPlayer.GetComponent().recipe = this; } + private void OnEnable() + { + ClientManager.Instance.Client.RegisterHandler(PlayerMsgID.Vegetable, recieveVeg); + } + + private void OnDisable() + { + ClientManager.Instance.Client.UnregisterHandler(PlayerMsgID.Vegetable); + } + //Button calls public void OpenRecipe() { @@ -65,6 +76,19 @@ public class Recipe : MonoBehaviour { public void friendlyPickup(string VeggieName, int change) { StartCoroutine(ItemLookup(VeggieName, change)); + + VegMsg msg = new VegMsg(ClientManager.Instance.ID, VeggieName, change); + ClientManager.Instance.SendMessage(PlayerMsgID.Vegetable, msg); + } + + public void recieveVeg(UnityEngine.Networking.NetworkMessage msg) + { + + VegMsg vegMsg; + if (!Utility.ReadMessage(msg, out vegMsg)) + return; + + StartCoroutine(ItemLookup(vegMsg.String, vegMsg.Int)); } IEnumerator ItemLookup(string VeggieName, int change) diff --git a/Assets/Shaders.meta b/Assets/Shaders.meta new file mode 100644 index 0000000..472bf46 --- /dev/null +++ b/Assets/Shaders.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f87a054963b01dc4c8aa2e3ffedcca21 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WorldAssets.meta b/Assets/WorldAssets.meta new file mode 100644 index 0000000..b49880d --- /dev/null +++ b/Assets/WorldAssets.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7da0e8d0a6415f944aa43dff57b38ae3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WorldAssets/Models.meta b/Assets/WorldAssets/Models.meta new file mode 100644 index 0000000..a4d7756 --- /dev/null +++ b/Assets/WorldAssets/Models.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c207356b78ec8e8499bb6047218dd104 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: