public void walkedWithDog(boolean gettingDirty) { if ((getTime() - DogService.INSTANCE.getTimeLastWalked()) > THIRTYMINUTES) { DogService.INSTANCE.updateSatisfaction(10, 85); // setView(DogMood.HAPPY); } else { DogService.INSTANCE.updateSatisfaction(-5, 60); // setView(DogMood.SAD); } if (Math.random() < 0.75 && gettingDirty) { setDirty(true); // setView(DogMood.DIRTY); } DogService.INSTANCE.setWantsToWalk(false); }
public void playedWithDog(boolean gettingDirty) { if ((getTime() - getTimeLastEaten()) > THIRTYMINUTES) { DogService.INSTANCE.updateSatisfaction(15); } else { DogService.INSTANCE.updateSatisfaction(-5, 60); Toast.makeText( view.getContext(), "Pas op! Wacht met spelen tot 30 minuten nadat je hond gegeten heeft!", Toast.LENGTH_LONG) .show(); } if (Math.random() <= 0.75 && gettingDirty) { setDirty(true); // setView(DogMood.DIRTY); } // setView(DogMood.HAPPY); DogService.INSTANCE.setWantsToPlay(false); setTimeLastPlayed(new Date(getTime())); }
public void randomBark() { if (Math.random() >= 0.9975 && !DogService.INSTANCE.getBarking()) { DogService.INSTANCE.setBarking(true); } }
public long getTime() { return DogService.INSTANCE.getTime(); }
public void setDirty(boolean dirty) { DogService.INSTANCE.setDirty(dirty); }
public boolean getDirty() { return DogService.INSTANCE.getDirty(); }
public void setTimeLastPlayed(Date date) { DogService.INSTANCE.setTimeLastPlayed(date); }
public void setTimeLastEaten(Date date) { DogService.INSTANCE.setTimeLastEaten(date); }
public long getTimeLastEaten() { return DogService.INSTANCE.getTimeLastEaten(); }
// Getters & Setters public long getTimeLastPlayed() { return DogService.INSTANCE.getTimeLastPlayed(); }
public void hasEaten() { DogService.INSTANCE.setHungry(false); // setView(DogMood.HAPPY); setTimeLastEaten(new Date(getTime())); }
public void cleanedDog() { DogService.INSTANCE.updateSatisfaction(10); DogService.INSTANCE.setDirty(false); setDirty(false); }