Browse Source

Hooked up lobby to game manager scripts

master
MB 5 years ago
parent
commit
44b611a70e
4 changed files with 23 additions and 6 deletions
  1. +7
    -1
      Assets/Scipts/CharacterMovement.cs
  2. +7
    -2
      Assets/Scipts/GameMode.cs
  3. +3
    -1
      Assets/Scipts/Map.cs
  4. +6
    -2
      Assets/Scipts/Recipe.cs

+ 7
- 1
Assets/Scipts/CharacterMovement.cs View File

@ -5,7 +5,13 @@ using UnityEngine;
public class CharacterMovement : MonoBehaviour { public class CharacterMovement : MonoBehaviour {
public float Speed; public float Speed;
public GameObject localPlayer;
GameObject localPlayer;
private void Start()
{
localPlayer = Multiplayer.PlayersManager.Instance.LocalPlayer;
}
//Public movement functions :) //Public movement functions :)
public void MoveLeft() public void MoveLeft()

+ 7
- 2
Assets/Scipts/GameMode.cs View File

@ -7,14 +7,19 @@ public class GameMode : MonoBehaviour {
//references to all players //references to all players
List<GameObject> Players = new List<GameObject>(); List<GameObject> Players = new List<GameObject>();
public Recipe recipe; public Recipe recipe;
public GameObject LocalPlayer;
GameObject LocalPlayer;
public float DistanceToWin; public float DistanceToWin;
private void Start() private void Start()
{ {
// Player
LocalPlayer = Multiplayer.PlayersManager.Instance.LocalPlayer;
Players.Add(LocalPlayer);
foreach (GameObject curPlayer in Multiplayer.PlayersManager.Instance.RemotePlayers.Values)
{
Players.Add(curPlayer);
}
} }
void Update() void Update()

+ 3
- 1
Assets/Scipts/Map.cs View File

@ -4,7 +4,7 @@ using UnityEngine;
public class Map : MonoBehaviour { public class Map : MonoBehaviour {
public GameObject LocalPlayer;
GameObject LocalPlayer;
public GameObject[] Tiles; public GameObject[] Tiles;
public List<GameObject> Landmarks; public List<GameObject> Landmarks;
@ -31,6 +31,8 @@ public class Map : MonoBehaviour {
{ {
//GenerateMap(); //GenerateMap();
CreateDummys(); CreateDummys();
LocalPlayer = Multiplayer.PlayersManager.Instance.LocalPlayer;
} }
//Create dummy players for the world wrapping //Create dummy players for the world wrapping

+ 6
- 2
Assets/Scipts/Recipe.cs View File

@ -7,7 +7,7 @@ using System;
public class Recipe : MonoBehaviour { public class Recipe : MonoBehaviour {
public Player localPlayer;
Player localPlayer;
int PlayerCount; int PlayerCount;
public Vegetable[] Veggies; public Vegetable[] Veggies;
public Frame[] Frames; public Frame[] Frames;
@ -31,7 +31,11 @@ public class Recipe : MonoBehaviour {
Frames[i].VegetableSpot.sprite = Veggies[i].Image; Frames[i].VegetableSpot.sprite = Veggies[i].Image;
Frames[i].Qty.text = Qtys[i] + ""; Frames[i].Qty.text = Qtys[i] + "";
} }
}
localPlayer = Multiplayer.PlayersManager.Instance.LocalPlayer.GetComponent<Player>();
PlayerCount = Multiplayer.PlayersManager.Instance.RemotePlayers.Count + 1;
}
//Button calls //Button calls
public void OpenRecipe() public void OpenRecipe()

Loading…
Cancel
Save