public override void Attached() { Personalization = GetComponent <PlayerPersonalization>(); if (BoltNetwork.IsServer) { var evnt = PlayerJoinedEvent.Create(); evnt.Message = "Hello There"; evnt.Send(); } if (entity.IsOwner) // only activate the camera for the player. Nobody else's camera! { Personalization.SetName(); Personalization.SetHat_Eye(); EntityCamera.gameObject.SetActive(true); CinematicCamera.SetActive(true); var evntPly = GetPlayerPersonalizationEvent.Create(); evntPly.PlayerEntity = entity; evntPly.Send(); } }
public override void OnEvent(GetPlayerPersonalizationEvent evnt) // HANDLE ALL COSMETICS HERE!! { var playermat = Player_Colors.PlayerMaterials; if (playermat.Count == 0) // no materials assigned. Get a list of all the possible colors. Remove them as you go. { playermat.Add(Color_Tags.BLUE); playermat.Add(Color_Tags.GREEN); playermat.Add(Color_Tags.GREY); playermat.Add(Color_Tags.LIGHTBLUE); playermat.Add(Color_Tags.LIGHTGREEN); playermat.Add(Color_Tags.ORANGE); playermat.Add(Color_Tags.PURPLE); playermat.Add(Color_Tags.RED); playermat.Add(Color_Tags.WHITE); playermat.Add(Color_Tags.YELLOW); } int chosenIndex = Random.Range(0, playermat.Count); string chosenColor = playermat[chosenIndex]; // if its a problem, use the delete function in player_materials. playermat.RemoveAt(chosenIndex); // index has been chosen. var Set_Evnt = SetPlayerPersonalizationEvent.Create(); Set_Evnt.PlayerEntity = evnt.PlayerEntity; Set_Evnt.PlayerColor = chosenColor; Set_Evnt.Send(); }