예제 #1
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (OurGame game = new OurGame())
     {
         game.Run();
     }
 }
예제 #2
0
        public void updata()
        {
            int  i, n, nextPos;
            byte data;

            switch (Active)
            {
            case 0:
                break;

            case 1:         //ÅÝÅݵÄÏÔʾ״̬
                if (_delay == 0)
                {
                    _delay = 5;
                    ++_frame;
                    if (_frame > 20)
                    {
                        Active = 2;
                    }
                    OurGame.map[_mapPos].leiFrame = (Byte)(_frame % 4);
                }
                else
                {
                    --_delay;
                }
                break;

            case 2:     //ת»»µ½±¬Õ¨×´Ì¬

                OurGame._lei = true;

                _frame = 0xFF;
                _delay = 0;
                Active = 3;
                OurGame.map[_mapPos].leiID    = 1;
                OurGame.map[_mapPos].leiFrame = 0;

                if (OurGame.map[_mapPos].mapData != 0)
                {
                    OurGame.createArticle((byte)_mapPos);
                }

                OurGame.map[_mapPos].mapData = 0;

                for (i = 0; i < 4; ++i)
                {
                    n       = 0;
                    nextPos = _mapPos;
                    while (n < _len)
                    {
                        if (MyHelp.isInBound(ref nextPos, i))
                        {
                            ++n;
                            data = OurGame.map[nextPos].mapData;
                            if (data < 0x40)
                            {
                                ++_dir[i];
                                OurGame.map[nextPos].leiID = 3;
                                if (n > 1)
                                {
                                    OurGame.map[nextPos - MyHelp.posLen[i]].leiID = 2;
                                }
                                OurGame.map[nextPos].leiFrame = 0;
                                OurGame.map[nextPos].mapData  = 0;
                                OurGame.map[nextPos].leiDir   = rotation[i];
                                for (int k = 0; k < MyHelp.maxActicle; ++k)
                                {
                                    if (OurGame.acticle[k].active && OurGame.acticle[k].postion == nextPos)
                                    {
                                        OurGame.acticle[k].active = false;
                                    }
                                }

                                if (data != 0)
                                {
                                    OurGame.map[nextPos].mapData = 0;
                                    OurGame.createArticle((byte)nextPos);
                                    break;
                                }
                            }
                            else
                            {
                                break;
                            }
                        }
                        else
                        {
                            break;
                        }
                    }
                }
                break;

            case 3:     //±¬Õ¨×´Ì¬
                if (_delay == 0)
                {
                    ++_frame;
                    _delay = 1;
                    OurGame.map[_mapPos].leiID    = 1;
                    OurGame.map[_mapPos].leiFrame = (byte)(_frame % 4);
                    checkPerson(_mapPos);

                    for (i = 0; i < 4; ++i)
                    {
                        n       = 0;
                        nextPos = _mapPos;
                        while (n < _dir[i])
                        {
                            ++n;
                            nextPos += MyHelp.posLen[i];
                            checkPerson(nextPos);
                            OurGame.map[nextPos].leiID = 3;
                            if (OurGame.map[nextPos].leiID == 3)
                            {
                                OurGame.map[nextPos].leiFrame = (byte)(_frame % 12);
                            }
                            if (n > 1)
                            {
                                OurGame.map[nextPos - MyHelp.posLen[i]].leiID = 2;
                                if (OurGame.map[nextPos - MyHelp.posLen[i]].leiID == 2)
                                {
                                    OurGame.map[nextPos - MyHelp.posLen[i]].leiFrame = (byte)(_frame % 2);
                                }
                            }
                            for (int k = 0; k < MyHelp.maxLei; ++k)
                            {
                                if (OurGame.lei[k].Active == 1 && OurGame.lei[k].Pos == nextPos)
                                {
                                    OurGame.lei[k].Active = 2;
                                }
                            }
                        }
                    }
                    if (_frame >= 12)
                    {
                        Active = 0;
                        --parent.haveLei;
                        OurGame.map[_mapPos].leiActive = false;
                        OurGame.map[_mapPos].canMove  &= 0xDF;    //È¥µôÀ×±êÖ¾
                        for (i = 0; i < 4; ++i)
                        {
                            n       = 0;
                            nextPos = _mapPos;
                            while (n < _dir[i])
                            {
                                nextPos += MyHelp.posLen[i];
                                OurGame.map[nextPos].leiActive = false;
                                ++n;
                            }
                        }
                    }
                }
                else
                {
                    --_delay;
                }

                break;
            }
        }