Ejemplo n.º 1
0
 /**
  * Will set the Target of the Byte and will Deduct any points that will need to be Deducted as a result of the byte
  * Will Also Set the Animation to move towards the Byte target within the Fist half of the animation ime
  * @return The super.storedStateChangeObject as the change game state
  */
 private StateChange setByteTarget()
 {
     storedStateChangeObject.setToDefualts();
     bytePos = 0;
     if (currentTarget != null)
     {
         currentTarget.removeNode();
     }
     if (hostSet != null)
     {
         //choosing Target Enemy
         targetEnemyCollumn = getRandomCollomn();
         byteTarget         = hostSet.getEnemyAt(currentRow, targetEnemyCollumn);
         //Deducting Points
         if (byteTarget != this)
         {
             //Byte
             if (byteTarget != null && byteTarget.type != InteractableObject.ObjectType.CAT)
             {
                 if (byteTarget.isTypeRevealed)
                 {
                     storedStateChangeObject.changeInPlayerScore = -byteTarget.getScore();
                 }
                 if (byteTarget.type == InteractableObject.ObjectType.ANGRY)
                 {
                     storedStateChangeObject.add(((Ghost)byteTarget).getExplodeEffects());
                 }
             }
             //Move
             else if (byteTarget == null)
             {
                 hostSet.moveEnemy(this, currentRow, targetEnemyCollumn);
                 base.setAnimationTarget(currentRow, targetEnemyCollumn);
             }
             //Idle
             else
             {
                 targetEnemyCollumn = -1;
                 byteTarget         = null;
             }
             //is enemy already targeted
             if (isEnemyAlreadyTargeted(byteTarget))
             {
                 targetEnemyCollumn = -1;
                 byteTarget         = null;
             }
             //targeting enemy
             else
             {
                 currentTarget = targetEnemy(byteTarget);
             }
         }
         else
         {
             byteTarget = null;
         }
     }
     return(storedStateChangeObject);
 }
Ejemplo n.º 2
0
        /**
         * Will deduct points for each Enemy to be eaten and set first target for the spider to drop
         * and will Determine how many Rows the Spider will Drop
         */
        public override StateChange revealType(int pauseTime)
        {
            //checking if currentEnemyGrid and position are up to date
            storedStateChangeObject.setToDefualts();
            if (!isTypeRevealed)
            {
                base.revealType(pauseTime);
                //setting targets to move Towards
                dropDistance = 0;
                setMoveTarget();
                initializeWeb();
                //Deducting points as a result of Drop
                if (hostSet != null)
                {
                    base.revealType(pauseTime);
                    //checking if two rows below the spider exist

                    /*if(hostSet.doesGridPositionExist(currentRow, currentRow + 2)){
                     *      //Jumping Down 1 row
                     *      BaseEnemy target = hostSet.getEnemyAt(currentRow + 1, currentCollumn);
                     *      if(target != null){
                     *              storedStateChangeObject.changeInPlayerScore -= target.getScore();
                     *      }
                     *      //Jumping Down 2 row
                     *      target = hostSet.getEnemyAt(currentRow + 2, currentCollumn);
                     *      if(target != null){
                     *              storedStateChangeObject.changeInPlayerScore -= target.getScore();
                     *      }
                     *      storedStateChangeObject.puaseForAnimation = true;
                     *      dropTime = pauseTime/3;
                     * }
                     * //checking if one rows below the spider exist
                     * else */if (hostSet.doesGridPositionExist(currentRow, currentRow + 1))
                    {
                        //Jumping Down 1 row
                        BaseEnemy target = hostSet.getEnemyAt(currentRow + 1, currentCollumn);
                        if (target != null)
                        {
                            storedStateChangeObject.changeInPlayerScore -= target.getScore();
                        }
                        storedStateChangeObject.puaseForAnimation = true;
                        dropTime = pauseTime / 2;
                    }
                    if (dropTime == 0)
                    {
                        hostSet.moveEnemy(this, currentRow + dropDistance, currentCollumn);
                        fillRowWithEnemies(currentRow + dropDistance);
                        this.setAnimationTarget(currentRow, currentCollumn);
                    }
                }
            }
            else if (getInfectStatus() <= 0)
            {
                return(removeThis());
            }
            return(storedStateChangeObject);
        }