diff --git a/Assets/Prefabs/RealLocalPlayer.prefab b/Assets/Prefabs/RealLocalPlayer.prefab index e477b8e..373246a 100644 --- a/Assets/Prefabs/RealLocalPlayer.prefab +++ b/Assets/Prefabs/RealLocalPlayer.prefab @@ -768,7 +768,7 @@ Transform: m_CorrespondingSourceObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} m_GameObject: {fileID: 1706194438886280} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalRotation: {x: -0, y: 0.7693971, z: -0, w: 0.6387708} m_LocalPosition: {x: 0, y: 0.53, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: @@ -1204,10 +1204,14 @@ MonoBehaviour: Name: Image: {fileID: 0} playerModel: {fileID: 1706194438886280} - scale: 0.1 + playerAnim: {fileID: 0} + dummieAnims: [] + scale: 1 charControl: {fileID: 143426586791887808} Animator: {fileID: 95357577853386682} Speed: 5 + recipe: {fileID: 0} + WalkingSounds: {fileID: 0} --- !u!114 &114874876091907484 MonoBehaviour: m_ObjectHideFlags: 1 diff --git a/Assets/Prefabs/RealRemotePlayer.prefab b/Assets/Prefabs/RealRemotePlayer.prefab index 2ecdffd..02750e6 100644 --- a/Assets/Prefabs/RealRemotePlayer.prefab +++ b/Assets/Prefabs/RealRemotePlayer.prefab @@ -1039,8 +1039,11 @@ MonoBehaviour: Name: Image: {fileID: 0} playerModel: {fileID: 1067210703148028} - scale: 0.1 + playerAnim: {fileID: 95748578200216180} + dummieAnims: [] + scale: 1 Animator: {fileID: 95748578200216180} + PlayerModel: {fileID: 1067210703148028} --- !u!136 &136963308744459646 CapsuleCollider: m_ObjectHideFlags: 1 diff --git a/Assets/Scipts/Map.cs b/Assets/Scipts/Map.cs index 91559f0..da7945b 100644 --- a/Assets/Scipts/Map.cs +++ b/Assets/Scipts/Map.cs @@ -33,6 +33,10 @@ public class Map : MonoBehaviour GenerateTiles(); CreateDummys(); + Random.State state = Random.state; + Random.InitState((int)System.DateTime.Now.Ticks); + LocalPlayer.transform.position = new Vector3(Random.Range(minX, maxX), 5, Random.Range(minX, maxX)); + Random.state = state; } //Create dummy players for the world wrapping diff --git a/Assets/Scipts/PlayerControllers/Player.cs b/Assets/Scipts/PlayerControllers/Player.cs index 3bda47f..d584b8e 100644 --- a/Assets/Scipts/PlayerControllers/Player.cs +++ b/Assets/Scipts/PlayerControllers/Player.cs @@ -9,8 +9,8 @@ public class Player : MonoBehaviour public GameObject playerModel; protected Map map; - private Animator playerAnim; - private List dummieAnims = new List(); + public Animator playerAnim; + public List dummieAnims = new List(); public float scale = 0.1f; @@ -61,6 +61,7 @@ public class Player : MonoBehaviour foreach (GameObject dummie in dummies) { dummie.transform.rotation = playerModel.transform.rotation; + dummieAnims[count].SetFloat("WalkSpeed", playerAnim.GetFloat("WalkSpeed")); if (playerAnim.GetBool("PickUp")) diff --git a/Assets/Scipts/PlayerControllers/RemotePlayer.cs b/Assets/Scipts/PlayerControllers/RemotePlayer.cs index 6194b4d..012d531 100644 --- a/Assets/Scipts/PlayerControllers/RemotePlayer.cs +++ b/Assets/Scipts/PlayerControllers/RemotePlayer.cs @@ -5,6 +5,7 @@ using UnityEngine; public class RemotePlayer : Player { public Animator Animator; + public GameObject PlayerModel; private float walkSpeed; private Vector3 lastPosition; @@ -23,9 +24,12 @@ public class RemotePlayer : Player { private void DoAnimation() { - Vector3 dir = lastPosition - transform.position; + Vector3 dir = transform.position - lastPosition; lastPosition = transform.position; Animator.SetFloat("WalkSpeed", dir.magnitude); - transform.forward = dir.normalized; + Debug.Log(dir.normalized); + + PlayerModel.transform.LookAt(PlayerModel.transform.position + dir, Vector3.up); + //PlayerModel.transform.forward = dir.normalized; } }