コード例 #1
0
 public abstract void Draw(SpriteBatch spriteBatch, MinionAnimationBatch animation);
コード例 #2
0
 public void Apply(GameState gameState, MinionAnimationBatch moveAnim)
 {
     for (int Idx = 0; Idx < spawns.Count; ++Idx)
     {
         int index = gameState.spawnIndices[Idx];
         if (index < spawns[Idx].Count)
         {
             MinionType spawntype = spawns[Idx][index];
             if (spawntype != null)
             {
                 if (gameState.getMinionAt(levelType.spawnPoint[Idx]) == null)
                 {
                     gameState.CreateEnemy(spawntype, levelType.spawnPoint[Idx], moveAnim);
                     gameState.spawnIndices[Idx]++;
                 }
             }
             else
             {
                 gameState.spawnIndices[Idx]++;
             }
         }
     }
 }
コード例 #3
0
 public override void Draw(SpriteBatch spriteBatch, MinionAnimationBatch animation)
 {
     spriteBatch.Draw(baseCard.image, drawPos, Color.White);
     //            spriteBatch.DrawString(Game1.font, baseCard.name, screenPos, Color.White);
 }
コード例 #4
0
        public override void Draw(SpriteBatch spriteBatch, MinionAnimationBatch animation)
        {
            Vector2 pos = animation.GetPosition(this);

            Texture2D texture = mtype.texture;
            if (stats.burning + stats.burningNextTurn > 0 && mtype.onFireTexture != null)
                texture = mtype.onFireTexture;

            spriteBatch.Draw(texture, new Rectangle((int)pos.X, (int)pos.Y, type.texture.Width, type.texture.Height), null, Color.White, 0.0f, Vector2.Zero, isEnemy ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0.0f);

            string healthString = "" + this.stats.health;
            Vector2 healthStringSize = Game1.font.MeasureString(healthString);
            spriteBatch.DrawString(Game1.font, healthString, pos + new Vector2(32 - healthStringSize.X, type.texture.Height), Color.Red);
        }
コード例 #5
0
 public MinionAnimationBatch AddBatch(GameState initialState, float duration)
 {
     MinionAnimationBatch newBatch = new MinionAnimationBatch(initialState, duration);
     batches.Add(newBatch);
     return newBatch;
 }
コード例 #6
0
        public bool CheckAttacks(GameState gameState, int bonusDamage, MinionAnimationBatch attack, MinionAnimationBatch recover, MinionAnimationSequence animation)
        {
            if (deleted || (stats.attack+bonusDamage) <= 0 || !gameState.CanPayCost(mtype.attackCost))
                return false;

            if (attack.HasAnimation(this))
                return false;

            Point[] attackOffsets = gameState.getOffsetsForRange(stats.range);

            if ((stats.attack+bonusDamage) > 0)
            {
                foreach (Point p in attackOffsets)
                {
                    if (CheckAttack(gameState, bonusDamage, new Point(position.X + p.X, position.Y + p.Y), attack, recover))
                    {
                        return true;
                    }
                }
            }
            return false;
        }
コード例 #7
0
        public bool CheckAttack(GameState gameState, int bonusDamage, Point attackPos, MinionAnimationBatch attack, MinionAnimationBatch recover)
        {
            if (deleted)
                return false;

            Minion m = gameState.getMinionAt(attackPos);
            if (m == null || isEnemy == m.isEnemy || m.stats.health <= 0 || m.stats.hasKeyword(Keyword.attackproof))
                return false;

            Attack(gameState, m, bonusDamage, attack, recover);
            return true;
        }
コード例 #8
0
        public void Attack(GameState gameState, Minion target, int bonusDamage, MinionAnimationBatch attackAnim, MinionAnimationBatch recoverAnim)
        {
            if (deleted)
                return;

            gameState.PayCost(mtype.attackCost);

            Vector2 basePos = drawPos;
            Vector2 targetPos = target.drawPos;
            targetPos = new Vector2(targetPos.X, targetPos.Y+target.type.texture.Height - type.texture.Height);
            Vector2 attackPos = basePos + (targetPos - basePos) * 0.5f;
            attackAnim.AddAnimation(this, basePos, attackPos);
            recoverAnim.AddAnimation(this, attackPos, basePos);

            DamageType damageType =
                stats.hasKeyword(Keyword.corrosive)? DamageType.acid:
                stats.hasKeyword(Keyword.fireform)? DamageType.fire:
                DamageType.attack;

            gameState.HandleTriggers(new TriggerEvent(TriggerType.onAttack, this, target));
            target.TakeDamage(gameState, stats.attack+bonusDamage, damageType, this);
        }
コード例 #9
0
        public void Draw(SpriteBatch spriteBatch, GameState gameStateOnSkip, MinionAnimationBatch animation)
        {
            spriteBatch.DrawString(Game1.font, "Turn " + turnNumber, new Vector2(200, 20), Color.White);
            DrawResources(spriteBatch, resources, gameStateOnSkip.resources, new Vector2(250, 20));

            for (int X = 0; X < levelScript.levelSize.X; X++)
            {
                for (int Y = 0; Y < levelScript.levelSize.Y; Y++)
                {
                    Point pos = new Point(X, Y);

                    if (ongoingEffects.ContainsKey(pos))
                        ongoingEffects[pos].Draw(spriteBatch, animation);

                    if (minions.ContainsKey(pos))
                        minions[pos].Draw(spriteBatch, animation);
                }
            }
        }
コード例 #10
0
 public void CreateEnemy(MinionType type, Point spawnPoint, MinionAnimationBatch moveAnim)
 {
     Minion spawned = new Minion(type, spawnPoint, true);
     minions[spawnPoint] = spawned;
     moveAnim.AddAnimation(spawned, spawned.drawPos + new Vector2(32.0f, 0.0f), spawned.drawPos);
 }