void BlockLocalizer::Run() { FindUp(); if (uppoints.size() < 5) { return; } #ifdef BL_OUTPUT_DEBUG_INFO FindLeft(); FindRight(); #else thread t1 = thread(std::mem_fn(&BlockLocalizer::FindLeft), this); thread t2 = thread(std::mem_fn(&BlockLocalizer::FindRight), this); t1.join(); t2.join(); #endif if (leftpoints.size() < 5 || rightpoints.size() < 5) { return; } FindDown(); if (downpoints.size() < 5) { return; } NotFoundBlockFlag = false; Judgement(); p_block->Lines2ABCD(); #ifdef BL_OUTPUT_DEBUG_INFO cv::line(drowDebugResult, cv::Point(0, (*p_block).UpLine.k * (0 - (*p_block).UpLine.x0) + (*p_block).UpLine.y0), cv::Point(drowDebugResult.cols, (*p_block).UpLine.k * (drowDebugResult.cols - (*p_block).UpLine.x0) + (*p_block).UpLine.y0), cv::Scalar(0, 0, 255), 1); cv::line(drowDebugResult, cv::Point(0, (*p_block).DownLine.k * (0 - (*p_block).DownLine.x0) + (*p_block).DownLine.y0), cv::Point(drowDebugResult.cols, (*p_block).DownLine.k * (drowDebugResult.cols - (*p_block).DownLine.x0) + (*p_block).DownLine.y0), cv::Scalar(0, 255, 255), 1); cv::line(drowDebugResult, cv::Point((drowDebugResult.rows - (*p_block).LeftLine.y0) / (*p_block).LeftLine.k + (*p_block).LeftLine.x0, drowDebugResult.rows), cv::Point((0 - (*p_block).LeftLine.y0) / (*p_block).LeftLine.k + (*p_block).LeftLine.x0, 0), cv::Scalar(0, 255, 0), 1); cv::line(drowDebugResult, cv::Point((drowDebugResult.rows - (*p_block).RightLine.y0) / (*p_block).RightLine.k + (*p_block).RightLine.x0, drowDebugResult.rows), cv::Point((0 - (*p_block).RightLine.y0) / (*p_block).RightLine.k + (*p_block).RightLine.x0, 0), cv::Scalar(255, 0, 0), 1); if (p_faults->BrokenEdges.size() > 0) { for (int i = 0; i < p_faults->BrokenEdges.size(); i++) { cv::circle(drowDebugResult, p_faults->BrokenEdges[i].position, p_faults->BrokenEdges[i].length / 2, cv::Scalar(0, 0, 255), 10); } } #endif }
void CNpcCommand::updateInput( char playerNo ) { int i,j ; if( m_Refer->getDir() != m_OldDir ){ ReverseDir(); } m_OldDir = m_Refer->getDir(); // ヒストリー作成 // バッファオーバーした長押し時間カウント for( i = 0 ; i <= ENUM_COMMAND_OPT4 ; i++ ){ if( m_CommandData[m_SizeHistory - 1].m_Data[i] & m_StandardList[i] ){ m_PassTime[ i ]++; } else{ m_PassTime[ i ] = 0; } m_HoldTime[m_SizeHistory - 1][i] = m_PassTime[ i ]; } // バッファシフト // 長押し時間カウント for( i = m_SizeHistory - 1 ; i > 0 ; i-- ){ m_History[i] = m_History[ i-1 ]; for( j = 0 ; j <= ENUM_COMMAND_OPT4 ; j++ ){ if( m_CommandData[ i ].m_Data[ j ] & m_StandardList[ j ] ){ m_HoldTime[ i ][ j ]++; } else{ m_HoldTime[ i ][ j ] = 0; } } } // 最新のデータをセット m_History[0] = m_Standard ; m_Special = Judgement( 0 ) * m_CommandData[0].m_TechNo ; m_Special |= Judgement( 1 ) * m_CommandData[1].m_TechNo ; m_Special |= Judgement( 2 ) * m_CommandData[2].m_TechNo ; m_Special |= Judgement( 3 ) * m_CommandData[3].m_TechNo ; m_Special |= Judgement( 4 ) * m_CommandData[4].m_TechNo ; m_Special |= Judgement( 5 ) * m_CommandData[4].m_TechNo ; }
void GameScene::Update() { switch (gameStep) { case enGameStep_DealCards: { //HandsOn-2 BGMの再生を開始するためにCSoundSourceのインスタンスを生成する。 bgmSource = NewGO<CSoundSource>(0); bgmSource->Init("Assets/sound/BGM.wav"); bgmSource->Play(true); //カードを配る。 int numPlayerNo = 0; while (true) { Card* card = cardDeck.GetUnuseCardRandom(); if (card == NULL) { //全部配り終わった。 break; } playerList[numPlayerNo].AddCard(card); numPlayerNo = (numPlayerNo + 1) % NUM_PLAYER; } for (int i = 0; i < NUM_PLAYER; i++) { AddGO(0, &playerList[i]); playerList[i].SetPlayerNo(i); } //カードの引く相手になるプレイヤーを設定。 playerList[0].SetTargetPlayer(&playerList[1]); playerList[1].SetTargetPlayer(&playerList[0]); g_fade->StartFadeIn(); gameStep = enGameStep_WaitFadeIn; }break; case enGameStep_WaitFadeIn: if (!g_fade->IsExecute()) { //まずはプレイヤーの手番。 playerList[0].ChangeState(Player::enStateSelectCard); gameStep = enGameStep_SelectPlayer; } break; case enGameStep_SelectPlayer: if (playerList[0].GetState() == Player::enStateIdle) { playerList[0].UpdateCardPosition(); playerList[1].UpdateCardPosition(); //プレイヤー選択終わり。 if (Judgement()) { //決着がついた。 gameStep = enGameStep_Over; } else { //COMの手番。 playerList[1].ChangeState(Player::enStateSelectCard); gameStep = enGameStep_SelectCom; } } break; case enGameStep_SelectCom: if (playerList[1].GetState() == Player::enStateIdle) { //COM選択終わり。 playerList[0].UpdateCardPosition(); playerList[1].UpdateCardPosition(); if (Judgement()) { //決着がついた。 gameStep = enGameStep_Over; } else { //プレイヤーの手番。 playerList[0].ChangeState(Player::enStateSelectCard); gameStep = enGameStep_SelectPlayer; } } break; case enGameStep_Over: MessageBox(NULL, "結果", "おわり", MB_OK); g_fade->StartFadeOut(); gameStep = enGameStep_WaitFadeOut; break; case enGameStep_WaitFadeOut: if (!g_fade->IsExecute()) { //タイトルに戻る。 DeleteGO(this); NewGO<TitleScene>(0); } break; } }