Пример #1
0
        private PlayerGoalManager InstantiatePlayerGoalManager(Player.Player player, ActionCountdown actionCountdown)
        {
            Debug.Log($"Instantiating goal manager for player {player.peerId}");
            var playerGoalManagerGameObject = Instantiate(_playerGoalManagerPrefab, _networkedObjectsRoot.transform);

            NetworkServer.Spawn(playerGoalManagerGameObject);

            var playerGoalManager = playerGoalManagerGameObject.GetComponent <PlayerGoalManager>();

            _playerGoalManagers[player.peerId] = playerGoalManager;
            playerGoalManager.SetPlayer(player, actionCountdown);

            return(playerGoalManager);
        }
Пример #2
0
        private ActionCountdown InstantiateActionCountdown(Player.Player player)
        {
            Debug.Log($"Instantiating countdown for player {player.peerId}");
            var actionCountdownGameObject = Instantiate(_actionCountdownPrefab);

            NetworkServer.Spawn(actionCountdownGameObject);

            var actionCountdown = actionCountdownGameObject.GetComponent <ActionCountdown>();

            _actionCountdowns[player.peerId] = actionCountdown;
            actionCountdown.AssignToPlayer(player);

            return(actionCountdown);
        }