Placing player at the good position.

This commit is contained in:
Anonymous Raccoon
2018-10-07 16:40:17 +02:00
parent 39db5cc07b
commit e07786a45c
5 changed files with 13 additions and 109 deletions

View File

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

View File

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

View File

@@ -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<GameManager>().RespawnPosition;
print(pos);
pController.transform.position = new Vector3(pos.x + player * 2, pos.y, pos.z);
}
pController.gameObject.GetComponent<Rigidbody2D>().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();
}
}

View File

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

View File

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