Beispiel #1
0
        public GameScreen(ScreenManager manager)
            : base(manager)
        {
            this.backgroundManager = new BackgroundManager("grassBg", manager.ViewManager.Width, manager.ViewManager.Height);

            int characterBaseWh = manager.ViewManager.RelativeY(10);
            this.character = new Character(new Vector2(camera.X, camera.Y), characterBaseWh, characterBaseWh);

            int elementalBaseWH = manager.ViewManager.RelativeY(8);
            this.elementalManager = new ElementalManager(elementalBaseWH, elementalBaseWH);

            this.radar = new Radar("radar", "radar_dot",
                manager.ViewManager.RelativeX(90), manager.ViewManager.Height - manager.ViewManager.RelativeX(10),
                manager.ViewManager.RelativeX(8), manager.ViewManager.Width);
            this.infoArea = new InfoArea(manager.ViewManager);

            // TODO: Help screen
            this.inHelpScreen = this.startInfoDone = this.transformInfoDone = false;
        }
Beispiel #2
0
        public void Draw(SpriteBatch spriteBatch, Character character)
        {
            spriteBatch.Draw(infoZoneTexture, infoZoneRect, Color.White);

            // Character circle && HP / Exp bar
            DrawBars(spriteBatch, character);
            spriteBatch.Draw(characterCircle, characterCircleRect, Color.White);
            character.DrawStill(spriteBatch, characterCircleRect.Center.X, characterCircleRect.Center.Y,
                characterCircleRect.Width * 8 / 10, characterCircleRect.Height * 8 / 10);

            // Icons
            // TODO: Grey base icons
            DrawElementIcons(spriteBatch, character);

            // StatIcons
            DrawStatIcons(spriteBatch, character);
        }
Beispiel #3
0
 private void DrawStatIcons(SpriteBatch spriteBatch, Character character)
 {
     spriteBatch.Draw(attackIcon, attackIconRect, Color.White);
     NumberDrawer.DrawNumber(spriteBatch, character.TotalAttack, attackStatRect, Color.Black);
     spriteBatch.Draw(staminaIcon, staminaIconRect, Color.White);
     NumberDrawer.DrawNumber(spriteBatch, character.TotalStamina, staminaStatRect, Color.Black);
     spriteBatch.Draw(defenseIcon, defenseIconRect, Color.White);
     NumberDrawer.DrawNumber(spriteBatch, character.TotalDefense, defenseStatRect, Color.Black);
     spriteBatch.Draw(speedIcon, speedIconRect, Color.White);
     NumberDrawer.DrawNumber(spriteBatch, character.TotalSpeed, speedStatRect, Color.Black);
 }
Beispiel #4
0
        private void DrawElementIcons(SpriteBatch spriteBatch, Character character)
        {
            float fireRatio = character.FireRatio; float waterRatio = character.WaterRatio;
            float earthRatio = character.EarthRatio; float windRatio = character.WindRatio;

            if (character.IsActive(Elements.Fire)) spriteBatch.Draw(highlightTexture, fireIconRect, Color.White);
            else if (character.IsAvailable(Elements.Fire)) spriteBatch.Draw(availableTexture, fireIconRect, Color.White);
            spriteBatch.Draw(fireIcon, fireIconRect, Color.Black);
            spriteBatch.Draw(fireIcon,
                    new Rectangle(fireIconRect.X, fireIconRect.Y + (int)((1.0f - fireRatio) * fireIconRect.Height),
                    fireIconRect.Width, (int)(fireIconRect.Height * fireRatio)),
                    new Rectangle(0, (int)((1.0f - fireRatio) * fireIcon.Height), fireIcon.Width, (int)(fireRatio * fireIcon.Height)), 
                    (character.IsActive(Elements.Fire)) ? Color.White : Color.SlateGray);
            
            if (character.IsActive(Elements.Water)) spriteBatch.Draw(highlightTexture, waterIconRect, Color.White);
            else if (character.IsAvailable(Elements.Water)) spriteBatch.Draw(availableTexture, waterIconRect, Color.White);
            spriteBatch.Draw(waterIcon, waterIconRect, Color.Black);
            spriteBatch.Draw(waterIcon,
                    new Rectangle(waterIconRect.X, waterIconRect.Y + (int)((1.0f - waterRatio) * waterIconRect.Height),
                    waterIconRect.Width, (int)(waterIconRect.Height * waterRatio)),
                    new Rectangle(0, (int)((1.0f - waterRatio) * waterIcon.Height), waterIcon.Width, (int)(waterRatio * waterIcon.Height)),
                    (character.IsActive(Elements.Water)) ? Color.White : Color.SlateGray);

            if (character.IsActive(Elements.Earth)) spriteBatch.Draw(highlightTexture, earthIconRect, Color.White);
            else if (character.IsAvailable(Elements.Earth)) spriteBatch.Draw(availableTexture, earthIconRect, Color.White);
            spriteBatch.Draw(earthIcon, earthIconRect, Color.Black);
            spriteBatch.Draw(earthIcon,
                    new Rectangle(earthIconRect.X, earthIconRect.Y + (int)((1.0f - earthRatio) * earthIconRect.Height),
                    earthIconRect.Width, (int)(earthIconRect.Height * earthRatio)),
                    new Rectangle(0, (int)((1.0f - earthRatio) * earthIcon.Height), earthIcon.Width, (int)(earthRatio * earthIcon.Height)),
                    (character.IsActive(Elements.Earth)) ? Color.White : Color.SlateGray);

            if (character.IsActive(Elements.Wind))spriteBatch.Draw(highlightTexture, windIconRect, Color.White);
            else if (character.IsAvailable(Elements.Wind)) spriteBatch.Draw(availableTexture, windIconRect, Color.White);
            spriteBatch.Draw(windIcon, windIconRect, Color.Black);
            spriteBatch.Draw(windIcon,
                    new Rectangle(windIconRect.X, windIconRect.Y + (int)((1.0f - windRatio) * windIconRect.Height),
                    windIconRect.Width, (int)(windIconRect.Height * windRatio)),
                    new Rectangle(0, (int)((1.0f - windRatio) * windIcon.Height), windIcon.Width, (int)(windRatio * windIcon.Height)),
                    (character.IsActive(Elements.Wind)) ? Color.White : Color.SlateGray);
        }
Beispiel #5
0
 private void DrawBars(SpriteBatch spriteBatch, Character character)
 {
     spriteBatch.Draw(barTexture, expBarRect, Color.White);
     spriteBatch.Draw(barTexture,
         new Rectangle(expBarRect.X, expBarRect.Y, (int)(expBarRect.Width * character.ExperienceRatio), expBarRect.Height), Color.Gold);
     spriteBatch.Draw(barTexture, hpBarRect, Color.Red);
     spriteBatch.Draw(barTexture, new Rectangle(hpBarRect.X, hpBarRect.Y, (int)(hpBarRect.Width * character.HealthRatio), hpBarRect.Height),
         Color.Green);
     NumberDrawer.DrawNumber(spriteBatch, character.CurrentHealth, healthStatRect, Color.Orange);
 }