Exemple #1
0
        //Первоначальная генерация карты
        public Map()
        {
            int i = 0;
            int aRandom = 48;
            panels.Add(new PanelInMap(100, aRandom, 0, false));
            while (i < 30)
            {
                uint panelID = 0;
                if (rand.Next(0, 5) == 1)
                {
                    panelID = 2;
                }
                int buf = rand.Next(aRandom + 20, (aRandom + 45));
                objRandom = new PanelInMap(rand.Next(40, 400), buf, panelID, false);
                panels.Add(objRandom);
                i++;
                aRandom = buf;

            }
            i = 0;
            while (i < 45)
            {
                monsters.Add(new MonsterInMap(rand.Next(40, 400), rand.Next(i * 100 + 100, 50000), (uint)rand.Next(1, 5), false));
                i++;
            }

            panels.Add(new PanelInMap(38, 48, 0, false));
            // bonus.Add(new BonusInMap(60, 380, 3, false));
            // monsters.Add(new MonsterInMap(100, 340, 4, false));
        }
Exemple #2
0
        //Первоначальная генерация карты
        public Map()
        {
            int i       = 0;
            int aRandom = 48;

            panels.Add(new PanelInMap(100, aRandom, 0, false));
            while (i < 30)
            {
                uint panelID = 0;
                if (rand.Next(0, 5) == 1)
                {
                    panelID = 2;
                }
                int buf = rand.Next(aRandom + 20, (aRandom + 45));
                objRandom = new PanelInMap(rand.Next(40, 400), buf, panelID, false);
                panels.Add(objRandom);
                i++;
                aRandom = buf;
            }
            i = 0;
            while (i < 45)
            {
                monsters.Add(new MonsterInMap(rand.Next(40, 400), rand.Next(i * 100 + 100, 50000), (uint)rand.Next(1, 5), false));
                i++;
            }


            panels.Add(new PanelInMap(38, 48, 0, false));
            // bonus.Add(new BonusInMap(60, 380, 3, false));
            // monsters.Add(new MonsterInMap(100, 340, 4, false));
        }
Exemple #3
0
        public static void GenerationPanel(PanelInMap kPanelInMap, float moveMap, Random rand, ref PanelInMap objRandom, List<BonusInMap> bonus)
        {
            if ((kPanelInMap != null) && (rand != null) && (objRandom != null) && (bonus != null))
            {
                //Easy
                if ((kPanelInMap.CoordY - moveMap < -10.0f) && (moveMap < 3000.0f))
                {

                    //Generation Static panel
                    kPanelInMap.CoordY = rand.Next(30 + (int)objRandom.CoordY, 95 + (int)objRandom.CoordY);
                    kPanelInMap.CoordX = rand.Next(20, 430);
                    kPanelInMap.Type = 0;
                    kPanelInMap.LeftFlag = false;

                    //Generation Bad panel
                    if (rand.Next(0, 5) == 2)
                    {
                        kPanelInMap.Type = 2;
                    }
                    else
                    {
                        objRandom = kPanelInMap;
                    }

                    //generation bonus
                    BonusInMap bufBonusInMap = null;
                    uint bufTypeBonus = (uint)rand.Next(0, 10);
                    if ((kPanelInMap.Type == 0) && (bufTypeBonus == 0))
                    {
                        bufBonusInMap = new BonusInMap(kPanelInMap.CoordX + 16, kPanelInMap.CoordY + 14, bufTypeBonus, kPanelInMap.LeftFlag);
                        bonus.Add(bufBonusInMap);
                    }

                    if ((kPanelInMap.Type == 0) && (bufTypeBonus == 2))
                    {
                        bufBonusInMap = new BonusInMap(kPanelInMap.CoordX + 8, kPanelInMap.CoordY + 14, bufTypeBonus, kPanelInMap.LeftFlag);
                        bonus.Add(bufBonusInMap);
                    }
                }

                //NORMAL
                if ((kPanelInMap.CoordY - moveMap < -10.0f) && (moveMap > 3000.0f) && (moveMap <= 10000.0f))
                {

                    //Generation Static panel
                    kPanelInMap.CoordY = rand.Next(30 + (int)objRandom.CoordY, 95 + (int)objRandom.CoordY);
                    kPanelInMap.CoordX = rand.Next(20, 430);
                    kPanelInMap.Type = (uint)rand.Next(0, 2);
                    kPanelInMap.LeftFlag = false;

                    //Generation Bad panel
                    if (rand.Next(0, 10) == 2)
                    {
                        kPanelInMap.Type = 2;
                    }
                    else
                    {
                        objRandom = kPanelInMap;
                    }

                    BonusInMap bufBonusInMap = null;

                    uint bufTypeBonus = (uint)rand.Next(0, 20);

                    if ((kPanelInMap.Type == 0) && (bufTypeBonus == 0))
                    {
                        bufBonusInMap = new BonusInMap(kPanelInMap.CoordX + 16, kPanelInMap.CoordY + 14, bufTypeBonus, kPanelInMap.LeftFlag);
                        bonus.Add(bufBonusInMap);
                    }
                    if ((kPanelInMap.Type == 1) && (bufTypeBonus == 1))
                    {
                        bufBonusInMap = new BonusInMap(kPanelInMap.CoordX + 16, kPanelInMap.CoordY + 14, bufTypeBonus, kPanelInMap.LeftFlag);
                        bonus.Add(bufBonusInMap);
                    }
                    if ((kPanelInMap.Type == 0) && (bufTypeBonus == 2))
                    {
                        bufBonusInMap = new BonusInMap(kPanelInMap.CoordX + 8, kPanelInMap.CoordY + 14, bufTypeBonus, kPanelInMap.LeftFlag);
                        bonus.Add(bufBonusInMap);
                    }
                    if ((kPanelInMap.Type == 1) && (bufTypeBonus == 3))
                    {
                        bufBonusInMap = new BonusInMap(kPanelInMap.CoordX + 2, kPanelInMap.CoordY + 14, bufTypeBonus, kPanelInMap.LeftFlag);
                        bonus.Add(bufBonusInMap);
                    }
                    if ((kPanelInMap.Type == 1) && (bufTypeBonus == 4))
                    {
                        bufBonusInMap = new BonusInMap(kPanelInMap.CoordX + 12, kPanelInMap.CoordY + 14, bufTypeBonus, kPanelInMap.LeftFlag);
                        bonus.Add(bufBonusInMap);
                    }

                }
                //HARDCORE
                if ((kPanelInMap.CoordY - moveMap < -10.0f) && (moveMap > 10000.0f))
                {

                    //Generation Static panel
                    kPanelInMap.CoordY = rand.Next(30 + (int)objRandom.CoordY, 95 + (int)objRandom.CoordY);
                    kPanelInMap.CoordX = rand.Next(20, 430);
                    kPanelInMap.Type = 1;
                    kPanelInMap.LeftFlag = false;

                    //Generation Bad panel
                    objRandom = kPanelInMap;
                    if (rand.Next(0, 3) == 2)
                    {
                        kPanelInMap.Type = 5;
                        objRandom = kPanelInMap;
                    }

                    //раскидываем бонусы

                    BonusInMap bufBonusInMap = null;

                    uint bufTypeBonus = (uint)rand.Next(0, 30);

                    if ((kPanelInMap.Type == 0) && (bufTypeBonus == 0))
                    {
                        bufBonusInMap = new BonusInMap(kPanelInMap.CoordX + 16, kPanelInMap.CoordY + 14, bufTypeBonus, kPanelInMap.LeftFlag);
                        bonus.Add(bufBonusInMap);
                    }
                    if ((kPanelInMap.Type == 1) && (bufTypeBonus == 1))
                    {
                        bufBonusInMap = new BonusInMap(kPanelInMap.CoordX + 16, kPanelInMap.CoordY + 14, bufTypeBonus, kPanelInMap.LeftFlag);
                        bonus.Add(bufBonusInMap);
                    }
                    if ((kPanelInMap.Type == 0) && (bufTypeBonus == 2))
                    {
                        bufBonusInMap = new BonusInMap(kPanelInMap.CoordX + 8, kPanelInMap.CoordY + 14, bufTypeBonus, kPanelInMap.LeftFlag);
                        bonus.Add(bufBonusInMap);
                    }
                    if ((kPanelInMap.Type == 1) && (bufTypeBonus == 3))
                    {
                        bufBonusInMap = new BonusInMap(kPanelInMap.CoordX + 2, kPanelInMap.CoordY + 14, bufTypeBonus, kPanelInMap.LeftFlag);
                        bonus.Add(bufBonusInMap);
                    }
                    if ((kPanelInMap.Type == 1) && (bufTypeBonus == 4))
                    {
                        bufBonusInMap = new BonusInMap(kPanelInMap.CoordX + 12, kPanelInMap.CoordY + 14, bufTypeBonus, kPanelInMap.LeftFlag);
                        bonus.Add(bufBonusInMap);
                    }

                }
            }
        }
Exemple #4
0
        public static void GenerationPanel(PanelInMap kPanelInMap, float moveMap, Random rand, ref PanelInMap objRandom, List <BonusInMap> bonus)
        {
            if ((kPanelInMap != null) && (rand != null) && (objRandom != null) && (bonus != null))
            {
                //Easy
                if ((kPanelInMap.CoordY - moveMap < -10.0f) && (moveMap < 3000.0f))
                {
                    //Generation Static panel
                    kPanelInMap.CoordY   = rand.Next(30 + (int)objRandom.CoordY, 95 + (int)objRandom.CoordY);
                    kPanelInMap.CoordX   = rand.Next(20, 430);
                    kPanelInMap.Type     = 0;
                    kPanelInMap.LeftFlag = false;

                    //Generation Bad panel
                    if (rand.Next(0, 5) == 2)
                    {
                        kPanelInMap.Type = 2;
                    }
                    else
                    {
                        objRandom = kPanelInMap;
                    }

                    //generation bonus
                    BonusInMap bufBonusInMap = null;
                    uint       bufTypeBonus  = (uint)rand.Next(0, 10);
                    if ((kPanelInMap.Type == 0) && (bufTypeBonus == 0))
                    {
                        bufBonusInMap = new BonusInMap(kPanelInMap.CoordX + 16, kPanelInMap.CoordY + 14, bufTypeBonus, kPanelInMap.LeftFlag);
                        bonus.Add(bufBonusInMap);
                    }

                    if ((kPanelInMap.Type == 0) && (bufTypeBonus == 2))
                    {
                        bufBonusInMap = new BonusInMap(kPanelInMap.CoordX + 8, kPanelInMap.CoordY + 14, bufTypeBonus, kPanelInMap.LeftFlag);
                        bonus.Add(bufBonusInMap);
                    }
                }

                //NORMAL
                if ((kPanelInMap.CoordY - moveMap < -10.0f) && (moveMap > 3000.0f) && (moveMap <= 10000.0f))
                {
                    //Generation Static panel
                    kPanelInMap.CoordY   = rand.Next(30 + (int)objRandom.CoordY, 95 + (int)objRandom.CoordY);
                    kPanelInMap.CoordX   = rand.Next(20, 430);
                    kPanelInMap.Type     = (uint)rand.Next(0, 2);
                    kPanelInMap.LeftFlag = false;

                    //Generation Bad panel
                    if (rand.Next(0, 10) == 2)
                    {
                        kPanelInMap.Type = 2;
                    }
                    else
                    {
                        objRandom = kPanelInMap;
                    }

                    BonusInMap bufBonusInMap = null;


                    uint bufTypeBonus = (uint)rand.Next(0, 20);

                    if ((kPanelInMap.Type == 0) && (bufTypeBonus == 0))
                    {
                        bufBonusInMap = new BonusInMap(kPanelInMap.CoordX + 16, kPanelInMap.CoordY + 14, bufTypeBonus, kPanelInMap.LeftFlag);
                        bonus.Add(bufBonusInMap);
                    }
                    if ((kPanelInMap.Type == 1) && (bufTypeBonus == 1))
                    {
                        bufBonusInMap = new BonusInMap(kPanelInMap.CoordX + 16, kPanelInMap.CoordY + 14, bufTypeBonus, kPanelInMap.LeftFlag);
                        bonus.Add(bufBonusInMap);
                    }
                    if ((kPanelInMap.Type == 0) && (bufTypeBonus == 2))
                    {
                        bufBonusInMap = new BonusInMap(kPanelInMap.CoordX + 8, kPanelInMap.CoordY + 14, bufTypeBonus, kPanelInMap.LeftFlag);
                        bonus.Add(bufBonusInMap);
                    }
                    if ((kPanelInMap.Type == 1) && (bufTypeBonus == 3))
                    {
                        bufBonusInMap = new BonusInMap(kPanelInMap.CoordX + 2, kPanelInMap.CoordY + 14, bufTypeBonus, kPanelInMap.LeftFlag);
                        bonus.Add(bufBonusInMap);
                    }
                    if ((kPanelInMap.Type == 1) && (bufTypeBonus == 4))
                    {
                        bufBonusInMap = new BonusInMap(kPanelInMap.CoordX + 12, kPanelInMap.CoordY + 14, bufTypeBonus, kPanelInMap.LeftFlag);
                        bonus.Add(bufBonusInMap);
                    }
                }
                //HARDCORE
                if ((kPanelInMap.CoordY - moveMap < -10.0f) && (moveMap > 10000.0f))
                {
                    //Generation Static panel
                    kPanelInMap.CoordY   = rand.Next(30 + (int)objRandom.CoordY, 95 + (int)objRandom.CoordY);
                    kPanelInMap.CoordX   = rand.Next(20, 430);
                    kPanelInMap.Type     = 1;
                    kPanelInMap.LeftFlag = false;

                    //Generation Bad panel
                    objRandom = kPanelInMap;
                    if (rand.Next(0, 3) == 2)
                    {
                        kPanelInMap.Type = 5;
                        objRandom        = kPanelInMap;
                    }

                    //раскидываем бонусы

                    BonusInMap bufBonusInMap = null;


                    uint bufTypeBonus = (uint)rand.Next(0, 30);

                    if ((kPanelInMap.Type == 0) && (bufTypeBonus == 0))
                    {
                        bufBonusInMap = new BonusInMap(kPanelInMap.CoordX + 16, kPanelInMap.CoordY + 14, bufTypeBonus, kPanelInMap.LeftFlag);
                        bonus.Add(bufBonusInMap);
                    }
                    if ((kPanelInMap.Type == 1) && (bufTypeBonus == 1))
                    {
                        bufBonusInMap = new BonusInMap(kPanelInMap.CoordX + 16, kPanelInMap.CoordY + 14, bufTypeBonus, kPanelInMap.LeftFlag);
                        bonus.Add(bufBonusInMap);
                    }
                    if ((kPanelInMap.Type == 0) && (bufTypeBonus == 2))
                    {
                        bufBonusInMap = new BonusInMap(kPanelInMap.CoordX + 8, kPanelInMap.CoordY + 14, bufTypeBonus, kPanelInMap.LeftFlag);
                        bonus.Add(bufBonusInMap);
                    }
                    if ((kPanelInMap.Type == 1) && (bufTypeBonus == 3))
                    {
                        bufBonusInMap = new BonusInMap(kPanelInMap.CoordX + 2, kPanelInMap.CoordY + 14, bufTypeBonus, kPanelInMap.LeftFlag);
                        bonus.Add(bufBonusInMap);
                    }
                    if ((kPanelInMap.Type == 1) && (bufTypeBonus == 4))
                    {
                        bufBonusInMap = new BonusInMap(kPanelInMap.CoordX + 12, kPanelInMap.CoordY + 14, bufTypeBonus, kPanelInMap.LeftFlag);
                        bonus.Add(bufBonusInMap);
                    }
                }
            }
        }