/** * Will update the subject based on the settings in the representative * @param hostSet the Enemy set that is in change of storing all of the BaseEnemies in use * @param puasetime the amount of time the game will pause for animations to proceed * @return whether or not any changes were made that actually require the game to pause * This includes revealing a Enemy, and Moving an enemy */ internal StateChange updateSubject(EnemySet hostSet, int puasetime) { if (hostSet != null) { //Matching EnemyTypes and moving/Adding Enemy to appropriate array position if (subject == null) { subject = createEnemy(type); storedStateChangeObject.puaseForAnimation = hostSet.addEnemy(subject, currentRow, currentCollumn); } else if (subject.type != type) { if (type == InteractableObject.ObjectType.GHOST && subject.type == InteractableObject.ObjectType.ANGRY) { ((Ghost)subject).MakeNotAngry(); storedStateChangeObject.puaseForAnimation = hostSet.moveEnemy(subject, currentRow, currentCollumn); } else if (type == InteractableObject.ObjectType.ANGRY && subject.type == InteractableObject.ObjectType.GHOST) { ((Ghost)subject).MakeAngry(); storedStateChangeObject.puaseForAnimation = hostSet.moveEnemy(subject, currentRow, currentCollumn); } else { subject.removeThis(); BaseEnemy newSubject = createEnemy(type); newSubject.setCenter(subject.getCenterX(), subject.getCenterY()); subject = newSubject; hostSet.addEnemy(subject, currentRow, currentCollumn); storedStateChangeObject.puaseForAnimation = false; } } else { storedStateChangeObject.puaseForAnimation = hostSet.moveEnemy(subject, currentRow, currentCollumn); } //Updating reveal state infect state etc.. subject.representative = (InteractableObject)this; subject.setInfectStatus(infectedTimer); subject.getHealth().setMaxSegments(maxHealth); subject.getHealth().setFilledSegments(currentHealth); subject.setScore(score); subject.circleEnemy(highlighted); //updating animation subject.setAnimationTarget(currentRow, currentCollumn); //updating Partial Reveal status if (subject.isPartialRevealed != partialRevealed && !revealed) { if (partialRevealed) { subject.partialReveal(); } else { subject.unrevealType(); } } //updating reveal state if (subject.isTypeRevealed != revealed) { subject.setToReveal = true; } subject.setInvulnerablility(invulnerable); } return(storedStateChangeObject); }