Example #1
0
        private bool TryGetLeanPoints(List <Vector> pointsDir, out List <Vector> pointsToAdd)
        {
            var addPoints = new Dictionary <Vector, CellType>();

            foreach (var dir in pointsDir)
            {
                var loc  = Location + dir;
                var cell = loc.Get(_data);
                if (cell.TypeOfCell == CellType.Cookie || cell.TypeOfCell == CellType.Grass)
                {
                    addPoints.Add(loc, cell.TypeOfCell);
                    cell.TypeOfCell = CellType.None;
                }
            }
            MyCell target;

            ThisEntity.Moving(Vector.Down, out target, MoveType.Falling);
            ThisEntity.Moving(Vector.Down, out target, MoveType.Rolling);
            var canFall = !ThisEntity.Loc.Equals(ThisEntity.NextLoc);

            foreach (var point in addPoints.Keys)
            {
                var changedCell = point.Get(_data);
                changedCell.TypeOfCell         = addPoints[point];
                changedCell.ToBeFilled         = false;
                changedCell.MovingAnimationDir = "";
            }
            ThisEntity.NextLoc = ThisEntity.Loc;
            pointsToAdd        = addPoints.Keys.ToList();
            return(canFall);
        }
Example #2
0
        public void CheckMoving()//check and run the animation
        {
            MyCell target;
            //delete cells after explosion
            var que = MovingEntities.Values.ToList();

            foreach (var entity in que)
            //mooving check and running the animation
            {
                var newCell = entity.Loc.Get(Data);
                newCell.MovingAnimationDir = entity.Moving(Vector.Down, out target, MoveType.Falling);
            }
            foreach (var entity in que)
            {
                if (entity.GetType() == typeof(Scissors))
                {
                    continue;
                }
                var newCell = entity.Loc.Get(Data);
                if (newCell.TypeOfCell != CellType.Ball && newCell.TypeOfCell != CellType.Cookie)//СПАСИТЕЛЬНЫЙ КОСТЫЛЬ
                {
                    continue;
                }
                newCell.MovingAnimationDir = entity.Moving(Vector.Down, out target, MoveType.Rolling);
            }
            foreach (var entity in que)
            {
                if (entity.Loc.Get(Data).TypeOfCell == CellType.Scissors)
                {
                    entity.Loc.Get(Data).MovingAnimationDir = ((Scissors)entity).Moving();
                }
            }
            var cell = Murphy.Loc.Get(Data);

            if (cell == null)
            {
                return;                                                                                     //just in case
            }
            cell.MovingAnimationDir = Murphy.Moving(DirectVector, out target, MoveType.Common);             //проверка на движение и запуск анимации Murphy
            if (target != null && target.TypeOfCell != CellType.None && target.TypeOfCell != CellType.Ball) //анимация сжатия сьедаемой ячейки
            {
                target.MovingAnimationDir = "S" + cell.MovingAnimationDir;
            }
        }