示例#1
0
        public static Queue <UserControlWorms> RemoveFromQueue(UserControlWorms item, Queue <UserControlWorms> queue)
        {
            var list = queue.ToList();

            list.Remove(item);
            var finalQueue = new Queue <UserControlWorms>();

            foreach (UserControlWorms i in list)
            {
                finalQueue.Enqueue(i);
            }
            return(finalQueue);
        }
示例#2
0
        private void MoveRight(UserControlWorms worm)
        {
            var canvasposleft = (double)worm.GetValue(Canvas.LeftProperty);
            var canvaspostop  = (double)worm.GetValue(Canvas.TopProperty) + 30.0;

            try
            {
                if (core.map.grid[(int)((canvasposleft + 30) / 30), (int)Math.Ceiling(canvaspostop / 30)] != "1")
                {
                    var velocidad = 1000;
                    worm.CanvasXPos = (double)worm.GetValue(Canvas.LeftProperty) + velocidad * 0.002;
                    Canvas.SetLeft(worm, worm.CanvasXPos);
                }
            }
            catch { }
            System.Threading.Thread.Sleep(1);
            worm.onAir = true;
        }