예제 #1
0
void MazeMovement::ProcessInput(const Input& input, float delta)
{
	if (!m_moving)
	{
		SetFrontTile();
		if (input.GetKeyUp(Input::KEY_LEFT))
		{
			GetTransform()->Rotate(PxQuat(ToRadians(-90.0f), PxVec3(0, 1, 0)));
			SetFrontTile();
		}

		if (input.GetKeyUp(Input::KEY_RIGHT))
		{
			GetTransform()->Rotate(PxQuat(ToRadians(90.0f), PxVec3(0, 1, 0)));
			SetFrontTile();
		}
		
		if (input.GetKey(Input::KEY_UP))
		{
			switch (m_frontTile)
			{
			case 2:
				m_ogPosition = *GetTransform()->GetPos();
				m_desiredPosition = *GetTransform()->GetPos() + PxVec3(-GetTransform()->GetRot()->getBasisVector0().z, 0.0f, GetTransform()->GetRot()->getBasisVector0().x);
				m_gridPosition = PxVec2(m_gridPosition.x - (int)GetTransform()->GetRot()->getBasisVector0().z, m_gridPosition.y + (int)GetTransform()->GetRot()->getBasisVector0().x);
				SetFrontTile();
				m_moving = true;
				break;
			}
		}

		if (input.GetKey(Input::KEY_DOWN))
		{
			switch (m_maze[(int)m_gridPosition.x + (int)GetTransform()->GetRot()->getBasisVector0().z][(int)m_gridPosition.y - (int)GetTransform()->GetRot()->getBasisVector0().x])
			{
			case 2:
				m_ogPosition = *GetTransform()->GetPos();
				m_desiredPosition = (*GetTransform()->GetPos() - PxVec3(-GetTransform()->GetRot()->getBasisVector0().z, 0.0f, +GetTransform()->GetRot()->getBasisVector0().x));
				m_gridPosition = PxVec2(m_gridPosition.x + (int)GetTransform()->GetRot()->getBasisVector0().z, m_gridPosition.y - (int)GetTransform()->GetRot()->getBasisVector0().x);
				SetFrontTile();
				m_moving = true;
				break;
			}
		}

		if (input.GetKeyUp(Input::KEY_F) && m_frontTile == 3)
		{
			m_parent->GetEngine().Stop();
		}
	}
	
}
예제 #2
0
void FreeLook::ProcessInput(const Input& input, float delta)
{
	if (input.GetKeyUp(Input::KEY_LEFT))
	{
		GetTransform()->Rotate(PxQuat(ToRadians(-90.0f), PxVec3(0, 1, 0)));
	}

	if (input.GetKeyUp(Input::KEY_RIGHT))
	{
		GetTransform()->Rotate(PxQuat(ToRadians(90.0f), PxVec3(0, 1, 0)));
	}

}
예제 #3
0
void FreeMove::ProcessInput(const Input& input, float delta)
{
	float movAmt = m_speed;

	if (input.GetKeyUp(m_forwardKey))
		Move(GetForward(*GetTransform()->GetRot()), movAmt);
	if (input.GetKeyUp(m_backKey))
		Move(GetBack(*GetTransform()->GetRot()), movAmt);
	if ( input.GetKeyUp ( m_leftKey ) )
		Move(GetLeft(*GetTransform()->GetRot()), movAmt);
	if ( input.GetKeyUp ( m_rightKey ) )
		Move(GetRight(*GetTransform()->GetRot()), movAmt);



}