From 548a69fa0edb71b02c9e7a84a1f8011cceeb7dde Mon Sep 17 00:00:00 2001 From: MB Date: Sun, 27 Jan 2019 00:39:05 +1100 Subject: [PATCH] Gravity works --- Assets/FBX/terrain_Prefabs/terr1.prefab | 15 +++++++++++++++ Assets/FBX/terrain_Prefabs/terr2.prefab | 15 +++++++++++++++ Assets/FBX/terrain_Prefabs/terr3.prefab | 15 +++++++++++++++ Assets/FBX/terrain_Prefabs/terr4.prefab | 15 +++++++++++++++ Assets/LocalPlayer.cs | 15 +++++++++++++++ Assets/LocalPlayer.cs.meta | 11 +++++++++++ Assets/Prefabs/RealLocalPlayer.prefab | 13 +++++++++++++ Assets/Scenes/LobbyScene.unity | 5 +++-- .../Scipts/Multiplayer/Client/PlayersManager.cs | 2 +- Assets/Scipts/Player.cs | 1 + Assets/Scipts/UI/LobbyUIController.cs | 2 ++ 11 files changed, 106 insertions(+), 3 deletions(-) create mode 100644 Assets/LocalPlayer.cs create mode 100644 Assets/LocalPlayer.cs.meta diff --git a/Assets/FBX/terrain_Prefabs/terr1.prefab b/Assets/FBX/terrain_Prefabs/terr1.prefab index eda294a..5e1220d 100644 --- a/Assets/FBX/terrain_Prefabs/terr1.prefab +++ b/Assets/FBX/terrain_Prefabs/terr1.prefab @@ -1953,6 +1953,7 @@ GameObject: - component: {fileID: 4572493703287628} - component: {fileID: 33302327919172256} - component: {fileID: 23524112614537848} + - component: {fileID: 64087229165304872} m_Layer: 0 m_Name: terr1 m_TagString: Untagged @@ -14677,6 +14678,20 @@ MeshCollider: m_CookingOptions: 14 m_SkinWidth: 0.01 m_Mesh: {fileID: 4300000, guid: 99d0111f01c394540a69064c1a297091, type: 3} +--- !u!64 &64087229165304872 +MeshCollider: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1593761762770214} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Convex: 0 + m_CookingOptions: 14 + m_SkinWidth: 0.01 + m_Mesh: {fileID: 4300000, guid: a8ba5e24558027e4f9c4fb1163c18e91, type: 3} --- !u!64 &64088812999245390 MeshCollider: m_ObjectHideFlags: 1 diff --git a/Assets/FBX/terrain_Prefabs/terr2.prefab b/Assets/FBX/terrain_Prefabs/terr2.prefab index bad3b1c..055a1c3 100644 --- a/Assets/FBX/terrain_Prefabs/terr2.prefab +++ b/Assets/FBX/terrain_Prefabs/terr2.prefab @@ -298,6 +298,7 @@ GameObject: - component: {fileID: 4282343398127198} - component: {fileID: 33526079659851976} - component: {fileID: 23872336482510252} + - component: {fileID: 64668229792911388} m_Layer: 0 m_Name: terr2 m_TagString: Untagged @@ -15780,6 +15781,20 @@ MeshCollider: m_CookingOptions: 14 m_SkinWidth: 0.01 m_Mesh: {fileID: 4300000, guid: 99d0111f01c394540a69064c1a297091, type: 3} +--- !u!64 &64668229792911388 +MeshCollider: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1094668700355570} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Convex: 0 + m_CookingOptions: 14 + m_SkinWidth: 0.01 + m_Mesh: {fileID: 4300000, guid: 4ca26ac77d0762944818d911d3d4e171, type: 3} --- !u!64 &64669100819787316 MeshCollider: m_ObjectHideFlags: 1 diff --git a/Assets/FBX/terrain_Prefabs/terr3.prefab b/Assets/FBX/terrain_Prefabs/terr3.prefab index 7138001..9edfbe1 100644 --- a/Assets/FBX/terrain_Prefabs/terr3.prefab +++ b/Assets/FBX/terrain_Prefabs/terr3.prefab @@ -2347,6 +2347,7 @@ GameObject: - component: {fileID: 4406658072793374} - component: {fileID: 33913717413823534} - component: {fileID: 23446745603181364} + - component: {fileID: 64533680346656760} m_Layer: 0 m_Name: terr3 m_TagString: Untagged @@ -16476,6 +16477,20 @@ MeshCollider: m_CookingOptions: 14 m_SkinWidth: 0.01 m_Mesh: {fileID: 4300000, guid: 8079a73d181a97c40968ab54ff444137, type: 3} +--- !u!64 &64533680346656760 +MeshCollider: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1575992043817686} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Convex: 0 + m_CookingOptions: 14 + m_SkinWidth: 0.01 + m_Mesh: {fileID: 4300000, guid: f67e8a85b29c07f47badc4a0b3fd18f6, type: 3} --- !u!64 &64535940406289798 MeshCollider: m_ObjectHideFlags: 1 diff --git a/Assets/FBX/terrain_Prefabs/terr4.prefab b/Assets/FBX/terrain_Prefabs/terr4.prefab index 256716d..4db4ae4 100644 --- a/Assets/FBX/terrain_Prefabs/terr4.prefab +++ b/Assets/FBX/terrain_Prefabs/terr4.prefab @@ -1081,6 +1081,7 @@ GameObject: - component: {fileID: 4929833942921672} - component: {fileID: 33715934285815486} - component: {fileID: 23745084030861904} + - component: {fileID: 64080985636031386} m_Layer: 0 m_Name: terr4 m_TagString: Untagged @@ -10691,6 +10692,20 @@ MeshCollider: m_CookingOptions: 14 m_SkinWidth: 0.01 m_Mesh: {fileID: 4300000, guid: 99d0111f01c394540a69064c1a297091, type: 3} +--- !u!64 &64080985636031386 +MeshCollider: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1457798877047700} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Convex: 0 + m_CookingOptions: 14 + m_SkinWidth: 0.01 + m_Mesh: {fileID: 4300000, guid: e20254b82c40c4a42ac6bcd5dbec68c7, type: 3} --- !u!64 &64087590311291686 MeshCollider: m_ObjectHideFlags: 1 diff --git a/Assets/LocalPlayer.cs b/Assets/LocalPlayer.cs new file mode 100644 index 0000000..671aab7 --- /dev/null +++ b/Assets/LocalPlayer.cs @@ -0,0 +1,15 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class LocalPlayer : MonoBehaviour { + + public CharacterController charControl; + private void Update() + { + if (!charControl.isGrounded) + { + charControl.SimpleMove(new Vector3(0.0f, -5.0f * Time.deltaTime, 0.0f)); + } + } +} diff --git a/Assets/LocalPlayer.cs.meta b/Assets/LocalPlayer.cs.meta new file mode 100644 index 0000000..d0a9835 --- /dev/null +++ b/Assets/LocalPlayer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 890fed67893ffdd44a4cef0b351ae1f0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/RealLocalPlayer.prefab b/Assets/Prefabs/RealLocalPlayer.prefab index 28f7809..8336fac 100644 --- a/Assets/Prefabs/RealLocalPlayer.prefab +++ b/Assets/Prefabs/RealLocalPlayer.prefab @@ -37,6 +37,7 @@ GameObject: m_Component: - component: {fileID: 4713031430525266} - component: {fileID: 114470274098260950} + - component: {fileID: 114144325375728200} - component: {fileID: 114874876091907484} - component: {fileID: 143426586791887808} m_Layer: 0 @@ -206,6 +207,18 @@ AudioListener: m_PrefabInternal: {fileID: 100100000} m_GameObject: {fileID: 1051260791432954} m_Enabled: 1 +--- !u!114 &114144325375728200 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1067952265812482} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 890fed67893ffdd44a4cef0b351ae1f0, type: 3} + m_Name: + m_EditorClassIdentifier: + charControl: {fileID: 143426586791887808} --- !u!114 &114470274098260950 MonoBehaviour: m_ObjectHideFlags: 1 diff --git a/Assets/Scenes/LobbyScene.unity b/Assets/Scenes/LobbyScene.unity index 315d188..f6af691 100644 --- a/Assets/Scenes/LobbyScene.unity +++ b/Assets/Scenes/LobbyScene.unity @@ -220,6 +220,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 405724f17a9fdf7498f87dfdb5dbcb9e, type: 3} m_Name: m_EditorClassIdentifier: + playerMan: {fileID: 1535509335} --- !u!1 &1007511397 GameObject: m_ObjectHideFlags: 0 @@ -356,7 +357,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_AspectMode: 0 - m_AspectRatio: 4.5044775 + m_AspectRatio: 4.2877293 --- !u!1 &1535509334 GameObject: m_ObjectHideFlags: 0 @@ -732,7 +733,7 @@ RectTransform: m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 4.710968} + m_SizeDelta: {x: 70.39752, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1973300969 MonoBehaviour: diff --git a/Assets/Scipts/Multiplayer/Client/PlayersManager.cs b/Assets/Scipts/Multiplayer/Client/PlayersManager.cs index 6851db1..b7f84f5 100644 --- a/Assets/Scipts/Multiplayer/Client/PlayersManager.cs +++ b/Assets/Scipts/Multiplayer/Client/PlayersManager.cs @@ -32,7 +32,7 @@ namespace Multiplayer public void InstantaiateLocalPlayer() { LocalPlayer = GameObject.Instantiate(LocalPlayerPrefab,transform); - LocalPlayer.transform.position = Vector3.zero; + LocalPlayer.transform.position = Vector3.zero + Vector3.up * 5.0f; ClientManager.Instance.SendMessage(PlayerMsgID.QueryPosition); } diff --git a/Assets/Scipts/Player.cs b/Assets/Scipts/Player.cs index ba86168..e5e3adc 100644 --- a/Assets/Scipts/Player.cs +++ b/Assets/Scipts/Player.cs @@ -5,4 +5,5 @@ using UnityEngine; public class Player : MonoBehaviour { public List dummies; public Vegetable heldVeggie; + } diff --git a/Assets/Scipts/UI/LobbyUIController.cs b/Assets/Scipts/UI/LobbyUIController.cs index f2488f9..44bfbb3 100644 --- a/Assets/Scipts/UI/LobbyUIController.cs +++ b/Assets/Scipts/UI/LobbyUIController.cs @@ -4,8 +4,10 @@ using UnityEngine; public class LobbyUIController : MonoBehaviour { + public Multiplayer.PlayersManager playerMan; public void OnClickStartGame() { + playerMan.LocalPlayer.GetComponent().enabled = true; Multiplayer.ClientManager.Instance.SendMessage(Multiplayer.PlayerMsgID.GameStart, new Multiplayer.PlayerMsg(Multiplayer.ClientManager.Instance.ID)); } }