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 set the target of the Animation and the Time for it to take place for a Drop
  */
 protected void setMoveTarget()
 {
     //checking if currentEnemyGrid and position are up to date
     if (hostSet != null)
     {
         //Will set spider to drop down one row
         if (dropDistance < MAX_DROP_DISTANCE && hostSet.getNumberOfRows() > (currentRow + dropDistance + 1))
         {
             dropping    = true;
             dropStart.X = base.getCenterX();
             dropStart.Y = base.getCenterY();
             dropDistance++;
             BaseEnemy target = hostSet.getEnemyAt(currentRow + dropDistance, currentCollumn);
             if (target != null && target != this)
             {
                 dropTarget.X = target.getCenterX();
                 dropTarget.Y = target.getCenterY();
             }
             else
             {
                 dropTarget.X = base.getCenterX();
                 dropTarget.Y = base.getCenterY();
                 dropTarget   = hostSet.getWorldPosition(currentRow + dropDistance, currentCollumn);
             }
             //setting Web hang point and initializing web
             setWebPositionSize();;
         }
         else
         {
             dropping = false;
         }
     }
 }
Exemple #4
0
 /**
  * Will set the center of this objects position to the appropriate position in the animation and increment animPos
  * Changes animation to move to TargetPosition then move to the set EndPosition
  */
 protected override void setCenterToAnimatedPosition()
 {
     //From StartPos to TargetEnemy in (animTime/2)
     if (isTypeRevealed && byteTarget != null && !removeAfterAnimation)
     {
         PointF targetEnemyPosition = new PointF();
         targetEnemyPosition.X = byteTarget.getCenterX();
         targetEnemyPosition.Y = byteTarget.getCenterY();
         //IfBiting at Reveal vs during normal Update
         if (byteTime > 0)
         {
             //Moving Two Enemy
             if (bytePos < (byteTime / 2))
             {
                 setCenterX((float)(((targetEnemyPosition.X - animPosStart.X) / 2f) * (1f + Math.Cos((((Math.PI / 2f) * (float)bytePos) - ((Math.PI / 4f) * (float)byteTime)) / ((float)byteTime / 4f))) + animPosStart.X));
                 setCenterY((float)(((targetEnemyPosition.Y - animPosStart.Y) / 2f) * (1f + Math.Cos((((Math.PI / 2f) * (float)bytePos) - ((Math.PI / 4f) * (float)byteTime)) / ((float)byteTime / 4f))) + animPosStart.Y));
             }
             //Reached Enemy
             //From TargetEnemy to EndPos in (animTime/2)
             else if (bytePos == (byteTime / 2))
             {
                 setCenterX((float)(((targetEnemyPosition.X - animPosEnd.X) / 2f) * (1f + Math.Cos((((Math.PI / 2f) * (float)bytePos) - ((Math.PI / 4f) * (float)byteTime)) / ((float)byteTime / 4f))) + animPosEnd.X));
                 setCenterY((float)(((targetEnemyPosition.Y - animPosEnd.Y) / 2f) * (1f + Math.Cos((((Math.PI / 2f) * (float)bytePos) - ((Math.PI / 4f) * (float)byteTime)) / ((float)byteTime / 4f))) + animPosEnd.Y));
                 ByteTarget(byteTarget);
             }
             //From TargetEnemy to EndPos in (animTime/2)
             else
             {
                 setCenterX((float)(((targetEnemyPosition.X - animPosEnd.X) / 2f) * (1f + Math.Cos((((Math.PI / 2f) * (float)bytePos) - ((Math.PI / 4f) * (float)byteTime)) / ((float)byteTime / 4f))) + animPosEnd.X));
                 setCenterY((float)(((targetEnemyPosition.Y - animPosEnd.Y) / 2f) * (1f + Math.Cos((((Math.PI / 2f) * (float)bytePos) - ((Math.PI / 4f) * (float)byteTime)) / ((float)byteTime / 4f))) + animPosEnd.Y));
             }
             bytePos++;
         }
         //Biting Enemy during normal Turn
         else if (byteTime <= 0)
         {
             //Moving Two Enemy
             if (animPos < (animTime / 2))
             {
                 setCenterX((float)(((targetEnemyPosition.X - animPosStart.X) / 2f) * (1f + Math.Cos((((Math.PI / 2f) * (float)animPos) - ((Math.PI / 4f) * (float)animTime)) / ((float)animTime / 4f))) + animPosStart.X));
                 setCenterY((float)(((targetEnemyPosition.Y - animPosStart.Y) / 2f) * (1f + Math.Cos((((Math.PI / 2f) * (float)animPos) - ((Math.PI / 4f) * (float)animTime)) / ((float)animTime / 4f))) + animPosStart.Y));
             }
             //Reached Enemy
             //From TargetEnemy to EndPos in (animTime/2)
             else if (animPos == (animTime / 2))
             {
                 setCenterX((float)(((targetEnemyPosition.X - animPosEnd.X) / 2f) * (1f + Math.Cos((((Math.PI / 2f) * (float)animPos) - ((Math.PI / 4f) * (float)animTime)) / ((float)animTime / 4f))) + animPosEnd.X));
                 setCenterY((float)(((targetEnemyPosition.Y - animPosEnd.Y) / 2f) * (1f + Math.Cos((((Math.PI / 2f) * (float)animPos) - ((Math.PI / 4f) * (float)animTime)) / ((float)animTime / 4f))) + animPosEnd.Y));
                 ByteTarget(byteTarget);
             }
             //From TargetEnemy to EndPos in (animTime/2)
             else
             {
                 setCenterX((float)(((targetEnemyPosition.X - animPosEnd.X) / 2f) * (1f + Math.Cos((((Math.PI / 2f) * (float)animPos) - ((Math.PI / 4f) * (float)animTime)) / ((float)animTime / 4f))) + animPosEnd.X));
                 setCenterY((float)(((targetEnemyPosition.Y - animPosEnd.Y) / 2f) * (1f + Math.Cos((((Math.PI / 2f) * (float)animPos) - ((Math.PI / 4f) * (float)animTime)) / ((float)animTime / 4f))) + animPosEnd.Y));
             }
         }
     }
     //Normal Unrevealed Movement
     else
     {
         base.setCenterToAnimatedPosition();
     }
 }