Esempio n. 1
0
void CMapObstacle::Update( float dTime )
{

	//Zombie리스트를 돌면서 좀비가 Obstacle에 닿았는지를 체크
	for (const auto& child : *CPlayScene::GetInstance()->GetZombieList())
	{
		if(child != CPlayScene::GetInstance()->GetMapCreator()->GetZombieBase() && IsCrash(child) ) 
		{
			printf_s("Boom!\n");
			Boom(child);
			break;			
		}
	}
	
}
Esempio n. 2
0
void CRussiaGame::OnDownKeyDown(HWND hWnd, UINT uMsg, UINT nTime, DWORD dwTime)
{
	if (!IsValidBottom() || IsCrash())
	{
		m_iMap[m_currentBlock.Point0.m_x][m_currentBlock.Point0.m_y] = 1;
		m_iMap[m_currentBlock.Point1.m_x][m_currentBlock.Point1.m_y] = 1;
		m_iMap[m_currentBlock.Point2.m_x][m_currentBlock.Point2.m_y] = 1;
		m_iMap[m_currentBlock.Point3.m_x][m_currentBlock.Point3.m_y] = 1;
		EliminateLine();
		OnInit();
		return;
	}
	m_currentBlock.Point0.m_y += 1;
	m_currentBlock.Point1.m_y += 1;
	m_currentBlock.Point2.m_y += 1;
	m_currentBlock.Point3.m_y += 1;
	InvalidateRect(hWnd, NULL, TRUE);
}
Esempio n. 3
0
void CLightning::Update( float dTime )
{

	if(m_cloudSprite->GetPositionX() 
		< GAME_SCREEN_MAX_SIZE_X - 20 && !m_is_fall_lightning)
		m_cloudSprite->SetPosition
		(m_cloudSprite->GetPosition() 
		+ NNPoint(CLOUD_SPEED, 0.0f) * dTime);

	else if(!m_is_fall_lightning)
		m_cloudSprite->SetPosition(0.0f, POSITION_OF_CLOUD);


	m_currentTime = clock();
	if((NNInputSystem::GetInstance()->GetKeyState(VK_SPACE) == KEY_DOWN) && !m_is_fall_lightning
		&& (m_currentTime-m_startTime > LIGHTNING_COOL_TIME))
	{
		m_lightning_sprite->SetPosition(m_cloudSprite->GetPosition() - NNPoint(200,0));
		m_lightning_sprite->SetVisible(true);
		m_is_fall_lightning = true;
		m_startTime = m_currentTime;

		for (const auto& child : *CPlayScene::GetInstance()->GetPoliceList())
		{
			if(child != CPlayScene::GetInstance()->
				GetMapCreator()->GetPoliceBase())

				if(IsCrash(child))
				{
					child->SetHP(child->GetHP() - m_lightning_damage);
					m_stopTime = m_currentTime;
					break;
				}
			m_stopTime = m_currentTime;
		}
	}

	if(m_is_fall_lightning && m_currentTime - m_stopTime > 2000)
	{
		m_is_fall_lightning = false;
		m_lightning_sprite->SetVisible(false);

	}
}
Esempio n. 4
0
    base::AppBuffer CfgFile::GetContent()
    {
        if (IsCrash())
        {
            base::AppBuffer buf(0);
            return buf;
        }
        boost::uint32_t content_len = GetContentSize() - cfg_head_len_;
        boost::uint32_t readbuflen = 0;
        boost::uint32_t readnum = SecRead((boost::uint8_t*) (&readbuflen), sizeof(readbuflen));

        assert(readnum == sizeof(readbuflen));

        assert(readbuflen == content_len-sizeof(readbuflen));

        base::AppBuffer content_buf(readbuflen);
        readnum = SecRead((boost::uint8_t*) (content_buf.Data()), content_buf.Length());
        assert(readnum == content_buf.Length());
        return content_buf;
    }
Esempio n. 5
0
void CLightning::Update( float dTime )
{
	//가만히 있으면 번개는 왼쪽으로 이동. 왼쪽 끝까지 이동하면 오른쪽 끝으로 다시 셋팅.
	if(m_lightning_sprite->GetVisible());

	else if(m_cloudSprite->GetPositionX() 
		< GAME_SCREEN_MAX_SIZE_X - 20 && !m_is_fall_lightning)
		m_cloudSprite->SetPosition
		(m_cloudSprite->GetPosition() 
		+ NNPoint(LIGHTNING_SPEED, 0.0f) * dTime);
	
	else if(!m_is_fall_lightning)
		m_cloudSprite->SetPosition(0.0f, POSITION_OF_LIGHTNING);
	
	


	m_currentTime = clock();
	
	//Space바가 눌렸는지를 체크. 눌렸으면 Flag를 True로 바꿔준다.
	if(NNInputSystem::GetInstance()->GetKeyState(VK_SPACE) == KEY_DOWN && !m_fall_lightning_sprite && (m_currentTime-m_startTime > LIGHTNING_COOL_TIME))
	{
		printf_s("put");
		m_is_fall_lightning = true;
		m_startTime = m_currentTime;
		
	}

	//현재 '떨어지고 있는 상태'라면 번개의 위치를 지속적으로 아래로 떨어지도록 변경
	if(m_is_fall_lightning)
	{
		//m_lightning_sprite->SetPosition
		//	(m_lightning_sprite->GetPosition() + NNPoint(0.0f, LIGHTNING_SPEED) *dTime);
		//Zombie와 Police를 돌면서 충돌 체크. 충돌하면 flag를 false로 바꾸고, 데미지 주고 번개 위치는 다시 0,0으로 셋팅
		m_lightning_sprite->SetPosition(m_cloudSprite->GetPosition());
		m_lightning_sprite->SetVisible(true);
		

		//Police만 맞도록 수정
		//for (const auto& child : *CPlayScene::GetInstance()->GetZombieList())
		//{
		//	//List에 Base가 존재. Base는 번개에 의해 데미지를 받으면 안되므로 제외하도록 설정
		//	if(child != CPlayScene::GetInstance()->
		//		GetMapCreator()->GetZombieBase())
		//		if(IsCrash(child))
		//		{
		//			child->SetHP(child->GetHP() - m_lightning_damage);
		//			m_is_fall_lightning = false;
		//				
		//			m_lightning_sprite->
		//				SetPosition(0.0f, POSITION_OF_LIGHTNING);
		//			break;
		//		}	
		//}
		
		for (const auto& child : *CPlayScene::GetInstance()->GetPoliceList())
		{
			if(child != CPlayScene::GetInstance()->
				GetMapCreator()->GetPoliceBase())
				if(IsCrash(child))
				{
					child->SetHP(child->GetHP() - m_lightning_damage);
					m_is_fall_lightning = false;

					m_lightning_sprite->
						SetPosition(0.0f, POSITION_OF_LIGHTNING);
					break;
				}
		}
		m_is_fall_lightning = false;

		
		////번개가 아무에게도 맞지 않고 아래로 끝까지 떨어지면 소멸 처리.
		//if(m_lightning_sprite->GetPositionY() >= FIRST_Y_COORDINATE_OF_UIBUTTON)
		//{
		//	m_is_fall_lightning = false;

		//	m_lightning_sprite->SetPosition(0.0f, POSITION_OF_LIGHTNING);
		//}

	}

	//연출을 위해 2초간 정지
	if(m_lightning_sprite->GetVisible() && m_currentTime - m_startTime > 2000){
		m_lightning_sprite->SetVisible(false);
	}
}