From e07786a45c59218e956036f47f439d46ca4081ed Mon Sep 17 00:00:00 2001 From: Anonymous Raccoon <32224410+AnonymusRaccoon@users.noreply.github.com> Date: Sun, 7 Oct 2018 16:40:17 +0200 Subject: [PATCH] Placing player at the good position. --- Assets/Scenes/Level 1.unity | 92 +------------------------------ Assets/Script/GameManager.cs | 4 +- Assets/Script/NetworkManager.cs | 15 +++-- Assets/Script/PlayerController.cs | 3 +- Assets/Sound.meta | 8 --- 5 files changed, 13 insertions(+), 109 deletions(-) delete mode 100644 Assets/Sound.meta diff --git a/Assets/Scenes/Level 1.unity b/Assets/Scenes/Level 1.unity index 2799755..7c87e66 100644 --- a/Assets/Scenes/Level 1.unity +++ b/Assets/Scenes/Level 1.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.44657844, g: 0.49641222, b: 0.57481694, a: 1} + m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -179,52 +179,6 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} ---- !u!1001 &294427600 -Prefab: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 4345067943353424, guid: f5eee23f42e32c740a46ae6b64fb96e1, type: 2} - propertyPath: m_LocalPosition.x - value: -1.538 - objectReference: {fileID: 0} - - target: {fileID: 4345067943353424, guid: f5eee23f42e32c740a46ae6b64fb96e1, type: 2} - propertyPath: m_LocalPosition.y - value: -0.6385 - objectReference: {fileID: 0} - - target: {fileID: 4345067943353424, guid: f5eee23f42e32c740a46ae6b64fb96e1, type: 2} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4345067943353424, guid: f5eee23f42e32c740a46ae6b64fb96e1, type: 2} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4345067943353424, guid: f5eee23f42e32c740a46ae6b64fb96e1, type: 2} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4345067943353424, guid: f5eee23f42e32c740a46ae6b64fb96e1, type: 2} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4345067943353424, guid: f5eee23f42e32c740a46ae6b64fb96e1, type: 2} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4345067943353424, guid: f5eee23f42e32c740a46ae6b64fb96e1, type: 2} - propertyPath: m_RootOrder - value: 4 - objectReference: {fileID: 0} - - target: {fileID: 1295779273530774, guid: f5eee23f42e32c740a46ae6b64fb96e1, type: 2} - propertyPath: m_Name - value: Player - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: f5eee23f42e32c740a46ae6b64fb96e1, type: 2} - m_IsPrefabAsset: 0 --- !u!1 &403186791 GameObject: m_ObjectHideFlags: 0 @@ -389,7 +343,7 @@ MonoBehaviour: PlayerPrefab: {fileID: 1400916412662404, guid: e39e9213b04aede49a12e77bc88f11a4, type: 2} RespawnTime: 5 - RespawnPosition: {x: 0, y: 0, z: 0} + RespawnPosition: {x: -10, y: 6, z: 0} --- !u!1 &489446559 GameObject: m_ObjectHideFlags: 0 @@ -3551,48 +3505,6 @@ Tilemap: e31: 0 e32: 0 e33: 1 ---- !u!1001 &1303662950 -Prefab: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 4816062612851216, guid: e39e9213b04aede49a12e77bc88f11a4, type: 2} - propertyPath: m_LocalPosition.x - value: -3.4032 - objectReference: {fileID: 0} - - target: {fileID: 4816062612851216, guid: e39e9213b04aede49a12e77bc88f11a4, type: 2} - propertyPath: m_LocalPosition.y - value: 1.265 - objectReference: {fileID: 0} - - target: {fileID: 4816062612851216, guid: e39e9213b04aede49a12e77bc88f11a4, type: 2} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4816062612851216, guid: e39e9213b04aede49a12e77bc88f11a4, type: 2} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4816062612851216, guid: e39e9213b04aede49a12e77bc88f11a4, type: 2} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4816062612851216, guid: e39e9213b04aede49a12e77bc88f11a4, type: 2} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4816062612851216, guid: e39e9213b04aede49a12e77bc88f11a4, type: 2} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4816062612851216, guid: e39e9213b04aede49a12e77bc88f11a4, type: 2} - propertyPath: m_RootOrder - value: 5 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: e39e9213b04aede49a12e77bc88f11a4, type: 2} - m_IsPrefabAsset: 0 --- !u!1 &1919711501 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Script/GameManager.cs b/Assets/Script/GameManager.cs index 6cb884e..a1255ba 100644 --- a/Assets/Script/GameManager.cs +++ b/Assets/Script/GameManager.cs @@ -1,5 +1,4 @@ using System.Collections; -using System.Collections.Generic; using UnityEngine; public class GameManager : MonoBehaviour { @@ -7,8 +6,7 @@ public class GameManager : MonoBehaviour { GameObject PlayerPrefab; [SerializeField] float RespawnTime = 5; - [SerializeField] - Vector3 RespawnPosition; + public Vector3 RespawnPosition; public void Respawn() { StartCoroutine("WaitForRespawn"); diff --git a/Assets/Script/NetworkManager.cs b/Assets/Script/NetworkManager.cs index 7ad0cb2..28e260d 100644 --- a/Assets/Script/NetworkManager.cs +++ b/Assets/Script/NetworkManager.cs @@ -23,9 +23,6 @@ public class NetworkManager : NetworkLobbyManager networkAddress = "localhost"; networkPort = 4444; StartHost(); - - foreach (string s in Input.GetJoystickNames()) - print(s); } private void Update() @@ -329,9 +326,9 @@ public class NetworkManager : NetworkLobbyManager } else { - GameObject spawnPoint = GameObject.Find("SpawnPoint(Clone)"); - pController.transform.position = spawnPoint.transform.position; - Destroy(spawnPoint); + Vector3 pos = GameObject.Find("GameManager").GetComponent().RespawnPosition; + print(pos); + pController.transform.position = new Vector3(pos.x + player * 2, pos.y, pos.z); } pController.gameObject.GetComponent().velocity = new Vector3(0, 5, 0); } @@ -347,4 +344,10 @@ public class NetworkManager : NetworkLobbyManager return base.OnLobbyServerSceneLoadedForPlayer(lobbyPlayer, gamePlayer); } + + public override void OnLobbyServerPlayersReady() + { + gameIsRunning = true; + base.OnLobbyServerPlayersReady(); + } } diff --git a/Assets/Script/PlayerController.cs b/Assets/Script/PlayerController.cs index cd0ca60..987af5c 100644 --- a/Assets/Script/PlayerController.cs +++ b/Assets/Script/PlayerController.cs @@ -3,8 +3,7 @@ public class PlayerController : MonoBehaviour { //Definition des Inputs - /*[HideInInspector]*/ - public string Horizontal; + [HideInInspector] public string Horizontal; [HideInInspector] public string Vertical; [HideInInspector] public KeyCode JumpKey; [HideInInspector] public KeyCode UseKey; diff --git a/Assets/Sound.meta b/Assets/Sound.meta deleted file mode 100644 index f064c38..0000000 --- a/Assets/Sound.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 35b32c52a60dc7941aa679aa9985c868 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: