docs: double dispatch explanation + refactor (#2915)

This commit is contained in:
Ilkka Seppälä
2024-04-13 08:30:48 +03:00
committed by GitHub
parent 9240d80ef2
commit 825d45b086
4 changed files with 100 additions and 25 deletions
@@ -24,9 +24,14 @@
*/
package com.iluwatar.doubledispatch;
import lombok.Getter;
import lombok.Setter;
/**
* Game objects have coordinates and some other status information.
*/
@Getter
@Setter
public abstract class GameObject extends Rectangle {
private boolean damaged;
@@ -42,22 +47,6 @@ public abstract class GameObject extends Rectangle {
super.toString(), isDamaged(), isOnFire());
}
public boolean isOnFire() {
return onFire;
}
public void setOnFire(boolean onFire) {
this.onFire = onFire;
}
public boolean isDamaged() {
return damaged;
}
public void setDamaged(boolean damaged) {
this.damaged = damaged;
}
public abstract void collision(GameObject gameObject);
public abstract void collisionResolve(FlamingAsteroid asteroid);