@Test public void testAppliesTo() throws Exception { GameObjectInstanceRemovedFromSceneCondition theCondition = new GameObjectInstanceRemovedFromSceneCondition(); assertSame(ConditionResult.NOT_FULFILLED, theCondition.appliesTo(null, null)); GameScene theScene = mock(GameScene.class); GameObjectInstance theInstance2 = mock(GameObjectInstance.class); when(theInstance2.getOwnerGameObject()).thenReturn(mock(GameObject.class)); GameObjectInstanceRemovedFromScene theEvent = new GameObjectInstanceRemovedFromScene(theScene, theInstance2); assertSame(ConditionResult.NOT_FULFILLED, theCondition.appliesTo(theScene, theEvent)); GameObject theObject = mock(GameObject.class); GameObjectInstance theInstance = mock(GameObjectInstance.class); when(theInstance.getOwnerGameObject()).thenReturn(theObject); GameObjectInstanceRemovedFromScene theEvent2 = new GameObjectInstanceRemovedFromScene(theScene, theInstance); theCondition.gameObjectProperty().set(theObject); ConditionResult theResult = theCondition.appliesTo(theScene, theEvent2); assertNotSame(ConditionResult.NOT_FULFILLED, theResult); assertTrue(theResult.isConditionTrue()); assertEquals(theEvent2, theResult.getEvent()); assertEquals(1, theResult.getAffectedInstances().length); assertSame(theInstance, theResult.getAffectedInstances()[0]); }
@Override public ConditionResult appliesTo(GameScene aScene, GameEvent aEvent) { if (aEvent instanceof GameObjectInstanceRemovedFromScene) { GameObjectInstanceRemovedFromScene theEvent = (GameObjectInstanceRemovedFromScene) aEvent; GameObjectInstance theInstance = theEvent.instance; if (theInstance.getOwnerGameObject() == gameObject.get()) { return new ConditionResult(true, aEvent, new GameObjectInstance[] {theInstance}); } } return ConditionResult.NOT_FULFILLED; }
GameObjectInstanceRemovedFromSceneCondition implements Condition { @Override public ConditionResult appliesTo(GameScene aScene, GameEvent aEvent) { if (aEvent instanceof GameObjectInstanceRemovedFromScene) { GameObjectInstanceRemovedFromScene theEvent = (GameObjectInstanceRemovedFromScene) aEvent; GameObjectInstance theInstance = theEvent.instance; if (theInstance.getOwnerGameObject() == gameObject.get()) { return new ConditionResult(true, aEvent, new GameObjectInstance[] {theInstance}); } } return ConditionResult.NOT_FULFILLED; } }
GameObjectInstanceRemovedFromSceneCondition implements Condition { @Override public ConditionResult appliesTo(GameScene aScene, GameEvent aEvent) { if (aEvent instanceof GameObjectInstanceRemovedFromScene) { GameObjectInstanceRemovedFromScene theEvent = (GameObjectInstanceRemovedFromScene) aEvent; GameObjectInstance theInstance = theEvent.instance; if (theInstance.getOwnerGameObject() == gameObject.get()) { return new ConditionResult(true, aEvent, new GameObjectInstance[] {theInstance}); } } return ConditionResult.NOT_FULFILLED; } @UsedByReflection  GameObjectInstanceRemovedFromSceneCondition(); }
GameObjectInstanceRemovedFromSceneCondition implements Condition { @Override public ConditionResult appliesTo(GameScene aScene, GameEvent aEvent) { if (aEvent instanceof GameObjectInstanceRemovedFromScene) { GameObjectInstanceRemovedFromScene theEvent = (GameObjectInstanceRemovedFromScene) aEvent; GameObjectInstance theInstance = theEvent.instance; if (theInstance.getOwnerGameObject() == gameObject.get()) { return new ConditionResult(true, aEvent, new GameObjectInstance[] {theInstance}); } } return ConditionResult.NOT_FULFILLED; } @UsedByReflection  GameObjectInstanceRemovedFromSceneCondition(); Property<GameObject> gameObjectProperty(); @Override ConditionResult appliesTo(GameScene aScene, GameEvent aEvent); @Override Map<String, Object> serialize(); static GameObjectInstanceRemovedFromSceneCondition unmarshall(GameScene aGameScene, Map<String, Object> aSerializedData); }
GameObjectInstanceRemovedFromSceneCondition implements Condition { @Override public ConditionResult appliesTo(GameScene aScene, GameEvent aEvent) { if (aEvent instanceof GameObjectInstanceRemovedFromScene) { GameObjectInstanceRemovedFromScene theEvent = (GameObjectInstanceRemovedFromScene) aEvent; GameObjectInstance theInstance = theEvent.instance; if (theInstance.getOwnerGameObject() == gameObject.get()) { return new ConditionResult(true, aEvent, new GameObjectInstance[] {theInstance}); } } return ConditionResult.NOT_FULFILLED; } @UsedByReflection  GameObjectInstanceRemovedFromSceneCondition(); Property<GameObject> gameObjectProperty(); @Override ConditionResult appliesTo(GameScene aScene, GameEvent aEvent); @Override Map<String, Object> serialize(); static GameObjectInstanceRemovedFromSceneCondition unmarshall(GameScene aGameScene, Map<String, Object> aSerializedData); static final String GAME_OBJECT_PROPERTY; }