package main; import java.awt.Graphics; import java.util.Iterator; import java.util.LinkedList; import gamegui.Animation; public class Entity { String name; Animation img; Location loc; long timeLastUpdated; public boolean remove; LinkedList actions; public Entity(final String name, final Animation img) { this.name = name; this.img = img; this.loc = new Location(0.0, 0.0); this.timeLastUpdated = 0L; this.remove = false; this.actions = new LinkedList(); } public Entity(final Entity copy) { this.name = new String(copy.name); this.img = new Animation(copy.img); this.loc = new Location(copy.loc); this.timeLastUpdated = 0L; this.remove = false; this.actions = new LinkedList(); final Iterator iter = copy.actions.iterator(); while (iter.hasNext()) { this.actions.add(iter.next().copy()); } } public void setLocation(final Location loc) { this.loc.setLocation(loc); } public void draw(final Graphics g) { this.img.draw(g, this.loc.getX(), this.loc.getY() + this.img.getHeight() / 2); } public void update(final LinkedList lstObjects, final LinkedList lstTargets) { for (final Action cur : this.actions) { if (cur.readyToPerform()) { this.perform(cur, lstObjects, lstTargets); } } } public void perform(final Action action, final LinkedList lstObjects, final LinkedList lstTargets) { } }