Ejemplo n.º 1
0
        public static void FindMatchs(GameElement gameElement)
        {
            FindHorizontalMatch(gameElement);
            FindVericalMatch(gameElement);

            MarkExpirder();
        }
Ejemplo n.º 2
0
        private static void AddGameElement(int rowNumb, int colNumb)
        {
            GameElement gameElement = new GameElement(rowNumb, colNumb);

            gameElement.Position      = GetPosition(colNumb, rowNumb, gameElement.Size);
            gameElement.TargetPostion = gameElement.Position;
            Entities.Add(gameElement as GameElement);
        }
Ejemplo n.º 3
0
 public static void CreateBonus(GameElement gameElement, BonusType type)
 {
     if (type == BonusType.Bomb)
     {
         Bomb bomb = new Bomb(gameElement);
         Entities.Add(bomb as Bomb);
     }
     else if (type == BonusType.Line)
     {
     }
 }
Ejemplo n.º 4
0
        public static List <Entity> GetMatchs(this List <Entity> entities, GameElement element)
        {
            List <Entity> result = new List <Entity>();

            foreach (Entity entity in entities)
            {
                if (entity is GameElement)
                {
                    GameElement gameElement = entity as GameElement;

                    if (gameElement.ElementType == element.ElementType)
                    {
                        result.Add(gameElement as GameElement);
                    }

                    else if (gameElement.ElementType != element.ElementType && !result.IsEmpty())
                    {
                        if (result.Contains(element as GameElement))
                        {
                            break;
                        }
                        else
                        {
                            result.Clear();
                        }
                    }
                }
                else if (entity is Bonus)
                {
                    result.Clear();
                }
            }

            if (result.Count < 3)
            {
                return new List <Entity> {
                           element
                }
            }
            ;
            else
            {
                return(result);
            }
        }
Ejemplo n.º 5
0
        private static void FindVericalMatch(GameElement gameElement)
        {
            List <Entity> result = new List <Entity>();

            foreach (Entity element in sequence)
            {
                List <Entity> elements = EntityManager.Entities.Where(x => x.ColNumb == gameElement.ColNumb).OrderBy(x => x.RowNumb).ToList();

                elements = elements.GetMatchs(gameElement as GameElement);

                if (elements.Count > 1)
                {
                    result.AddList(elements);
                    break;
                }
            }
            if (result.Count > 1)
            {
                sequence.AddList(result);
            }
        }
Ejemplo n.º 6
0
        public Bomb(GameElement element)
        {
            Position      = element.Position;
            TargetPostion = element.TargetPostion;

            RowNumb = element.RowNumb;
            ColNumb = element.ColNumb;

            LastColumn = ColNumb;
            LastRow    = LastRow;

            color = element.color;

            IsNeedToUse   = false;
            IsExpired     = false;
            IsLowering    = false;
            IsTurningBack = false;

            animation = Animation.None;

            Sprite = Art.Bomb;
        }
Ejemplo n.º 7
0
 private static void FindHorizontalMatch(GameElement gameElement)
 {
     sequence = EntityManager.Entities.Where(x => x.RowNumb == gameElement.RowNumb).OrderBy(x => x.ColNumb).ToList();
     sequence = sequence.GetMatchs(gameElement);
 }