@Override protected void process(Entity shower, Entity ingredient) { if (showerActive(shower)) { mSprinkle.create(shower).liquid = mShower.get(shower).liquid; if (ingredient.isActive() && collisionSystem.overlaps(shower, ingredient)) { act(shower, ingredient); } } }
private void act(Entity showery, Entity ingredient) { final ShowerLiquid liquid = mShower.get(showery).liquid; switch (liquid) { case PAINT: if (mIngredient.get(ingredient).type == Ingredient.Type.CHICKBUNNY) { // replace minion with correct type. final Pos sourcePos = mPos.get(ingredient); ingredient.deleteFromWorld(); ingredient = setupSystem.createIngredient( sourcePos.x + 3, sourcePos.y + 3, Ingredient.Type.MINION_PAINTED); break; } } // wash away blood. if (mIngredient.get(ingredient).type == Ingredient.Type.BLOOD) { ingredient.deleteFromWorld(); return; } mDrenched.create(ingredient); mWet.create(ingredient).liquid = liquid; mSpawnProtected.create(ingredient); gameScreenAssetSystem.playSfx("shower"); }
private boolean showerActive(Entity shower) { final Anim anim = mAnim.get(shower); final Animation animation = abstractAssetSystem.get(anim.id); animation.setPlayMode(Animation.PlayMode.LOOP); return animation.getKeyFrameIndex(anim.age) == 4; }