|
|
- 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()
- {
-
- }
-
- }
|