@Test public void testGenerateNewlyVisibleActorMessage() { Actor actor = mock(Actor.class); when(actor.getName()).thenReturn("Foo"); when(actor.getVector2D()).thenReturn(Vector2D.ORIGIN); when(actor.getAngle()).thenReturn(new Angle()); when(actor.getWorld()).thenReturn(WorldUtils.createDefaultWorld()); Message message = worldServerMessageFactory.generateNewlyVisibleMessage(actor); assertEquals(message.name, "ActorVisibleMessage"); assertEquals(message.getArgument("name"), "Foo"); assertEquals(message.getArgument("relativeAngle"), Angle.IDLE); }
public Message generateNewlyVisibleMessage(WorldObject object) { Message newlyVisibleMessage; if (object instanceof Actor) { newlyVisibleMessage = generateActorVisibleMessage((Actor) object); } else { newlyVisibleMessage = generateObjectVisibleMessage(object); } return newlyVisibleMessage; }
WorldServerMessageFactory extends ServerMessageFactory { public Message generateNewlyVisibleMessage(WorldObject object) { Message newlyVisibleMessage; if (object instanceof Actor) { newlyVisibleMessage = generateActorVisibleMessage((Actor) object); } else { newlyVisibleMessage = generateObjectVisibleMessage(object); } return newlyVisibleMessage; } }
WorldServerMessageFactory extends ServerMessageFactory { public Message generateNewlyVisibleMessage(WorldObject object) { Message newlyVisibleMessage; if (object instanceof Actor) { newlyVisibleMessage = generateActorVisibleMessage((Actor) object); } else { newlyVisibleMessage = generateObjectVisibleMessage(object); } return newlyVisibleMessage; }  }
WorldServerMessageFactory extends ServerMessageFactory { public Message generateNewlyVisibleMessage(WorldObject object) { Message newlyVisibleMessage; if (object instanceof Actor) { newlyVisibleMessage = generateActorVisibleMessage((Actor) object); } else { newlyVisibleMessage = generateObjectVisibleMessage(object); } return newlyVisibleMessage; }  Message generateNewlyVisibleMessage(WorldObject object); List<Message> generateChangeStateMessages(Actor changedActor); Message generateForcedStateMessage(MoveState forcedState); Message generateActorMoveSpeedMessage(double moveSpeed); Message generateNewlyInvisibleMessage(WorldObject object); Message generateWorldLoginResponse(); Message generateWorldFileResponse(byte[] worldFileBytes); Message generateWorldChecksumResponse(byte[] checkSum); }
WorldServerMessageFactory extends ServerMessageFactory { public Message generateNewlyVisibleMessage(WorldObject object) { Message newlyVisibleMessage; if (object instanceof Actor) { newlyVisibleMessage = generateActorVisibleMessage((Actor) object); } else { newlyVisibleMessage = generateObjectVisibleMessage(object); } return newlyVisibleMessage; }  Message generateNewlyVisibleMessage(WorldObject object); List<Message> generateChangeStateMessages(Actor changedActor); Message generateForcedStateMessage(MoveState forcedState); Message generateActorMoveSpeedMessage(double moveSpeed); Message generateNewlyInvisibleMessage(WorldObject object); Message generateWorldLoginResponse(); Message generateWorldFileResponse(byte[] worldFileBytes); Message generateWorldChecksumResponse(byte[] checkSum);  }