Exemple #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);
 }
Exemple #2
0
 //any changes to state as a result of clobber are added to storedStateChangeObject
 private void clobber(int row, int collumn, int animationTime)
 {
     if (hostSet != null)
     {
         BaseEnemy target = hostSet.getEnemyAt(row, collumn);
         if (target != null)
         {
             if (target.type == InteractableObject.ObjectType.ANGRY)
             {
                 storedStateChangeObject.add(((Ghost)target).explode());
             }
             else
             {
                 if (target.type != InteractableObject.ObjectType.GHOST)
                 {
                     target.removeThis();
                     Ghost newGhost = new Ghost(BaseCode.activeLibrary);
                     newGhost.setCenter(target.getCenterX(), target.getCenterY());
                     newGhost.revealType(0);
                     hostSet.addEnemy(newGhost, row, collumn);
                     newGhost.setAnimationTarget(row, collumn);
                     newGhost.revealType(animationTime);
                 }
                 else
                 {
                     target.revealType(animationTime);
                 }
             }
         }
     }
 }
Exemple #3
0
 /**
  * Will eat the Victem at the Given location
  * @param row	the row the Victem the victem lies in
  * @param column the column the Victem the victem lies in
  * @return The change in score as a result of the meal
  */
 protected void EatVictem(int row, int column)
 {
     if (hostSet != null)
     {
         BaseEnemy victem = hostSet.getEnemyAt(row, column);
         if (victem != null && victem != this)
         {
             victem.removeThis();
         }
     }
 }
Exemple #4
0
 /**
  * Will Bite a Random Enemy on the current Row
  * @return the Score Decrement as a result of the Bite
  */
 private void BiteTarget(BaseEnemy target)
 {
     if (hostSet != null && target != null)
     {
         EnemySoundManager.requestSound(EnemySoundManager.SoundType.DRACKULA_ATTACK);
         //Target is Ghost
         //Making Angry
         if (target.type == InteractableObject.ObjectType.GHOST)
         {
             //if not revealed
             if (!target.isTypeRevealed)
             {
                 target.revealType(0);
             }
             ((Ghost)target).MakeAngry();
         }
         //Target is already an angry Ghost
         else if (target.type == InteractableObject.ObjectType.ANGRY)
         {
             //if not revealed
             if (!target.isTypeRevealed)
             {
                 target.revealType(0);
             }
             ((Ghost)target).explode();
             removeThis();
         }
         //Target is not an Angry Ghost
         //Removing Target and Making it an angry Ghost
         else if (target != this && target.type != InteractableObject.ObjectType.CAT)
         {
             target.removeThis();
             Ghost angryGhost = new Ghost(BaseCode.activeLibrary);
             angryGhost.revealType(0);
             hostSet.addEnemy(angryGhost, currentRow, targetEnemyCollumn);
             angryGhost.setCenter(base.getCenterX(), base.getCenterY());
             angryGhost.setAnimationTarget(currentRow, targetEnemyCollumn);
         }
     }
     if (currentTarget != null)
     {
         currentTarget.removeNode();
         currentTarget = null;
     }
     targetEnemyCollumn = -1;
 }
Exemple #5
0
 private void ByteTarget(BaseEnemy target)
 {
     if (target != null && hostSet != null)
     {
         EnemySoundManager.requestSound(EnemySoundManager.SoundType.CAT_ATTACK);
         if (target.type == InteractableObject.ObjectType.ANGRY)
         {
             ((Ghost)target).explode();
             removeThis();
         }
         else
         {
             target.removeThis();
         }
     }
     if (currentTarget != null)
     {
         currentTarget.removeNode();
         currentTarget = null;
     }
     targetEnemyCollumn = -1;
 }