MB 5 years ago
parent
commit
753682772f
12 changed files with 160 additions and 4 deletions
  1. +1
    -1
      Assets/Animations/CharacterController.controller
  2. +13
    -0
      Assets/FBX/terrain_Prefabs/terr1.prefab
  3. +13
    -0
      Assets/FBX/terrain_Prefabs/terr2.prefab
  4. +13
    -0
      Assets/FBX/terrain_Prefabs/terr3.prefab
  5. +13
    -0
      Assets/FBX/terrain_Prefabs/terr4.prefab
  6. +30
    -0
      Assets/Scipts/Multiplayer/Core/PlayerProtocol.cs
  7. +27
    -0
      Assets/Scipts/Multiplayer/Server/PlayerServerManager.cs
  8. +0
    -1
      Assets/Scipts/PlayerControllers/Player.cs
  9. +26
    -2
      Assets/Scipts/Recipe.cs
  10. +8
    -0
      Assets/Shaders.meta
  11. +8
    -0
      Assets/WorldAssets.meta
  12. +8
    -0
      Assets/WorldAssets/Models.meta

+ 1
- 1
Assets/Animations/CharacterController.controller View File

@ -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

+ 13
- 0
Assets/FBX/terrain_Prefabs/terr1.prefab View File

@ -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

+ 13
- 0
Assets/FBX/terrain_Prefabs/terr2.prefab View File

@ -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

+ 13
- 0
Assets/FBX/terrain_Prefabs/terr3.prefab View File

@ -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

+ 13
- 0
Assets/FBX/terrain_Prefabs/terr4.prefab View File

@ -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

+ 30
- 0
Assets/Scipts/Multiplayer/Core/PlayerProtocol.cs View File

@ -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();
}
}
}

+ 27
- 0
Assets/Scipts/Multiplayer/Server/PlayerServerManager.cs View File

@ -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<VegMsg>(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);
}
}
}
}

+ 0
- 1
Assets/Scipts/PlayerControllers/Player.cs View File

@ -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"))

+ 26
- 2
Assets/Scipts/Recipe.cs View File

@ -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<Player>();
PlayerCount = Multiplayer.PlayersManager.Instance.RemotePlayers.Count + 1;
localPlayer = PlayersManager.Instance.LocalPlayer.GetComponent<Player>();
PlayerCount = PlayersManager.Instance.RemotePlayers.Count + 1;
localPlayer.GetComponent<LocalPlayer>().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<VegMsg>(msg, out vegMsg))
return;
StartCoroutine(ItemLookup(vegMsg.String, vegMsg.Int));
}
IEnumerator ItemLookup(string VeggieName, int change)

+ 8
- 0
Assets/Shaders.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f87a054963b01dc4c8aa2e3ffedcca21
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

+ 8
- 0
Assets/WorldAssets.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7da0e8d0a6415f944aa43dff57b38ae3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

+ 8
- 0
Assets/WorldAssets/Models.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c207356b78ec8e8499bb6047218dd104
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Loading…
Cancel
Save