void ThirdCube::PlayShuffle() { int first; int second; while( 1 ) { first = rand()%18; second = rand()%3; if( first != 14 ) break; } m_vFirstSelect = m_DumiVector[first]; if( second == 1 ) m_vSecondSelect = m_DumiVector[first+1]; else m_vSecondSelect = m_DumiVector[first+9]; m_nAnimationSpeed = 10; m_bRotateSound = true; m_bAnimation = true; RotateCube(second+1); if( ++m_nShuffleCount >= m_nShuffleNum ) { m_nShuffleCount = 0; m_bShuffle = false; m_bPerfectCheck = true; m_bWait = true; m_bSendPacketIsWait = true; } }
void RSubCube::Render() { RotateCube(); Cube::Render(); }
void ThirdCube::Update() { m_pkLight->setPosition(m_pkAppCamera->getPosition()); m_pkLight->setDirection(m_pkAppCamera->getDirection()); if( m_nMouseState ) { POINT currentPos; GetCursorPos(¤tPos); Radian x = Degree((m_RMousePos.x - currentPos.x)*0.5f); Radian y = Degree((m_RMousePos.y - currentPos.y)*0.5f); m_pkAppCamera->rotate(x, y); SetCursorPos(m_RMousePos.x, m_RMousePos.y); } m_pkAppCamera->update(m_Origin); if( m_bVictory ) { Victory(); return; } if( m_bAnimation ) { RotateAnimation(); return; } if( m_bShuffle ) { PlayShuffle(); return; } if( m_bFirstSelect && m_bSecondSelect ) { ++m_nCount; int select = 0; // 1=x, 2=y, 3=z Vector3 check; check.x = m_vMoc.x<0? -m_vMoc.x : m_vMoc.x; check.y = m_vMoc.y<0? -m_vMoc.y : m_vMoc.y; check.z = m_vMoc.z<0? -m_vMoc.z : m_vMoc.z; if( check.x > check.y && check.x > check.z ) select = 1; else if( check.y > check.z ) select = 2; else select = 3; int rotate = RotateCheck(select); // 1=pitch, 2=yaw, 3=roll RotateCube(rotate); m_bFirstSelect = m_bSecondSelect = false; m_vFirstSelect = m_vSecondSelect = Vector3::ZERO; m_bRotateSound = true; m_bAnimation = true; } }