当前位置: 首页>>代码示例>>C#>>正文


C# HUD.addCoinLuigi方法代码示例

本文整理汇总了C#中HUD.addCoinLuigi方法的典型用法代码示例。如果您正苦于以下问题:C# HUD.addCoinLuigi方法的具体用法?C# HUD.addCoinLuigi怎么用?C# HUD.addCoinLuigi使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HUD的用法示例。


在下文中一共展示了HUD.addCoinLuigi方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ItemCollisionTest

        public void ItemCollisionTest(SoundEffects sound, HUD hud, IList<IItem> items)
        {
            Rectangle luigiRectangle = myLuigi.GetRectangle();
            Rectangle itemRectangle;
            Rectangle intersectionRectangle;
            Queue<IItem> doomedItems = new Queue<IItem>();
            foreach (IItem item in items)
            {
                itemRectangle = item.GetRectangle();
                intersectionRectangle = Rectangle.Intersect(luigiRectangle, itemRectangle);
                if (!intersectionRectangle.IsEmpty)
                {
                    // todo
                    switch (item.GetItemName())
                    {
                        case "Coin":
                            //myLuigi.Coin();
                            hud.addCoinLuigi();
                            hud.increaseScoreLuigi(Constants.coinValue);
                            hud.achievements.CoinGet();
                            break;
                        case "Mushroom":
                            sound.Powerup();
                            myLuigi.Mushroom();
                            hud.increaseScoreLuigi(Constants.mushroomValue);
                            hud.achievements.MushroomGet();
                            break;
                        case "Fireflower":
                            sound.Powerup();
                            myLuigi.Fireflower();
                            hud.increaseScoreLuigi(Constants.fireflowerValue);
                            hud.achievements.FlowerGet();
                            break;
                        case "Oneup":
                            sound.OneUp();
                            hud.extraLifeLuigi();
                            hud.increaseScoreLuigi(Constants.oneUpValue);
                            break;
                        case "Star":
                            sound.Powerup();
                            myLuigi.Star();
                            hud.increaseScoreLuigi(Constants.starValue);
                            hud.achievements.StarGet();
                            break;
                        default:
                            // nothing
                            break;
                    }
                    doomedItems.Enqueue(item);

                }
            }
            while (doomedItems.Count() > 0)
            {
                IItem item = doomedItems.Dequeue();
                items.Remove(item);

            }
        }
开发者ID:FrankHYB,项目名称:MarioGame,代码行数:59,代码来源:LuigiItemCollision.cs

示例2: Hit

        //this is coupled with a few things it doesn't need to be.
        public void Hit(IList<IItem> items, bool isMario, bool isBig, HUD hud, SoundEffects sound)
        {
            switch (state)
            {
                case BrickState.bstar:
                    sound.Popup();
                    IItem star = new Items.Star(xPosition, yPosition - 16, camera);
                    items.Add(star);
                    state = BrickState.qempty;
                    BrickSprite = new Sprites.HitQBlockSprite();
                    break;

                case BrickState.bcoin:
                    sound.Coin();
                    IItem c;
                    //make the coin noise
                    c = new Items.Coin(xPosition, yPosition - Constants.tileLength, camera);
                    items.Add(c);
                    if (isMario)
                    {
                        hud.increaseScoreMario(Constants.brokenBrickValue);
                        hud.addCoinMario();
                    }
                    else
                    {
                        hud.increaseScoreLuigi(Constants.brokenBrickValue);
                        hud.addCoinLuigi();
                    }
                    state = BrickState.qempty;
                    BrickSprite = new Sprites.HitQBlockSprite();
                    break;

                case BrickState.bempty:
                    if (isBig)
                    {
                        sound.BreakBlock();
                        if (isMario)
                        {
                            hud.increaseScoreMario(Constants.brokenBrickValue);
                        }
                        else
                        {
                            hud.increaseScoreLuigi(Constants.brokenBrickValue);
                        }
                        state = BrickState.destroyed;
                        BrickSprite = null;
                    }
                    break;

                case BrickState.qitem:
                    IItem i;
                    sound.Popup();
                    if (!isBig) {
                        i = new Items.Mushroom(xPosition, yPosition - Constants.tileLength, camera);
                    }

                    else {
                        i = new Items.Fireflower(xPosition, yPosition - Constants.tileLength, camera);
                    }
                    items.Add(i);
                    state = BrickState.qempty;
                    BrickSprite = new Sprites.HitQBlockSprite();
                    break;

                case BrickState.qlife:
                    items.Add(new Items.Oneup(xPosition, yPosition - Constants.tileLength, camera));
                    state = BrickState.qempty;
                    BrickSprite = new Sprites.HitQBlockSprite();
                    break;

                case BrickState.qcoin:
                    sound.Coin();
                    //make the coin noise
                    c = new Items.Coin(xPosition, yPosition - Constants.tileLength, camera);
                    items.Add(c);
                    if (isMario)
                    {
                        hud.increaseScoreMario(Constants.brokenBrickValue);
                        hud.addCoinMario();
                    }
                    else
                    {
                        hud.increaseScoreLuigi(Constants.brokenBrickValue);
                        hud.addCoinLuigi();
                    }
                    state = BrickState.qempty;
                    BrickSprite = new Sprites.HitQBlockSprite();
                    break;
                default:
                    break;
            }
        }
开发者ID:FrankHYB,项目名称:MarioGame,代码行数:93,代码来源:Brick.cs


注:本文中的HUD.addCoinLuigi方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。