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

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class GameManager : MonoBehaviour
  5. {
  6. [SerializeField]
  7. private PlayerList m_PlayerList;
  8. [SerializeField]
  9. private GameObject m_playerPrefab;
  10. private Camera m_camera;
  11. // Start is called before the first frame update
  12. void Start()
  13. {
  14. SetUpPlayers();
  15. m_camera = Camera.main;
  16. }
  17. private void SetUpPlayers()
  18. {
  19. foreach (PlayerData data in m_PlayerList.AllPlayers)
  20. {
  21. GameObject newPlayer = Instantiate(m_playerPrefab);
  22. data.Input.SwitchCurrentActionMap("Gameplay");
  23. foreach (InputBehaviour input in newPlayer.GetComponentsInChildren<InputBehaviour>())
  24. input.Initialise(data);
  25. newPlayer.GetComponentInChildren<PlayerVisuals>().Initalise(data);
  26. newPlayer.transform.position += Vector3.ProjectOnPlane(Random.insideUnitSphere, Vector3.up);
  27. }
  28. }
  29. private void LateUpdate()
  30. {
  31. }
  32. }