// moving removes all coordinates the obj currently is at and assumes its now at the new ones public void move(ArrayList<Coord> colist, boolean remStanding) { State newS = GameManager.getInstance().getState(); for (Coord co : loc) { newS.remObjC(co, this); } loc = new ArrayList<>(); for (Coord co : colist) { loc.add(co); newS.addObjC(co, this); } if (remStanding) removeAllStanding(); }
// called when this is removed from the state for ANY REASON public void whenRemoved() { State s = GameManager.getInstance().getState(); for (Coord c : loc) { s.remObjC(c, this); } for (ObjT ot : types) { ot.whenRemoved(); } s.remObjID(id); if (parent != null) { parent.removeChild(id); } removeAllStanding(); }
public CObj(ArrayList<Coord> co, int own, int hei, int wid, int weigh, int heal, String nam) { super( own, nam, own == -123456789 ? false : true); // this tests if the object is real or not (for comparatorObject) health = heal; maxHealth = heal; height = hei; width = wid; weight = weigh; State s = GameManager.getInstance().getState(); for (Coord c : co) { loc.add(c); s.addObjC(c, this); } }