Esempio n. 1
0
    public void Spawn()
    {
        if (!character)
        {
            character = BoltNetwork.Instantiate(BoltPrefabs.SpaceCadet);
            PlanetManager.Instance.PhysicsObjects.Add(character.gameObject.GetComponent <PhysicsObject>());
            if (IsServer)
            {
                character.TakeControl();
            }
            else
            {
                character.AssignControl(connection);
            }
        }

        // teleport entity to a spawn position
        character.transform.position = new Vector3(0, 0, 0);
    }
Esempio n. 2
0
 public void CancelBlueprintSafe()
 {
     GameStats.CancelledStructure.Invoke();
     for (int i = 0; i < this._requiredIngredients.Count; i++)
     {
         this.SpawnBackIngredients(i);
     }
     this.CheckText();
     this.AllOff(false);
     if (BoltNetwork.isRunning && base.entity.isAttached)
     {
         BoltNetwork.Destroy(base.entity);
     }
     else
     {
         UnityEngine.Object.Destroy(this._ghost);
     }
     base.enabled = false;
 }
Esempio n. 3
0
    private void SpawnEnemiesAndObjectives()
    {
        //Vector3 enemySpawnPos;

        //enemySpawnPos = GameObjectManager.Instance.Planets[0].transform.position;
        //enemySpawnPos.x += 30;
        //BoltNetwork.Instantiate(leadSoldierPrefab, enemySpawnPos, Quaternion.identity);

        GameObjectManager.Instance.Planets.ForEach(planet =>
        {
            int numberOfEnemies = UnityEngine.Random.Range(1, 4);
            Vector3 enemySpawnPos;
            Vector3 objectiveSpawnPos;
            if (numberOfEnemies > 0)
            {
                enemySpawnPos    = planet.transform.position;
                enemySpawnPos.x += 30;
                BoltNetwork.Instantiate(leadSoldierPrefab, enemySpawnPos, Quaternion.identity);
            }
            if (numberOfEnemies > 1)
            {
                enemySpawnPos    = planet.transform.position;
                enemySpawnPos.y += 30;
                BoltNetwork.Instantiate(leadSoldierPrefab, enemySpawnPos, Quaternion.identity);
            }
            if (numberOfEnemies > 2)
            {
                enemySpawnPos    = planet.transform.position;
                enemySpawnPos.z += 30;
                BoltNetwork.Instantiate(leadSoldierPrefab, enemySpawnPos, Quaternion.identity);
            }

            int probabilityOfObjectives = UnityEngine.Random.Range(1, 101);
            if (probabilityOfObjectives > 50)
            {
                objectiveSpawnPos    = planet.transform.position;
                objectiveSpawnPos.z += 30;
                BoltNetwork.Instantiate(objectivePrefab, objectiveSpawnPos, Quaternion.identity);
            }
        });

        GameObjectManager.Instance.RefreshEnemies();
    }
Esempio n. 4
0
    void OnGUI()
    {
        StartBox(stateLineCounts[(int)state] * lineHeight);
        switch (state)
        {
        case State.INIT:
            DrawSelectionMenu();
            break;

        case State.LAUNCH_CLIENT:
            if (BoltNetwork.isRunning)
            {
                state = State.CLIENT;
            }
            else
            {
                DrawLoadingMessage();
            }
            break;

        case State.CLIENT:
            DrawClientMenu();
            //if (BoltNetwork.isConnected) Destroy(this.gameObject);
            break;

        case State.SERVER_SETUP:
            DrawServerSetupMenu();
            break;

        case State.LAUNCH_SERVER:
            if (BoltNetwork.isRunning)
            {
                BoltNetwork.LoadScene(BoltScenes.lobby);
            }
            else
            {
                DrawLoadingMessage();
            }
            break;
        }
        EndBox();
    }
    public void ConnectBW2WO(Vector3 inputPosition, Quaternion inputRotation)
    // public void ConnectBW2WO(Transform inputTransform)
    {
        worldOriginPosition = inputPosition;
        worldOriginRotation = inputRotation;

        worldOrigin.transform.position = inputPosition;
        worldOrigin.transform.rotation = inputRotation;

        bigWrap = GameObject.FindGameObjectWithTag("BigWrap");
        if (bigWrap == null)
        {
            bigWrap = BoltNetwork.Instantiate(
                bigWrapPrefab,
                inputPosition,
                inputRotation
                );
        }
        bigWrap.transform.parent = worldOrigin.transform;

        arCubeList = GameObject.FindGameObjectsWithTag("ARCube");
        for (i = 0; i < arCubeList.Length; i++)
        {
            // arCubeList[i].transform.position = arCubeList[i].GetComponent<ARCubeInteractionBolt>().state.ARCubeTransform.Position;
            // arCubeList[i].transform.rotation = arCubeList[i].GetComponent<ARCubeInteractionBolt>().state.ARCubeTransform.Rotation;
            arCubeList[i].transform.parent = bigWrap.transform;
        }
        gameBase = GameObject.FindGameObjectWithTag("GameBase");
        gameBase.transform.position = inputPosition;
        gameBase.transform.rotation = inputRotation;
        gameBase.transform.parent   = bigWrap.transform;
        bigWrap.transform.position  = inputPosition;
        bigWrap.transform.rotation  = inputRotation;
        bigWrap.transform.parent    = worldOrigin.transform;

        if (myHandCollider == null)
        {
            myHandCollider = BoltNetwork.Instantiate(handColliderPrefab, new Vector3(0, 10, 0), new Quaternion(0, 0, 0, 0));
            myHandCollider.transform.parent = worldOrigin.transform;
        }
        SendConnectEvent();
    }
Esempio n. 6
0
        public override void SceneLoadLocalDone(string map)
        {
            if (SceneManager.GetActiveScene().name != "PreAlphaMap")
            {
                return;
            }

            foreach (var entity in BoltNetwork.Entities)
            {
                if (!entity.StateIs <IPlayerInfo>() || !entity.IsOwner)
                {
                    continue;
                }

                var playerInfo = entity.GetState <IPlayerInfo>();
                CreatePlayer(playerInfo, null, true);
                BoltNetwork.Destroy(entity);
                break;
            }
        }
Esempio n. 7
0
        public override void SceneLoadRemoteDone(BoltConnection connection)
        {
            if (SceneManager.GetActiveScene().name != "PreAlphaMap")
            {
                return;
            }

            foreach (var entity in BoltNetwork.Entities)
            {
                if (!entity.StateIs <IPlayerInfo>() || !entity.IsController(connection))
                {
                    continue;
                }

                var playerInfo = entity.GetState <IPlayerInfo>();
                CreatePlayer(playerInfo, connection, false);
                BoltNetwork.Destroy(entity);
                break;
            }
        }
Esempio n. 8
0
        public override void BoltShutdownBegin(AddCallback registerDoneCallback)
        {
            BoltConsole.Write("BoltShutdownBegin");
            _matchName = "";

            if (BoltNetwork.IsServer)
            {
                BoltNetwork.LoadScene(lobbyScene.SimpleSceneName);
            }
            else if (BoltNetwork.IsClient)
            {
                SceneManager.LoadScene(lobbyScene.SimpleSceneName);
            }

            registerDoneCallback(() =>
            {
                BoltConsole.Write("Shutdown Done");
                ChangeTo(mainMenuPanel);
            });
        }
 private void OnGameStart()
 {
     try
     {
         AnimalSpawnController.lastUpdate = Time.realtimeSinceStartup + 30f;
         try
         {
             BoltNetwork.UpdateSceneObjectsLookup();
         }
         catch (Exception)
         {
         }
         CoopTreeGrid.Update(BoltNetwork.SceneObjects);
         this.AttachBuildings();
     }
     finally
     {
         LoadSave.OnGameStart -= this.OnGameStart;
     }
 }
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (!entity.IsOwner())
        {
            return;
        }

        var deathEvent = DeathEvent.Create(entity);

        deathEvent.Send();

        BoltNetwork.Destroy(gameObject);

        Hitbox otherHitbox = collision.collider.GetComponent <Hitbox>();

        if (otherHitbox)
        {
            otherHitbox.Damage(damage);
        }
    }
Esempio n. 11
0
 private void Update()
 {
     if (this.Fuel > 0f)
     {
         this.Fuel -= 2f * Time.deltaTime;
         this.SpreadFire(base.transform.position, this.FireSpread);
     }
     else if (this.destroyWhenOutOfFuel)
     {
         if (!BoltNetwork.isRunning || !this.entity || !this.entity.isAttached)
         {
             UnityEngine.Object.Destroy((!this.DestroyTarget) ? base.gameObject : this.DestroyTarget);
         }
         else if (this.entity.isOwner)
         {
             base.transform.parent = null;
             BoltNetwork.Destroy((!this.DestroyTarget) ? base.gameObject : this.DestroyTarget);
         }
     }
 }
Esempio n. 12
0
    public virtual void DestroySelf()
    {
        //Debug.Log("Add to Cache");

        /*
         * if (cache.ForKeyPush(cacheKey, this)) {
         *      gameUnitState.RemoveAllCallbacks();
         *      entity.Freeze(true);
         * }
         * else {
         */
        //App.shared.Log("DestroySelf", this);
        BoltNetwork.Destroy(gameObject);

        foreach (var comp in gameObject.GetComponents <AudioSource>())
        {
            Destroy(comp);
        }
        //}
    }
Esempio n. 13
0
 //draws the menu to specify what server to connect to
 private void DrawClientMenu()
 {
     FlexLabel("Connect");
     DrawFieldLine("IP", ref ip);
     DrawFieldLine("Username", ref GameManager.instance.CurrentUserName);
     DrawFieldLine("Password", ref password);
     GUILayout.BeginHorizontal();
     if (GUILayout.Button("Connect"))
     {
         if (!BoltNetwork.isRunning)
         {
             BoltLauncher.StartClient();
         }
         else
         {
             BoltNetwork.Connect(UdpKit.UdpEndPoint.Parse(ip), new ConnectionRequestData(GameManager.instance.CurrentUserName, password));
         }
     }
     GUILayout.EndHorizontal();
 }
Esempio n. 14
0
    public static void UpdateZeusData()
    {
        if (!BoltNetwork.isServer)
        {
            throw new System.Exception("Attempted to update zeus data on a client!");
        }
        ServerInfoToken token = new ServerInfoToken();

        token.IsDedicatedServer = IsDedicated;
        token.GameMode          = GameManager.instance.gameMode.GameModeName;
        token.MapName           = "TEMP_NULL";
        token.MaxPlayerCount    = (byte)GameManager.instance.gameMode.MaxPlayers;
        token.PlayerCount       = (byte)GameManager.instance.Lobby.PlayerCount;
        token.MOTD             = MOTD;
        token.PasswordRequired = !string.IsNullOrEmpty(Password);
        token.ServerName       = ServerName;
        GameManager.GameState state = GameManager.instance.CurrentGameState;
        token.HideInServerList = state == GameManager.GameState.LOBBY || state == GameManager.GameState.POST_GAME;
        BoltNetwork.SetHostInfo(ServerName, token);
    }
Esempio n. 15
0
    void OnGUI()
    {
        GUILayout.BeginArea(new Rect(10, 10, Screen.width - 20, Screen.height - 20));

        if (GUILayout.Button("Start Server", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)))
        {
            //start server
            BoltLauncher.StartServer(UdpKit.UdpEndPoint.Parse("127.0.0.1:27000"));
            BoltNetwork.LoadScene("Test");
        }

        if (GUILayout.Button("Start Client", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)))
        {
            //Start Client
            BoltLauncher.StartClient();
            BoltNetwork.Connect(UdpKit.UdpEndPoint.Parse("127.0.0.1:27000"));
        }

        GUILayout.EndArea();
    }
Esempio n. 16
0
    public void Spawn()
    {
        if (!character)
        {
            character = BoltNetwork.Instantiate(BoltPrefabs.Player);

            if (IsServer)
            {
                character.TakeControl();
            }
            else
            {
                character.AssignControl(connection);
            }
        }

        // TODO: Get spawn point from the current map
        character.transform.position = RandomPosition();
        behavior = character.GetComponent <PlayerBehavior>();
    }
Esempio n. 17
0
        private void CreateStreamChannels()
        {
            _streamChannels.Clear();

            string[] streamChannelNames  = Enum.GetNames(typeof(StreamChannelType));
            int[]    streamChannelValues = Enum.GetValues(typeof(StreamChannelType)) as int[];

            for (int i = 0; i < streamChannelValues.Length; i++)
            {
                StreamChannelType type = (StreamChannelType)streamChannelValues[i];

                GetStreamChannelSettings(type, out bool reliable, out int priority);

                UdpChannelName photonChannelName = BoltNetwork.CreateStreamChannel(streamChannelNames[i], reliable ? UdpChannelMode.Reliable : UdpChannelMode.Unreliable, priority);

                StreamChannel channel = new StreamChannel(photonChannelName, streamChannelNames[i], reliable, priority, type);

                _streamChannels.Add(type, channel);
            }
        }
Esempio n. 18
0
 public override void SessionListUpdated(Map <Guid, UdpSession> sessionList)
 {
     if (staticData.boltFree == true)
     {
         Debug.Log("number of sessions: " + BoltNetwork.SessionList.Count);
         foreach (var session in BoltNetwork.SessionList)
         {
             var photonSession = session.Value as PhotonSession;
             if (photonSession.Source == UdpSessionSource.Photon)
             {
                 if (photonSession.HostName == selectedGameSession.GameSessionId)
                 {
                     TestToken token = new TestToken();
                     token.ArbitraryData = myPlayerSessionID;
                     BoltNetwork.Connect(photonSession, token);
                 }
             }
         }
     }
 }
    public override void ConnectRequest(UdpEndPoint endpoint, IProtocolToken token)         // reject the player if there are more than 10 players and if the game has started.
    {
        var connections = BoltNetwork.Connections.ToList();

        // https://doc.photonengine.com/en-us/bolt/current/connection-and-authentication/accept-refuse-connection
        if (connections.Count > MAX_PLAYERS | GameManager.instance.Game_Counter_Started)     // 10 players max; // reject if the game has started
        {
            BoltNetwork.Refuse(endpoint);

            /*
             * BoltMatchmaking.UpdateSession(new PhotonRoomProperties()
             * {
             *  IsOpen = false,
             *  IsVisible = false,
             * });*/
            return;
        }

        BoltNetwork.Accept(endpoint);
    }
Esempio n. 20
0
        public static void Spawn()
        {
            var        pos          = new Vector3(Random.Range(-16, 16), 0.6f, Random.Range(-16, 16));
            BoltEntity playerEntity = BoltNetwork.Instantiate(BoltPrefabs.BomberPlayer, pos, Quaternion.identity);

            playerEntity.TakeControl();

            BomberPlayerController playerController = playerEntity.GetComponent <BomberPlayerController>();

            Photon.Lobby.LobbyPlayer lobbyPlayer = Photon.Lobby.LobbyPlayer.localPlayer;

            if (lobbyPlayer)
            {
                playerController.Setup(lobbyPlayer.playerName, lobbyPlayer.playerColor);
            }
            else
            {
                playerController.Setup("Player #" + Random.Range(1, 100), Random.ColorHSV());
            }
        }
Esempio n. 21
0
        public override void SessionListUpdated(Map <Guid, UdpSession> sessionList)
        {
            if (_timerRoutine != null)
            {
                StopCoroutine(_timerRoutine);
                _timerRoutine = null;
            }

            Debug.LogFormat("Session list updated: {0} total sessions", sessionList.Count);

            foreach (var session in sessionList)
            {
                UdpSession photonSession = session.Value as UdpSession;

                if (photonSession.Source == UdpSessionSource.Photon)
                {
                    BoltNetwork.Connect(photonSession);
                }
            }
        }
Esempio n. 22
0
    public override void OnEvent(ItemPickedUpEvent evnt)            // all clients and server must understand that the player has oicked up an item.
    {
        if (BoltNetwork.IsServer)
        {
            if (evnt.ItemEntity != null)
            {
                BoltNetwork.Destroy(evnt.ItemEntity);                   // only the server can spawn item entities
            }
        }

        if (evnt.FromSelf)
        {
            if (evnt.ItemType == "" | evnt.ItemType == null)
            {
                return;
            }                                                               // return if the item type is a shield or something that is not a weapon/trap.
            evnt.PlayerEntity.GetComponentInChildren <WeaponManager>().InitializeItem(evnt.ItemType);
            //BoltNetwork.Instantiate(BoltPrefabs.hammer_low, new Vector3(0,0.2f,0))
        }
    }
Esempio n. 23
0
    public override void BoltStartDone()
    {
        if (BoltNetwork.IsClient)
        {
#if !BOLT_CLOUD
            UdpEndPoint endPoint = new UdpEndPoint(UdpIPv4Address.Parse(serverAddress), (ushort)serverPort);

            RoomProtocolToken token = new RoomProtocolToken
            {
                ArbitraryData = "Room Token"
            };

            BoltNetwork.Connect(endPoint, token);
#endif
        }
        else
        {
            BoltNetwork.LoadScene(map);
        }
    }
Esempio n. 24
0
    public IEnumerator DelayedCollapse()
    {
        base.enabled = false;
        base.GetComponent <Collider>().enabled = false;
        yield return(YieldPresets.WaitTwoSeconds);

        int childCount = base.transform.parent.childCount;

        for (int i = childCount - 1; i >= 0; i--)
        {
            if (base.transform.parent.GetChild(i) != base.transform)
            {
                UnityEngine.Object.Destroy(base.transform.parent.GetChild(i).gameObject);
            }
        }
        LocalPlayer.Sfx.PlayStructureFall(base.gameObject, 0.01f);
        UnityEngine.Object.Instantiate <GameObject>(Prefabs.Instance.DestroyedLeafShelter, base.transform.position, base.transform.rotation);
        yield return(YieldPresets.WaitOneSecond);

        if (this && base.transform)
        {
            if (!BoltNetwork.isClient)
            {
                if (!BoltNetwork.isRunning)
                {
                    UnityEngine.Object.Destroy(base.transform.parent.gameObject);
                }
                else
                {
                    BoltNetwork.Destroy(base.transform.parent.gameObject);
                }
            }
            else
            {
                RequestDestroy requestDestroy = RequestDestroy.Create(GlobalTargets.OnlyServer);
                requestDestroy.Entity = base.transform.parent.GetComponent <BoltEntity>();
                requestDestroy.Send();
            }
        }
        yield break;
    }
Esempio n. 25
0
 protected void Update()
 {
     CoopPeerStarter.MapState mapState = this.mapState;
     if (mapState != CoopPeerStarter.MapState.Begin)
     {
         if (mapState != CoopPeerStarter.MapState.Loading)
         {
             if (mapState == CoopPeerStarter.MapState.Done)
             {
                 try
                 {
                     BoltNetwork.UpdateSceneObjectsLookup();
                 }
                 catch (Exception)
                 {
                 }
                 Camera componentInChildren = base.GetComponentInChildren <Camera>();
                 if (componentInChildren)
                 {
                     componentInChildren.enabled = false;
                 }
                 base.StartCoroutine(this.LoadingDone());
                 this.mapState = CoopPeerStarter.MapState.Playing;
             }
         }
         else if (!this.GetAsync() || this.GetAsync().isDone)
         {
             this.mapState = CoopPeerStarter.MapState.Done;
         }
     }
     else
     {
         CoopPlayerCallbacks.ClearTrees();
         LoadAsync async = this.GetAsync();
         if (async)
         {
             async.gameObject.SetActive(true);
             this.mapState = CoopPeerStarter.MapState.Loading;
         }
     }
 }
Esempio n. 26
0
    private void OnEnable()
    {
        GameManager   = GameObject.Find("GameManager");
        PlayerManager = GameObject.Find("PlayerManager");

        Player[] players = GameManager.GetComponent <GameManager>().GetAllPlayers();

        var playersUnsorted = new Dictionary <Player, int>();

        for (int i = 0; i < players.GetLength(0); i++)
        {
            if (players[i] != null)
            {
                playersUnsorted.Add(players[i], players[i].state.Score);
            }
        }

        var playersSorted = from pair in playersUnsorted orderby pair.Value descending select pair;

        foreach (KeyValuePair <Player, int> pair in playersSorted)
        {
            if (pair.Key != null)
            {
                Debug.Log("Scoreboard player: " + pair.Key.state.Username);
                GameObject _row = BoltNetwork.Instantiate(BoltPrefabs.Row, transform.position, Quaternion.identity);
                _row.transform.SetParent(transform);
                Text  Name   = _row.transform.GetChild(0).GetComponent <Text>();
                Text  Kills  = _row.transform.GetChild(1).GetComponent <Text>();
                Text  Deaths = _row.transform.GetChild(2).GetComponent <Text>();
                Text  Score  = _row.transform.GetChild(3).GetComponent <Text>();
                Image Rank   = _row.transform.GetChild(4).GetChild(0).GetComponent <Image>();

                Name.text   = pair.Key.state.Username;
                Kills.text  = pair.Key.state.Kills.ToString();
                Deaths.text = pair.Key.state.Deaths.ToString();
                Score.text  = pair.Key.state.Score.ToString();
                Rank[] _ranks = PlayerManager.GetComponent <RankManager>().CalculateRank(pair.Key.state.XP);
                Rank.sprite = _ranks[0].RankIcon;
            }
        }
    }
Esempio n. 27
0
 private void AttachAnimalToNetwork(GameObject gameObject)
 {
     if (BoltNetwork.isServer)
     {
         BoltEntity boltEntity = gameObject.AddComponent <BoltEntity>();
         BoltEntity component  = gameObject.GetComponent <CoopAnimalServer>().NetworkContainerPrefab.GetComponent <BoltEntity>();
         using (BoltEntitySettingsModifier boltEntitySettingsModifier = component.ModifySettings())
         {
             using (BoltEntitySettingsModifier boltEntitySettingsModifier2 = boltEntity.ModifySettings())
             {
                 boltEntitySettingsModifier2.clientPredicted          = boltEntitySettingsModifier.clientPredicted;
                 boltEntitySettingsModifier2.persistThroughSceneLoads = boltEntitySettingsModifier.persistThroughSceneLoads;
                 boltEntitySettingsModifier2.allowInstantiateOnClient = boltEntitySettingsModifier.allowInstantiateOnClient;
                 boltEntitySettingsModifier2.prefabId     = boltEntitySettingsModifier.prefabId;
                 boltEntitySettingsModifier2.updateRate   = boltEntitySettingsModifier.updateRate;
                 boltEntitySettingsModifier2.serializerId = boltEntitySettingsModifier.serializerId;
             }
         }
         BoltNetwork.Attach(gameObject);
     }
 }
Esempio n. 28
0
 public override void Attached()
 {
     if (!BoltNetwork.isServer || base.entity.isOwner)
     {
     }
     base.state.AddCallback("LogCount", new PropertyCallbackSimple(this.ItemCountChangedMP));
     if (BoltNetwork.isServer && base.entity.isOwner && this._content == MultiHolder.ContentTypes.Body)
     {
         int contentAmount = this._contentAmount;
         for (int i = 0; i < contentAmount; i++)
         {
             base.state.IsReal = true;
             GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(Prefabs.Instance._deadMutantBodies[(int)this._bodyTypes[i]]);
             gameObject.SetActive(true);
             BoltNetwork.Attach(gameObject);
             gameObject.SendMessage("dropFromCarry", false, SendMessageOptions.DontRequireReceiver);
             gameObject.GetComponent <dummyAnimatorControl>().enabled = false;
             this.AddBodyMP(gameObject.GetComponent <BoltEntity>());
         }
     }
 }
Esempio n. 29
0
    // Callback triggered before the new local scene has been completely loaded
    public override void SceneLoadLocalDone(string map)
    {
        ///   if(BoltNetwork.isClient && map.Equals("GameScene") {
        ///     SplashScreen.Hide();
        ///   }

        print("S SceneLoadLocalDone");
        PlayerObject p = PlayerObjectRegistry.CreateServerPlayer(new CameraSpawnPoint(new Vector3(0f, 0f, -20f)));
        //server done loading

        //Find camera
        Camera myCamera = PlayerCamera.instance.GetComponentInChildren <Camera>();

        //create potato
        potato = BoltNetwork.Instantiate(BoltPrefabs.Potato);

        //Map camera to potato script
        (potato.GetComponent <PotatoController>()).mainCamera = myCamera;

        //p.rightWall =
    }
Esempio n. 30
0
        public void InstantiateEntity()
        {
            entity = BoltNetwork.Instantiate(BoltPrefabs.Player, new TestToken(), RandomSpawn(), Quaternion.identity);

            state.name = name;
            state.team =
                redPlayers.Count() >= bluePlayers.Count()
      ? TEAM_BLUE
      : TEAM_RED;

            if (isServer)
            {
                entity.TakeControl(new TestToken());
            }
            else
            {
                entity.AssignControl(connection, new TestToken());
            }

            Spawn();
        }