// コンストラクタ
        public FallingRect(MainWindow m, int oldX)
        {
            mainWindow = m;
            Y = 0;

            // xをランダムに決める
            int newX;
                Random rnd = new Random();
            do {
                newX = oldX + rnd.Next(200) - 100;
            } while ( newX < 0 | 440 < newX | Math.Abs(newX - oldX) < 50);
            X = newX;

            // 色を決める
            switch((int)rnd.Next(3)) {
              case 0:
                clr = Colors.Red;
                clrName = "red";
                break;
              case 1:
                clr = Colors.Green;
                clrName = "green";
                break;
              case 2:
              case 3:
                clr = Colors.Blue;
                clrName = "blue";
                break;
            }
        }
예제 #2
0
        public Kinect(MainWindow m)
        {
            mainWindow = m;

            if (KinectSensor.KinectSensors.Count == 0)
            {
                throw new Exception("Kinectを接続してください");
            }

            kinect = KinectSensor.KinectSensors[0];
            coodinateMapper = kinect.CoordinateMapper;
        }