예제 #1
0
 /**
  * If (type == ObjectType.GHOST || type == ObjectType.ANGRY) will set the the number of turns the Ghost will need to progress to the next to the next Stage in its evolution
  * @param newTime must be greater then 0 and if  (type == ObjectType.GHOST) less than 4, otherwise less than 6
  */
 public bool setGhostTimer(short newTime)
 {
     if (type == InteractableObject.ObjectType.GHOST || type == InteractableObject.ObjectType.ANGRY)
     {
         if (subject == null)
         {
             subject = createEnemy(type);
         }
         if (subject.type != type)
         {
             if (type == InteractableObject.ObjectType.GHOST && subject.type == InteractableObject.ObjectType.ANGRY)
             {
                 ((Ghost)subject).MakeNotAngry();
             }
             else if (type == InteractableObject.ObjectType.ANGRY && subject.type == InteractableObject.ObjectType.GHOST)
             {
                 ((Ghost)subject).MakeAngry();
             }
             else
             {
                 subject.removeThis();
                 BaseEnemy newSubject = createEnemy(type);
                 newSubject.setCenter(subject.getCenterX(), subject.getCenterY());
                 subject = newSubject;
             }
         }
         return(((Ghost)subject).setAngryTimer(newTime));
     }
     return(false);
 }
예제 #2
0
 /**
  * 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);
 }