Example #1
0
        public ActionBar(Character character)
        {
            this.provider = GameManager.Instance;
            this.character = character;

            buttons = new Rectangle[NUM_BUTTONS];
            cds = new Rectangle[NUM_BUTTONS];

            ContentManager content = provider.Game.Content;

            font = content.Load<SpriteFont>("Fonts/GUIFont");
            textColor = Color.White;

            buttonTexture = content.Load<Texture2D>("UITextures/popbg");
            coolDownTexture = new Texture2D(provider.Game.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            coolDownTexture.SetData<Color>(new[] { new Color(0.1f, 0.1f, 0.1f, 0.5f) });

            int xOffset = HPAD;
            int yOffset = provider.Game.GraphicsDevice.Viewport.Height - VPAD - (int)BUTTON_SIZE.Y;

            for (int i = 0; i < NUM_BUTTONS; i++)
            {
                buttons[i] = new Rectangle(xOffset, yOffset, (int)BUTTON_SIZE.X, (int)BUTTON_SIZE.Y);
                cds[i] = new Rectangle(xOffset, yOffset, (int)BUTTON_SIZE.X, (int)BUTTON_SIZE.Y);
                xOffset += (int)BUTTON_SIZE.X + SPACING;
            }
        }
Example #2
0
        /// <summary>
        /// Creates a fresh gamestate with all game objects initialized and set to inactive.
        /// </summary>
        public GameState( ResourceProvider provider )
        {
            towers = new Tower[2];
            towers[0] = new Tower(Team.BLUE, provider);
            towers[1] = new Tower(Team.RED, provider);

            characters = new Character[GameSettings.MAX_LOBBY_CAPACITY];
            for ( int i = 0; i < GameSettings.MAX_LOBBY_CAPACITY; ++i )
            {
                characters[i] = new Character( provider );
            }

            spells = new Spell[GameSettings.MAX_SPELLS];
            for ( int i = 0; i < GameSettings.MAX_SPELLS; ++i )
            {
                spells[i] = new Spell( provider );
            }

            pickups = new PickUp[GameSettings.MAX_PICKUPS];
            for ( int i = 0; i < GameSettings.MAX_PICKUPS; ++i )
            {
                pickups[i] = new PickUp( provider );
            }

            roundClock = TimeSpan.Zero;

            scores = new int[2];
            for ( int i = 0; i < scores.Length; ++i )
            {
                scores[i] = 0;
            }
        }
Example #3
0
        public NamePlate(Character character)
        {
            this.provider = GameManager.Instance;
            this.character = character;

            ContentManager content = provider.Game.Content;

            teamColor = GameSettings.TeamColour(character.Team);
            name = character.Name;
            font = content.Load<SpriteFont>("Fonts/namePlateFont");

            maxHealth = new Rectangle(0, 0, (int)BAR_SIZE.X, (int)BAR_SIZE.Y);
            effectiveHealth = new Rectangle(0, 0, (int)BAR_SIZE.X, (int)BAR_SIZE.Y);
            currentHealth = new Rectangle(0, 0, (int)BAR_SIZE.X, (int)BAR_SIZE.Y);
            namePosition = new Vector2();

            maxHealthTexture = new Texture2D(provider.Game.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            maxHealthTexture.SetData<Color>(new[] { new Color(0.1f, 0.1f, 0.1f, 0.7f) });

            currentHealthTexture = new Texture2D(provider.Game.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            currentHealthTexture.SetData<Color>(new[] { Color.White });

            effectiveHealthTexture = new Texture2D(provider.Game.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            effectiveHealthTexture.SetData<Color>(new[] { new Color(0.1f, 0.1f, 0.1f, 0.5f) });
        }
Example #4
0
        public PlayerFrame(Character character)
        {
            this.provider = GameManager.Instance;
            this.character = character;

            ContentManager content = provider.Game.Content;

            name = character.Name;
            font = content.Load<SpriteFont>("Fonts/GUIFont");
            font2 = content.Load<SpriteFont>("Fonts/playerFrameFont");

            maxHealthTexture = new Texture2D(provider.Game.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            maxHealthTexture.SetData<Color>(new[] { new Color(0.1f, 0.1f, 0.1f, 0.3f) });

            currentHealthTexture = new Texture2D(provider.Game.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            currentHealthTexture.SetData<Color>(new[] { new Color(0.1f, 0.7f, 0.1f, 1f) });

            effectiveHealthTexture = new Texture2D(provider.Game.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            effectiveHealthTexture.SetData<Color>(new[] { new Color(0.1f, 0.1f, 0.1f, 0.1f) });

            maxFocusTexture = new Texture2D(provider.Game.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            maxFocusTexture.SetData<Color>(new[] { new Color(0.1f, 0.1f, 0.1f, 0.3f) });

            currentFocusTexture = new Texture2D(provider.Game.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            currentFocusTexture.SetData<Color>(new[] { new Color(255, 215, 0f, 1f) });

            crystalTexture = content.Load<Texture2D>("Images/diamond");

                roleIconTextures[0] = content.Load<Texture2D>("Images/wizardicon");

                roleIconTextures[1] = content.Load<Texture2D>("Images/priesticon");

                roleIconTextures[2] = content.Load<Texture2D>("Images/wlicon");

                roleIconTextures[3] = content.Load<Texture2D>("Images/bmicon");

            roleBgTexture = new Texture2D(provider.Game.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            roleBgTexture.SetData<Color>(new[] { new Color(0.5f, 0.5f, 0.5f, 0.5f) });

            frameTexture = content.Load<Texture2D>("UITextures/CharFrame");

            healthStringPos= new Vector2(maxHealth.X + maxHealth.Width/2, maxHealth.Y + maxHealth.Height/2+2);
            healthStringOrigin = font.MeasureString("HEALTH") * 0.5f;

            focusStringPos = new Vector2(maxFocus.X + maxFocus.Width/2, maxFocus.Y + maxFocus.Height/2+2);
            focusStringOrigin = font.MeasureString("FOCUS") * 0.5f;

            crystalCountPos = new Vector2((int)(466*SCALE), (int)(91*SCALE));
            crystalCountOrigin = font.MeasureString("55") * 0.5f;
        }
Example #5
0
 public void UpgradeHealth(Character buyer)
 {
     if (buyer.CrystalCount >= 5)
     {
         buyer.CrystalCount -= 5;
         HealthPool += 5;
         if (HealthPool >= NextHealthUpgrade)
         {
             HealthModifier += 0.05f;
             NextHealthUpgrade += NextHealthUpgrade * 2;
             foreach (Character c in provider.GameState.Characters)
             {
                 if (c.Team == team)
                 {
                     c.HealthModifier = healthModifier;
                     c.MaxHealth *= healthModifier;
                     c.CurrentHealth += 5;
                 }
             }
         }
     }
 }
Example #6
0
 public void UpgradeFocus(Character buyer)
 {
     if (buyer.CrystalCount >= 5)
     {
         buyer.CrystalCount -= 5;
         FocusPool += 5;
         if (FocusPool >= NextFocusUpgrade)
         {
             FocusModifier += 0.05f;
             NextFocusUpgrade += NextFocusUpgrade * 2;
             foreach (Character c in provider.GameState.Characters)
             {
                 if (c.Team == team)
                 {
                     c.FocusModifier = focusModifier;
                     c.FocusGenRate *= focusModifier;
                 }
             }
         }
     }
 }
Example #7
0
 public void UpgradeDamage(Character buyer)
 {
     if (buyer.CrystalCount >= 5)
     {
         buyer.CrystalCount -= 5;
         DamagePool += 5;
         if (DamagePool >= NextDamageUpgrade)
         {
             DamageModifier += 0.05f;
             NextDamageUpgrade += NextDamageUpgrade * 2;
             foreach (Character c in provider.GameState.Characters)
             {
                 if (c.Team == team)
                 {
                     c.DamageModifier = damageModifier;
                 }
             }
         }
     }
 }
Example #8
0
 public void Hit( TimeSpan elapsedTime, Character target )
 {
     if ( SpellID >= 0 && SpellID < Details.Count )
     {
         Details[SpellID].hitBehaviour(elapsedTime, this, target);
     }
 }
Example #9
0
 public Radar( Character boundCharacter )
 {
     this.boundChar = boundCharacter;
     radarTex = GameManager.Instance.Game.Content.Load<Texture2D>( "UITextures/Radar" );
 }