Пример #1
0
bool Player::GoodTurretPosition(void) const
{
    SGD::Point		turretposP	= GetTurretPosition();
    SGD::Rectangle	world;

    if (Game::GetInstance()->GetCurrState() == HTPGameState::GetInstance())
    {
        world = { 0, 0, HTPGameState::GetInstance()->GetWorldSize().width, HTPGameState::GetInstance()->GetWorldSize().height };
    }

    else
        world = { 0, 0, GameplayState::GetInstance()->GetWorldSize().width, GameplayState::GetInstance()->GetWorldSize().height };

    if (turretposP.IsWithinRectangle(world) == true)
        return true;
    return false;
}
Пример #2
0
void CProfileSelectState::SeletionInput()
{
	SGD::InputManager* input = SGD::InputManager::GetInstance();
#if ARCADE
	if (input->IsButtonPressed(0, 6) || input->IsButtonPressed(1, 6) || input->IsButtonPressed(0, 2) || input->IsButtonPressed(1, 2))
	{
		Game::GetInstance()->PopState();
		//Game::GetInstance()->PushState(CMainMenuState::GetInstance());
		return;
	}

	SGD::Vector joy1 = input->GetLeftJoystick(0);
	SGD::Vector joy2 = input->GetLeftJoystick(1);
	if (joy1.x > 0 || joy2.x > 0)
	{
		if (currentProfile >= 2)
			currentProfile = 0;
		else
			currentProfile++;
		state = MyState::Transition;
		transTimer = 0;
		CSoundBox::GetInstance()->Play((int)CSoundBox::sounds::uiSwish, false);
	}
	if (joy1.x < 0 || joy2.x < 0)
	{
		if (currentProfile <= 0)
			currentProfile = 2;
		else
			currentProfile--;
		state = MyState::Transition;
		transTimer = 0;
		CSoundBox::GetInstance()->Play((int)CSoundBox::sounds::uiSwish, false);
	}
	if (input->IsButtonPressed(0, 0) || input->IsButtonPressed(1, 0))
	{
		state = MyState::Menu;
	}

	if (input->IsKeyPressed(SGD::Key::MouseLeft))
	{
		SGD::Point mouse = input->GetMousePosition();
		if (mouse.IsWithinRectangle(SGD::Rectangle{ current, profileSize }))
		{
			state = MyState::Menu;
			return;
		}
		if (mouse.IsWithinRectangle(SGD::Rectangle{ next, profileSize }))
		{
			if (currentProfile >= 2)
				currentProfile = 0;
			else
				currentProfile++;
			state = MyState::Transition;
			transTimer = 0;
			CSoundBox::GetInstance()->Play((int)CSoundBox::sounds::uiSwish, false);
		}
		if (mouse.IsWithinRectangle(SGD::Rectangle{ previous, profileSize }))
		{
			if (currentProfile <= 0)
				currentProfile = 2;
			else
				currentProfile--;
			state = MyState::Transition;
			transTimer = 0;
			CSoundBox::GetInstance()->Play((int)CSoundBox::sounds::uiSwish, false);
		}
	}
#else
	if (input->IsKeyPressed(SGD::Key::Escape) || input->IsButtonPressed(0, 1))
	{
		Game::GetInstance()->PopState();
		//Game::GetInstance()->PushState(CMainMenuState::GetInstance());
		return;
	}

	if (input->IsKeyPressed(SGD::Key::RightArrow) || input->IsDPadPressed(0, SGD::DPad::Right))
	{
		if (currentProfile >= 2)
			currentProfile = 0;
		else
			currentProfile++;
		state = MyState::Transition;
		transTimer = 0;
		CSoundBox::GetInstance()->Play((int)CSoundBox::sounds::uiSwish, false);
	}
	if (input->IsKeyPressed(SGD::Key::LeftArrow) || input->IsDPadPressed(0, SGD::DPad::Left))
	{
		if (currentProfile <= 0)
			currentProfile = 2;
		else
			currentProfile--;
		state = MyState::Transition;
		transTimer = 0;
		CSoundBox::GetInstance()->Play((int)CSoundBox::sounds::uiSwish, false);
	}
	if (input->IsKeyPressed(SGD::Key::Enter) || input->IsButtonPressed(0, 0))
	{
		state = MyState::Menu;
	}

	if (input->IsKeyPressed(SGD::Key::MouseLeft))
	{
		SGD::Point mouse = input->GetMousePosition();
		if (mouse.IsWithinRectangle(SGD::Rectangle{ current, profileSize }))
		{
			state = MyState::Menu;
			return;
		}
		if (mouse.IsWithinRectangle(SGD::Rectangle{ next, profileSize }))
		{
			if (currentProfile >= 2)
				currentProfile = 0;
			else
				currentProfile++;
			state = MyState::Transition;
			transTimer = 0;
			CSoundBox::GetInstance()->Play((int)CSoundBox::sounds::uiSwish, false);
		}
		if (mouse.IsWithinRectangle(SGD::Rectangle{ previous, profileSize }))
		{
			if (currentProfile <= 0)
				currentProfile = 2;
			else
				currentProfile--;
			state = MyState::Transition;
			transTimer = 0;
			CSoundBox::GetInstance()->Play((int)CSoundBox::sounds::uiSwish, false);
		}
	}
#endif
}