Exemplo n.º 1
0
 void spawn_edge_boundaries(int minX, int maxX)
 {
     for (int x = minX; x < maxX; ++x)
     {
         new Depths().GlobalPosition = new Vector2(x, 100) * block_width;
         var depth = new Depths();
         depth.GlobalPosition = new Vector2(x, 0) * block_width;
         depth.Rotation       = Mathf.Pi;
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Assumes that the Kinect is in front of the DDR pad, on the right (pointing to the DDR pad diagonally)
        /// </summary>
        /// <param name="averageDepths">Average depths for the various points</param>
        /// <param name="lastDepths">The last depths measured for the various points</param>
        /// <returns></returns>
        public static Arrows GetArrowsPressed(Depths averageDepths, Depths lastDepths)
        {
            bool upTriggered     = averageDepths.UpDepth - lastDepths.UpDepth > DepthThreshold;
            bool rightTriggered  = averageDepths.RightDepth - lastDepths.RightDepth > DepthThreshold;
            bool downTriggered   = averageDepths.DownDepth - lastDepths.DownDepth > DepthThreshold;
            bool leftTriggered   = averageDepths.LeftDepth - lastDepths.LeftDepth > DepthThreshold;
            bool centerTriggered = averageDepths.CenterDepth - lastDepths.CenterDepth > DepthThreshold;

            Arrows arrows = Arrows.None;

            if (upTriggered)
            {
                // Up arrow is pressed
                arrows = arrows | Arrows.Up;
            }
            if (rightTriggered)
            {
                // Right arrow is pressed
                arrows = arrows | Arrows.Right;
            }

            if (arrows.HasFlag(Arrows.Up) && arrows.HasFlag(Arrows.Right))
            {
                // No other possibility, assuming some things (no hand presses, kinect in front right)
                return(arrows);
            }

            if (downTriggered)
            {
                arrows = arrows | Arrows.Down;
            }

            if ((arrows.HasFlag(Arrows.Up) && arrows.HasFlag(Arrows.Down)) || (arrows.HasFlag(Arrows.Down) && arrows.HasFlag(Arrows.Left)))
            {
                // No other possibility, asuming some things (no hand presses, kinect in front right)
                return(arrows);
            }

            if (leftTriggered)
            {
                arrows = arrows | Arrows.Left;
            }
            // Assume
            if (upTriggered && !downTriggered && !centerTriggered && !rightTriggered)
            {
                arrows = arrows | Arrows.Left;
            }
            return(arrows);
        }
        public Depths GetDepths()
        {
            var depth = new Depths();
            var asks  = items.Where(e => e.Type == TranType.Ask).OrderBy(e => e.Price).ToList();
            var bids  = items.Where(e => e.Type == TranType.Bid).OrderBy(e => e.Price).ToList();

            foreach (var item in asks)
            {
                depth.Asks.Add(new List <decimal> {
                    item.Price, item.Size, asks.IndexOf(item) + 1
                });
            }

            foreach (var item in bids)
            {
                depth.Bids.Add(new List <decimal> {
                    item.Price, item.Size, bids.IndexOf(item) + 1,
                });
            }

            return(depth);
        }