Browse Source

Merge branch 'master' of https://bitbucket.org/JoshuaReason/ggj-2019

# Conflicts:
#	Assets/Prefabs/RealLocalPlayer.prefab
master
MB 5 years ago
parent
commit
883467e06c
4 changed files with 17 additions and 5 deletions
  1. +4
    -1
      Assets/Prefabs/RealRemotePlayer.prefab
  2. +4
    -0
      Assets/Scipts/Map.cs
  3. +3
    -2
      Assets/Scipts/PlayerControllers/Player.cs
  4. +6
    -2
      Assets/Scipts/PlayerControllers/RemotePlayer.cs

+ 4
- 1
Assets/Prefabs/RealRemotePlayer.prefab View File

@ -1039,8 +1039,11 @@ MonoBehaviour:
Name: Name:
Image: {fileID: 0} Image: {fileID: 0}
playerModel: {fileID: 1067210703148028} playerModel: {fileID: 1067210703148028}
scale: 0.1
playerAnim: {fileID: 95748578200216180}
dummieAnims: []
scale: 1
Animator: {fileID: 95748578200216180} Animator: {fileID: 95748578200216180}
PlayerModel: {fileID: 1067210703148028}
--- !u!136 &136963308744459646 --- !u!136 &136963308744459646
CapsuleCollider: CapsuleCollider:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1

+ 4
- 0
Assets/Scipts/Map.cs View File

@ -33,6 +33,10 @@ public class Map : MonoBehaviour
GenerateTiles(); GenerateTiles();
CreateDummys(); 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 //Create dummy players for the world wrapping

+ 3
- 2
Assets/Scipts/PlayerControllers/Player.cs View File

@ -9,8 +9,8 @@ public class Player : MonoBehaviour
public GameObject playerModel; public GameObject playerModel;
protected Map map; protected Map map;
private Animator playerAnim;
private List<Animator> dummieAnims = new List<Animator>();
public Animator playerAnim;
public List<Animator> dummieAnims = new List<Animator>();
public float scale = 0.1f; public float scale = 0.1f;
@ -61,6 +61,7 @@ public class Player : MonoBehaviour
foreach (GameObject dummie in dummies) foreach (GameObject dummie in dummies)
{ {
dummie.transform.rotation = playerModel.transform.rotation; dummie.transform.rotation = playerModel.transform.rotation;
dummieAnims[count].SetFloat("WalkSpeed", playerAnim.GetFloat("WalkSpeed")); dummieAnims[count].SetFloat("WalkSpeed", playerAnim.GetFloat("WalkSpeed"));
if (playerAnim.GetBool("PickUp")) if (playerAnim.GetBool("PickUp"))

+ 6
- 2
Assets/Scipts/PlayerControllers/RemotePlayer.cs View File

@ -5,6 +5,7 @@ using UnityEngine;
public class RemotePlayer : Player { public class RemotePlayer : Player {
public Animator Animator; public Animator Animator;
public GameObject PlayerModel;
private float walkSpeed; private float walkSpeed;
private Vector3 lastPosition; private Vector3 lastPosition;
@ -23,9 +24,12 @@ public class RemotePlayer : Player {
private void DoAnimation() private void DoAnimation()
{ {
Vector3 dir = lastPosition - transform.position;
Vector3 dir = transform.position - lastPosition;
lastPosition = transform.position; lastPosition = transform.position;
Animator.SetFloat("WalkSpeed", dir.magnitude); 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;
} }
} }

Loading…
Cancel
Save