void HandleGoal(Player player) { int dir = UpdateScore(player); clockRunning = false; if (authoritative) { GoalMessage goal = new GoalMessage(); goal.Player = player; goal.Time = clock; Manager.Network.Engine.Send(goal, LiteNetLib.SendOptions.ReliableOrdered); } if (localScore >= 5) { EndGame(Player.Server); } else if (remoteScore >= 5) { EndGame(Player.Client); } else { LaunchBall(dir); } }
private void OnGoal(GoalMessage message) { if (message.player == _player) { _score++; UpdateScore(); } }
public void ParseAndResolveTypes() { GoalMessage.ParseAndResolveTypes(); GoalActionMessage.ParseAndResolveTypes(); ResultMessage.ParseAndResolveTypes(); ResultActionMessage.ParseAndResolveTypes(); FeedbackMessage.ParseAndResolveTypes(); FeedbackActionMessage.ParseAndResolveTypes(); }
private GoalMessage CreateGoalMessage(ApplicationUser currentUser, Goal goal, string comment) { //TODO localization var message = new GoalMessage { OwnerId = currentUser.Id, CreationDate = DateTime.Now.ToUniversalTime(), GoalId = goal.Id, Goal = goal, Text = $"Статус изменен: '{_stateNameProvider.GetName(goal.State)}'." }; if (!string.IsNullOrWhiteSpace(comment)) { message.Text += $"{Environment.NewLine}{comment}"; } var observerMessages = goal.Observers .Select(x => new UserGoalMessage { UserId = x.ObserverId, User = x.Observer, GoalMessage = message }); message.MessageSubscribers = new List <UserGoalMessage>(observerMessages) { new() { UserId = goal.PerformerId, User = goal.Performer, GoalMessage = message } }; return(message); }
private void OnGoal(GoalMessage message) { ResetPosition(); }
public void HandleGoal(GoalMessage goal) { clock = goal.Time; clockRunning = false; UpdateScore(goal.Player); }