コード例 #1
0
        private IPowerUp[] GetContents(List <List <Object> > matrix, int x, int y)
        {
            switch (this.contains)
            {
            case "multicoin":
            {
                IPowerUp[] pups = new IPowerUp[HotDAMN.MULTICOIN_BLOCK_MAXIMUM];
                for (int i = 0; i < pups.Length; i++)
                {
                    pups[i]       = new Coin(16 * x, 16 * y);
                    pups[i].State = new SCoinInBlock(pups[i]);
                    matrix[x].Add(pups[i]);
                }
                return(pups);
            }

            case "coin":
            {
                IPowerUp p = new Coin(16 * x, 16 * y);
                p.State = new SCoinInBlock(p);
                matrix[x].Add(p);
                return(new IPowerUp[] { p });
            }

            case "powerup":
            {
                IPowerUp p1 = new Mushroom(16 * x, 16 * y);
                p1.State = new SMushroomInBlock(p1);
                IPowerUp p2 = new FireFlower(16 * x, 16 * y);
                p2.State = new SFireFlowerInBlock(p2);
                matrix[x].Add(p1);
                matrix[x].Add(p2);
                return(new IPowerUp[] { p1, p2 });
            }

            case "star":
            {
                IPowerUp p = new Star(16 * x, 16 * y);
                p.State = new SStarInBlock(p);
                matrix[x].Add(p);
                return(new IPowerUp[] { p });
            }

            case "1up":
            {
                IPowerUp p = new _1Up(16 * x, 16 * y);
                p.State = new S1UpInBlock(p);
                matrix[x].Add(p);
                return(new IPowerUp[] { p });
            }

            default:
            {
                return(new IPowerUp[] {});
            }
            }
        }
コード例 #2
0
        private IPowerUp[] GetContents(List <List <Object> > matrix, int x, int y)
        {
            switch (this.contains)
            {
            case "multicoin":
            case "coin":
            {
                IPowerUp p = new Coin(16 * x, 16 * y);
                p.State = new SCoinInBlock(p);
                matrix[x].Add(p);
                return(new IPowerUp[] { p });
            }

            case "powerup":
            {
                IPowerUp p1 = new Mushroom(16 * x, 16 * y);
                p1.State = new SMushroomInBlock(p1);
                IPowerUp p2 = new FireFlower(16 * x, 16 * y);
                p2.State = new SFireFlowerInBlock(p2);
                matrix[x].Add(p1);
                matrix[x].Add(p2);
                return(new IPowerUp[] { p1, p2 });
            }

            case "star":
            {
                IPowerUp p = new Star(16 * x, 16 * y);
                p.State = new SStarInBlock(p);
                matrix[x].Add(p);
                return(new IPowerUp[] { p });
            }

            case "1up":
            {
                IPowerUp p = new _1Up(16 * x, 16 * y);
                p.State = new S1UpInBlock(p);
                matrix[x].Add(p);
                return(new IPowerUp[] { p });
            }

            default:
            {
                return(new IPowerUp[] { });
            }
            }
        }