Exemplo n.º 1
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        public Score(Sound sound)
        {
            this.sound = sound;
            this.highScoreList = new List<int>();
            this.score = 0;

            // スコアを読み込み
            this.highScoreDataFilePath = Path.GetFullPath("HighScore") + "\\" + Score.highScoreDataFileName;

            if (!File.Exists(this.highScoreDataFilePath))
            {
                this.highScoreList.AddRange(new int[] { 0, 0, 0 });
            }
            else
            {
                using (StreamReader streamReader = new StreamReader(this.highScoreDataFilePath))
                {
                    string readLine = string.Empty;
                    int score = 0;

                    while ((readLine = streamReader.ReadLine()) != null)
                    {
                        score = int.Parse(readLine);
                        this.highScoreList.Add(score);
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        public MainWindow()
        {
            this.InitializeComponent();
            this.SetEventHandler();

            this.kinectSensorChooser = null;

            this.pixelBuffer = null;
            this.skeletonBuffer = null;
            this.mainImageBuffer = null;

            this.speechRecognitionEngine = null;

            this.gameState = GameState.None;
            this.sound = new Sound();

            this.barArray = new Bar[2];

            for (int i = 0; i < this.barArray.Length; i++)
                this.barArray[i] = new Bar(this, i + 1);

            this.ball = new Ball(this);
            this.stage = new Stage();
            this.score = new Score(this.sound);

            this.life = 0;

            this.blockArray = null;
        }
Exemplo n.º 3
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        public Ball(MainWindow mainWindow)
        {
            this.mainWindow = mainWindow;
            this.barArray = mainWindow.barArray;
            this.sound = mainWindow.sound;

            this.ballBitmapImage = new BitmapImage();
            this.ballBitmapImage.BeginInit();
            this.ballBitmapImage.UriSource = new Uri("Resources/Image/Ball.bmp", UriKind.Relative);
            this.ballBitmapImage.EndInit();

            this.ballBitmapImageBuffer = new byte[this.ballBitmapImage.PixelWidth * this.ballBitmapImage.PixelHeight * 4];
            this.ballBitmapImage.CopyPixels(this.ballBitmapImageBuffer, this.ballBitmapImage.PixelWidth * 4, 0);

            this.width = this.ballBitmapImage.PixelWidth;
            this.height = this.ballBitmapImage.PixelHeight;

            this.x = this.barArray[0].x + Bar.width / 2 - this.width / 2;
            this.y = this.barArray[0].y - this.height - 5;

            this.random = new Random();

            this.dx = this.random.Next(-4, 4);  // 横方向の移動速度は-4以上4未満
            this.dy = this.random.Next(-5, -3); // 縦方向の移動速度は-5以上-3未満

            if (this.dx == 0)
                this.dx = 3;
        }