From 17aafe11f9c5c974edc2c5e9f6d1bb02da365327 Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Fri, 7 Nov 2014 21:01:13 +0100 Subject: [PATCH] Comment interfaces, expand the hittable interface. --- .../spacescooter/entity/Collidable.java | 11 +++++++ .../spacescooter/entity/Hittable.java | 31 +++++++++++++++++++ .../spacescooter/entity/Paintable.java | 6 ++++ .../spacescooter/entity/Updateable.java | 6 ++++ 4 files changed, 54 insertions(+) diff --git a/src/de/teamteamteam/spacescooter/entity/Collidable.java b/src/de/teamteamteam/spacescooter/entity/Collidable.java index a922d81..049b08c 100644 --- a/src/de/teamteamteam/spacescooter/entity/Collidable.java +++ b/src/de/teamteamteam/spacescooter/entity/Collidable.java @@ -2,7 +2,18 @@ package de.teamteamteam.spacescooter.entity; import java.awt.Rectangle; +/** + * Interface providing everything needed for collision handling. + */ public interface Collidable { + + /** + * Provide information about the position and dimensions of the Entity. + */ public Rectangle getCollisionBox(); + + /** + * Notify the Collidable that a collision happened. + */ public void collideWith(Collidable entity); } diff --git a/src/de/teamteamteam/spacescooter/entity/Hittable.java b/src/de/teamteamteam/spacescooter/entity/Hittable.java index d2fee67..ab5f282 100644 --- a/src/de/teamteamteam/spacescooter/entity/Hittable.java +++ b/src/de/teamteamteam/spacescooter/entity/Hittable.java @@ -1,9 +1,40 @@ package de.teamteamteam.spacescooter.entity; +/** + * Interface providing everything needed to handle taking damage. + */ public interface Hittable { + /** + * Notify the Hittable that it took damage. + */ + public void takeDamage(int damage); + + /** + * Tell whether the Hittable is still alive. + */ + public boolean isAlive(); + + /** + * Get the Hittables current health points. + */ public int getHealthPoints(); + /** + * Set the Hittables current health points. + */ + public int setHealthPoints(); + + /** + * Get the Hittables current shield points. + */ public int getShieldPoints(); + /** + * Set the Hittables current shield points. + */ + public int setShieldPoints(); + + + } diff --git a/src/de/teamteamteam/spacescooter/entity/Paintable.java b/src/de/teamteamteam/spacescooter/entity/Paintable.java index f7138f6..60fb2ac 100644 --- a/src/de/teamteamteam/spacescooter/entity/Paintable.java +++ b/src/de/teamteamteam/spacescooter/entity/Paintable.java @@ -2,8 +2,14 @@ package de.teamteamteam.spacescooter.entity; import java.awt.Graphics2D; +/** + * Interface providing the paint method. + */ public interface Paintable { + /** + * All Paintable Entities need to implement this to paint themselves. + */ public void paint(Graphics2D g); } diff --git a/src/de/teamteamteam/spacescooter/entity/Updateable.java b/src/de/teamteamteam/spacescooter/entity/Updateable.java index 343f661..5853751 100644 --- a/src/de/teamteamteam/spacescooter/entity/Updateable.java +++ b/src/de/teamteamteam/spacescooter/entity/Updateable.java @@ -1,7 +1,13 @@ package de.teamteamteam.spacescooter.entity; +/** + * Interface providing the update method. + */ public interface Updateable { + /** + * All entities are Updateable through this method. + */ public void update(); }