예제 #1
0
        public void setPercent(float value)
        {
            fillBarBackground.setCenter(base.getCenterX(), base.getCenterY());
            fillBarBackground.setSize(base.getWidth() - (edgeSize * 2.0f), base.getHeight() - (edgeSize * 2.0f));

            percent = value;

            if (fillBar == null)
            {
                fillBar           = new DrawRectangle();
                fillBar.fillColor = Color.Chartreuse;
                fillBar.edgeColor = Color.FromArgb(0, 0, 0, 0);
            }

            if (percent <= 0.0f)
            {
                percent = 0.0f;
                fillBar.rectangleVisible = false;
            }
            else
            {
                if (percent > 1.0f)
                {
                    percent = 1.0f;
                }
                fillBar.rectangleVisible = true;
            }

            float bufferSizeX = edgeSize;
            float bufferSizeY = edgeSize;

            float barSizeX = base.getWidth() - (bufferSizeX * 2.0f);
            float barSizeY = base.getHeight() - (bufferSizeY * 2.0f);

            if (fillOnX)
            {
                barSizeX *= percent;

                fillBar.setWidth(barSizeX);
                fillBar.setHeight(barSizeY);

                fillBar.setCenterX(base.getCenterX() - (base.getWidth() * 0.5f) + bufferSizeX +
                                   (barSizeX * 0.5f));
                fillBar.setCenterY(base.getCenterY());
            }
            else
            {
                barSizeY *= percent;

                fillBar.setWidth(barSizeX);
                fillBar.setHeight(barSizeY);

                fillBar.setCenterX(base.getCenterX());
                fillBar.setCenterY(base.getCenterY() + (base.getHeight() * 0.5f) - bufferSizeY -
                                   (barSizeY * 0.5f));
            }
        }
예제 #2
0
 /**
  *
  */
 private void updateHighLight()
 {
     if (highLight.visible)
     {
         highLight.setCenter(base.getCenterX(), base.getCenterY());
         highLight.setSize(base.getWidth() * 2, base.getHeight() * 2);
         highLight.setFrame((highLight.getFrame() + 1) % highLight.getSprite().getTotalFrames());
     }
 }
예제 #3
0
        /**
         * decrements infectedTimer and updates infectBar
         */
        private void updateInfectedStatus()
        {
            //infect Bar
            infectBar.setWidth(base.getWidth());
            infectBar.setHeight(health.getHeight());
            infectBar.setCenterX(base.getCenterX());
            infectBar.setCenterY(health.getCenterY() - health.getHeight());

            //infectCloud
            infectCloud.setSize(base.getWidth(), base.getHeight());
            infectCloud.setCenter(base.getCenterX(), base.getCenterY());
        }
예제 #4
0
 /**
  * Will set the Sparcles size and position based on the given vectors
  * @param center
  * @param size
  */
 protected void setSparclePositionScale()
 {
     sparcler.setCenter(base.getBackGround().getCenterX(), base.getBackGround().getCenterY());
     sparcler.setSize(base.getBackGround().getWidth(), base.getBackGround().getHeight());
 }
예제 #5
0
 /**
  * Updates the size and position of selected
  */
 private void updateSelected()
 {
     selected.setCenter(base.getCenterX(), base.getCenterY());
     selected.setSize(base.getWidth() * 1.3f, base.getHeight() * 1.3f);
 }