Beispiel #1
0
        public virtual void Draw(SpriteBatch spriteBatch)
        {
            if (isBuilding && !isPlaceSelected)
            {
                spriteBatch.Draw(texture[textureName], position, new Rectangle(animations.Last().x, animations.Last().y, animations.Last().width, animations.Last().height), Color.White);
            }
            else if ((isBuilding && isPlaceSelected && isStartBuilding) || isWorking)
            {
                Color color = Color.White;
                if (managerUnits != null)
                {
                    //              if (managerUnits.index % 2 == 0)
                    //                  color = Color.Red;
                    //              else if (managerUnits.index % 2 == 1)
                    //color = Color.Blue;
                    //else if (managerUnits.index == 2)
                    //	color = Color.Green;
                    //else if (managerUnits.index == 3)
                    //color = Color.Yellow;
                }

                if (information.HitPoints <= 0)
                {
                    color = Color.Black;
                }

                spriteBatch.Draw(texture[textureName], position, animations.rectangle, color);

                if ((progress.start && !progress.finish) || (progress.finish && information.HitPoints < information.HitPointsTotal))
                {
                    progress.Draw(spriteBatch);
                }
            }

            if (selected)
            {
                SelectRectangle.Draw(spriteBatch, rectangle);

                if (!unselected)
                {
                    SelectRectangle.DrawTarget(spriteBatch, new Rectangle(unitDestination.X * 32, unitDestination.Y * 32, 32, 32));
                }
            }
        }
        public void Draw(SpriteBatch spriteBatch)
        {
            if (isBuilding && !isPlaceSelected)
            {
                spriteBatch.Draw(texture, position, new Rectangle(animations.Last().x, animations.Last().y, animations.Last().width, animations.Last().height), Color.White);
            }
            else if ((isBuilding && isPlaceSelected && isStartBuilding) || isWorking)
            {
                spriteBatch.Draw(texture, position, animations.rectangle, Color.White);
            }

            if (selected)
            {
                SelectRectangle.Draw(spriteBatch, rectangle);

                if (!unselected)
                {
                    SelectRectangle.DrawTarget(spriteBatch, new Rectangle(target.X * 32, target.Y * 32, 32, 32));
                }
            }
        }