Пример #1
0
void CttView::OnLButtonDown(UINT nFlags, CPoint point)
{
	// TODO: 在此添加消息处理程序代码和/或调用默认值
	if (m_gameON){
		MakeBullet(CPoint(m_player_x,m_player_y),point);
		return;
	}
	if(m_graphtype<=2)m_point.push_back(point);
	else if(m_graphtype==3){
		CDC* pDC = GetWindowDC();
		SeedFill(point.x , point.y , RGB(0,0,0),pDC);
	}else if(m_graphtype==4){
		CDC* pDC = GetWindowDC();
		SeedLine(point.x , point.y ,RGB(123,23,3), RGB(0,0,0),pDC);
	}
	else if (m_graphtype == 5){
		DuiChengX(point.x,point.y);
	}
	else if (m_graphtype == 6){
		DuiChengY(point.x, point.y);
	}
	else if (m_graphtype == 7){
		DuiChengXY(point.x, point.y);
	}
	else if (m_graphtype == 8){
		GraphMove(point.x, point.y);
	}
	else if (m_graphtype == 9){
		XuanZhuan(point.x, point.y);
	}
	else if (m_graphtype == 10){
		SuoFang(point.x, point.y);
	}
	else if (m_graphtype == 11){
		PointCai(point.x, point.y);
	}
	else if (m_graphtype == 12){
		m_point.push_back(point);
	}

	CView::OnLButtonDown(nFlags, point);
}
Пример #2
0
void MainLogic::charUpdate()
{
	


	auto itr = m_vChars.begin();
	FOREACH(m_vChars,itr)
	{
		if((*itr)->m_isFire)
		{
			MakeBullet((*itr));
		}

		if((*itr)->m_eState == StateB_Null)
		{
			if((*itr)->m_eCharIndex == Index_Player)
			{

			}
			else
			{
				auto t = *itr;
				m_vChars.erase(itr);
				removeChild(t);
				break;
			}
		}
	}

	if(m_pPlayer->isGrenade)
	{
		MakeGrenade();
	}

	if(m_pPlayer->m_nHp <= 0)
	{
		DataMgr->m_isActive = false;
		MakeItem(ItemIndex::ItemBomb,m_pPlayer->getPos().x);
	}
}
Пример #3
0
void Game::EventCallBack(EventData * e)
{
	if (e->Type == TOWER_COLL)
	{
		//Need to add Alien as a target for the Tower
		Entity *tower = reinterpret_cast<Entity *>(e->Int2);
		Entity *alien = reinterpret_cast<Entity *>(e->Int1);
		//If Target is not in array then add it.
		if (!tower->GetComponent<Tower>()->FindTarget(alien))
		{
			tower->GetComponent<Tower>()->AddTarget(alien);
		}
	}

	 else if (e->Type == BULLET_COLL)
	{
		Entity *bullet = reinterpret_cast<Entity *>(e->Int1);
		Entity *alien = reinterpret_cast<Entity *>(e->Int2);

		//Need to perform the damage and delete the projectile.

		if (alien->HasComponent<Alien>())
		{
			//alien->GetComponent<Alien>()->Health -= bullet->GetComponent<Bullet>()->Damage;
			PlayerGold += alien->GetComponent<Alien>()->GoldGain;
			alien->RemoveComponent<Alien>();
			alien->RemoveComponent<Collider>();
			for (auto towers : Tower::GetAll())
			{
				towers->RemoveTarget(alien);
			}
			//bullet->GetComponent<Bullet>()->SpawningTower->GetComponent<Tower>()->RemoveTarget(alien);
			bullet->RemoveComponent<Collider>();
			bullet->RemoveComponent<Bullet>();
			MainGroup.RemoveEntity(*bullet);
			MainGroup.RemoveEntity(*alien);
		}
		//If the damage was enough to kill the Alien we need to remove the Alien and reward player
				
			
	}
	 else if (e->Type == SHOOT_BULLET)
	 {
		 Entity *callingTower = static_cast<Entity*>(e->Void);
		 //Make a bullet
		 Entity * newBullet = MakeBullet(callingTower);
		  //Add to scene
		 MainGroup.AddEntity(*newBullet);
		
	 }

	else if (e->Type == SCREEN_COLL)
	{
		PlayerHealth --;
		Entity *remove = static_cast<Entity*>(e->Void);
		MainGroup.RemoveEntity(*remove);
	}

	

}