private void OnDeleteEntityResponse(WorldCommands.DeleteEntity.ReceivedResponse response) { var entityId = response.RequestPayload.EntityId; // Log not error as the most common failure cause is that the entity has already been deleted. if (response.StatusCode != StatusCode.Success) { logDispatcher.HandleLog(LogType.Log, new LogEvent("Could not delete entity.") .WithField(LoggingUtils.EntityId, entityId) .WithField("Reason", response.Message)); return; } var spawnedCubesCopy = new List <EntityId>(cubeSpawnerWriter.Data.SpawnedCubes); if (!spawnedCubesCopy.Remove(entityId)) { logDispatcher.HandleLog(LogType.Error, new LogEvent("The entity has been unexpectedly removed from the list.") .WithField(LoggingUtils.EntityId, entityId)); return; } cubeSpawnerWriter.SendUpdate(new CubeSpawner.Update { SpawnedCubes = spawnedCubesCopy }); }
private void OnDeleteEntityResponse(WorldCommands.DeleteEntity.ReceivedResponse response) { if (!ReferenceEquals(this, response.Context)) { // This response was not for a command from this behaviour. return; } var entityId = response.RequestPayload.EntityId; if (response.StatusCode != StatusCode.Success) { logDispatcher.HandleLog(LogType.Error, new LogEvent("Could not delete entity.") .WithField(LoggingUtils.EntityId, entityId) .WithField("Reason", response.Message)); return; } var spawnedCubesCopy = new List <EntityId>(cubeSpawnerWriter.Data.SpawnedCubes); if (!spawnedCubesCopy.Remove(entityId)) { logDispatcher.HandleLog(LogType.Error, new LogEvent("The entity has been unexpectedly removed from the list.") .WithField(LoggingUtils.EntityId, entityId)); return; } cubeSpawnerWriter.Send(new CubeSpawner.Update { SpawnedCubes = spawnedCubesCopy }); }
private void OnDelEntityResponse(WorldCommands.DeleteEntity.ReceivedResponse response) { if (response.StatusCode == StatusCode.Success) { // handle success Debug.Log("del success"); } else { // handle failure Debug.Log("failure"); } }
public void AddDeleteEntityResponse(WorldCommands.DeleteEntity.ReceivedResponse response) { worldCommandsReceivedStorage.AddResponse(response); }
public void AddResponse(WorldCommands.DeleteEntity.ReceivedResponse response) { deleteEntityResponses.Add(response); }
public int Compare(WorldCommands.DeleteEntity.ReceivedResponse x, WorldCommands.DeleteEntity.ReceivedResponse y) { return(x.RequestId.CompareTo(y.RequestId)); }