Esempio n. 1
0
 public BlokTrukkos(int row, int col, Blok kezdo, Blok veg, int tipus) : base(row, col, kezdo.Kep, kezdo.Szilard, tipus)
 {
     trukkos     = tipus;
     this.Vegkep = veg.Kep;
     kep         = kezdo.Kep;
     this.kezdo  = kezdo;
     this.veg    = veg;
 }
Esempio n. 2
0
        private void gravity()
        {
            Szamol();
            lebeg = false;

            Blok LeftBlok  = level.BlokList[ButtomGrid][LeftGrid];
            Blok RightBlok = level.BlokList[ButtomGrid][RightGrid];

            if (meghaltal)
            {
                Objektum.Margin = new Thickness(ObjectLeft, ObjectTop + 2, 0, 0);
            }

            #region It's a trap
            //Jobbra érintve tüskés
            if ((RightBlok.Trukkos != 0) && RightBlok.Trukkos != 2 && !RightBlok.Aktivalt)
            {
                RightBlok.Aktivalt = true;
                trukkos(ButtomGrid, RightGrid);
                if (RightBlok.Trukkos == 8)
                {
                    Character.SavePosition(ObjectLeft, ObjectTop, grid.Margin.Left);
                }
                if (RightBlok.Trukkos == 9)
                {
                    NextLevel();
                }
                if (RightBlok.Trukkos == 3 || RightBlok.Trukkos == 1)
                {
                    Meghaltal();
                }
            }
            //Balra érintve tüskés
            if ((LeftBlok.Trukkos != 0) && LeftBlok.Trukkos != 2 && !LeftBlok.Aktivalt)
            {
                LeftBlok.Aktivalt = true;
                trukkos(ButtomGrid, LeftGrid);
                if (LeftBlok.Trukkos == 8)
                {
                    Character.SavePosition(ObjectLeft, ObjectTop, grid.Margin.Left);
                }
                if (LeftBlok.Trukkos == 9)
                {
                    NextLevel();
                }
                if (LeftBlok.Trukkos == 3 || LeftBlok.Trukkos == 1)
                {
                    Meghaltal();
                }
            }
            //Rajt áll
            if (RightGrid == LeftGrid && RightBlok.Trukkos != 0 && !RightBlok.Aktivalt)
            {
                RightBlok.Aktivalt = true;
                trukkos(ButtomGrid, RightGrid);
                trukkos(ButtomGrid, RightGrid);
                if (RightBlok.Trukkos == 8)
                {
                    Character.SavePosition(ObjectLeft, ObjectTop, grid.Margin.Left);
                }
                if (RightBlok.Trukkos == 9)
                {
                    NextLevel();
                }
                if (RightBlok.Trukkos == 3 || RightBlok.Trukkos == 1)
                {
                    Meghaltal();
                }
                return;
            }
            //Két eltűnőn áll
            if (LeftBlok.Trukkos != 0 && RightBlok.Trukkos != 0 && (!RightBlok.Aktivalt || !LeftBlok.Aktivalt))
            {
                RightBlok.Aktivalt = true;
                LeftBlok.Aktivalt  = true;
                trukkos(ButtomGrid, RightGrid);
                trukkos(ButtomGrid, LeftGrid);
                if (RightBlok.Trukkos == 8 && LeftBlok.Trukkos == 8)
                {
                    Character.SavePosition(ObjectLeft, ObjectTop, grid.Margin.Left);
                }
                if (RightBlok.Trukkos == 9 && LeftBlok.Trukkos == 9)
                {
                    NextLevel();
                }
                if ((RightBlok.Trukkos == 3 || RightBlok.Trukkos == 1) && (LeftBlok.Trukkos == 3 || LeftBlok.Trukkos == 1))
                {
                    Meghaltal();
                }
                return;
            }
            #endregion

            if (!LeftBlok.Szilard && !RightBlok.Szilard)
            {
                lebeg           = true;
                Objektum.Margin = new Thickness(ObjectLeft, ObjectTop + 2, 0, 0);
                return;
            }
        }