Global Game Jam 2021
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

47 lines
1.0 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameManager : MonoBehaviour
{
[SerializeField]
private PlayerList m_PlayerList;
[SerializeField]
private GameObject m_playerPrefab;
private Camera m_camera;
// Start is called before the first frame update
void Start()
{
SetUpPlayers();
m_camera = Camera.main;
}
private void SetUpPlayers()
{
foreach (PlayerData data in m_PlayerList.AllPlayers)
{
GameObject newPlayer = Instantiate(m_playerPrefab);
data.Input.SwitchCurrentActionMap("Gameplay");
foreach (InputBehaviour input in newPlayer.GetComponentsInChildren<InputBehaviour>())
input.Initialise(data);
newPlayer.GetComponentInChildren<PlayerVisuals>().Initalise(data);
newPlayer.transform.position += Vector3.ProjectOnPlane(Random.insideUnitSphere, Vector3.up);
}
}
private void LateUpdate()
{
}
}