public void Taking(Inject obj) { if (hp == 0) { this.team = obj.team; center.color = team.TeamColor; TeamChange?.Invoke(); } if (obj.team == this.team) { hp++; } else { hp--; } Destroy(obj.gameObject); HpTextUpdate(); HPChecker(); }
private bool HandleClientEventTeamChange(NetworkCommunicator peer, TeamChange message) { if (this.TeamSelectionEnabled) { if (message.AutoAssign) { this.AutoAssignTeam(peer); } else { this.ChangeTeamServer(peer, message.Team); } } return(true); }
public static TeamChange GetTeamChange(string json_string) { TeamChange temp = new TeamChange(); try { //string json_string = File.ReadAllText(SAPPRemote.MainWindow.SettingPath); if (Json.IsValid(json_string)) { var s = new JsonSerializerSettings(); s.NullValueHandling = NullValueHandling.Ignore; s.ObjectCreationHandling = ObjectCreationHandling.Replace; // without this, you end up with duplicates. temp = JsonConvert.DeserializeObject<TeamChange>(json_string, s); } else { } } catch (Exception) { } return temp; }