// DONT F*****G TOUCH THIS FUNCTION void CreatePlayerAgent() { _syncedVars = FindObjectOfType <SyncedVars>(); if (_syncedVars == null) { Debug.LogError("OOPSALA we have an ERROR!"); } transform.SetParent(_playerManager.transform); _uiManager.GetComponent <Canvas>().enabled = true; _seed = _syncedVars.GlobalSeed; seedNumText.text = _seed.ToString(); Random.InitState(_seed); _syncedVars.CmdTellServerToUpdatePlayerCount(); if (isLocalPlayer) { _playerUniqueID = _syncedVars.PlayerCount; playerIDText.text = _playerUniqueID.ToString(); _playerData = _playerManager.GetPlayerData(_playerUniqueID); playerNameText.text = _playerData.name; ContinuePlayerSetUp(); } }
// Use this for initialization void Awake() { _gameManager = FindObjectOfType <GameManager>(); if (_gameManager == null) { Debug.LogError("OOPSALA we have an ERROR!"); } _playerManager = _gameManager._playerManager; if (_playerManager == null) { Debug.LogError("OOPSALA we have an ERROR!"); } _uiManager = _gameManager._uiManager; if (_uiManager == null) { Debug.LogError("OOPSALA we have an ERROR!"); } _syncedVars = FindObjectOfType <SyncedVars>(); if (_syncedVars == null) { Debug.LogError("OOPSALA we have an ERROR!"); } playerIDText = _uiManager.transform.FindDeepChild("PlayerNum").GetComponent <Text>(); playerNameText = _uiManager.transform.FindDeepChild("PlayerName").GetComponent <Text>(); totalPlayerText = _uiManager.transform.FindDeepChild("TotalPlayersNum").GetComponent <Text>(); seedNumText = _uiManager.transform.FindDeepChild("SeedNum").GetComponent <Text>(); }
void Awake() { _locationManager = GetComponentInChildren <LocationManager>(); if (_locationManager == null) { Debug.LogError("OOPSALA we have an ERROR!"); } _movementManager = GetComponentInChildren <MovementManager>(); if (_movementManager == null) { Debug.LogError("OOPSALA we have an ERROR!"); } _combatManager = GetComponentInChildren <CombatManager>(); if (_combatManager == null) { Debug.LogError("OOPSALA we have an ERROR!"); } _syncedVars = GetComponentInChildren <SyncedVars>(); if (_syncedVars == null) { Debug.LogError("OOPSALA we have an ERROR!"); } }
private void CheckSyncVars() { if (_syncedVars == null) { _syncedVars = GameObject.Find("SyncedVars").GetComponent <SyncedVars>(); // needs to be here, function runs before awake } if (_syncedVars == null) { Debug.LogError("We got a problem here"); } }
//////////////////////////////////////////////// //////////////////////////////////////////////// public static void SetUpPlayer() { SyncedVars _syncedVars = GameObject.Find("SyncedVars").GetComponent <SyncedVars>(); // needs to be here, function runs before awake if (_syncedVars == null) { Debug.LogError("We got a problem here"); } PlayerID = _syncedVars.PlayerCount; LoadPlayerDataInToManager(PlayerID); }
public void CmdAddPlayerToSession(NetworkInstanceId clientID) { Start(); network_Client_Objects.Add(clientID, ClientScene.FindLocalObject(clientID)); SyncedVars _syncedVars = GameObject.Find("SyncedVars").GetComponent <SyncedVars>(); // needs to be here, function runs before awake if (_syncedVars == null) { Debug.LogError("We got a problem here"); } RpcUpdatePlayerCountOnClient(_syncedVars.PlayerCount + 1); }
//////////////////////////////////////////////// //////////////////////////////////////////////// // The players personal GUI public static void SetUpPlayersGUI(int playerID) { GameManager._UIManager.GetComponent <Canvas>().enabled = true; playerIDText.text = playerID.ToString(); playerNameText.text = PlayerManager.PlayerName; SyncedVars _syncedVars = GameObject.Find("SyncedVars").GetComponent <SyncedVars>(); // needs to be here, function runs before awake if (_syncedVars == null) { Debug.LogError("We got a problem here"); } seedNumText.text = _syncedVars.GlobalSeed.ToString(); }
// Use this for initialization void Awake() { _gameManager = FindObjectOfType <GameManager>(); if (_gameManager == null) { Debug.LogError("OOPSALA we have an ERROR!"); } _syncedvars = _gameManager._networkManager._syncedVars; if (_syncedvars == null) { Debug.LogError("OOPSALA we have an ERROR!"); } network_Client_Objects = new Dictionary <NetworkInstanceId, GameObject>(); network_Unit_Objects = new Dictionary <NetworkInstanceId, GameObject>(); }
// called on the SERVER when a client connects public override void OnServerConnect(NetworkConnection Conn) { Debug.Log("NETWORKMANAGER: Client Connect!! Con: " + Conn.hostId); _syncedVars = FindObjectOfType <SyncedVars>(); if (_syncedVars == null) { Debug.LogError("OOPSALA we have an ERROR!"); } if (Conn.hostId == -1) { int globalSeed = Random.Range(0, 100); Random.InitState(globalSeed); _syncedVars.GlobalSeed = globalSeed; } _syncedVars.PlayerCount = 1; }
// called on the SERVER when a client connects public override void OnServerConnect(NetworkConnection Conn) { Debug.Log("NETWORKMANAGER: Client Connect!! Con: " + Conn.hostId); SyncedVars _syncedVars = GameObject.Find("SyncedVars").GetComponent <SyncedVars>(); // needs to be here, function runs before awake if (_syncedVars == null) { Debug.LogError("We got a problem here"); } if (Conn.hostId == -1) { int globalSeed = Random.Range(0, 100); Random.InitState(globalSeed); _syncedVars.GlobalSeed = globalSeed; } _syncedVars.PlayerCount = 1; }
//////////////////////////////////////////////// //////////////////////////////////////////////// public static void BuildWorldForClient() { SyncedVars _syncedVars = GameObject.Find("SyncedVars").GetComponent <SyncedVars>(); // needs to be here, function runs before awake if (_syncedVars == null) { Debug.LogError("We got a problem here"); } int GlobalSeed = _syncedVars.GlobalSeed; Random.InitState(GlobalSeed); // Get the World Nodes WorldBuilder.BuildWorldNodes(); LayerManager.MakeAllNodeLayersVisible(); Debug.Log("FINSIHED Building World!!!!!!!!"); }
void Awake() { Debug.Log("NETWORKMANAGER: Awake"); _syncedVars = GetComponentInChildren <SyncedVars>(); }