void CObject_Player::ChangeCamera(ID3D11Device *pd3dDevice, DWORD nNewCameraMode, float fTimeElapsed)
{
	DWORD nCurrentCameraMode = (m_pCamera) ? m_pCamera->GetMode() : 0x00;
	if (nCurrentCameraMode == nNewCameraMode) return;
	switch (nNewCameraMode)
	{
		case FIRST_PERSON_CAMERA:            
//플레이어의 특성을 1인칭 카메라 모드에 맞게 변경한다. 중력은 적용하지 않는다.
            SetFriction(200.0f); 
            SetGravity(D3DXVECTOR3(0.0f, 0.0f, 0.0f));
            SetMaxVelocityXZ(125.0f);
            SetMaxVelocityY(400.0f);
            m_pCamera = OnChangeCamera(pd3dDevice, FIRST_PERSON_CAMERA, nCurrentCameraMode);
            m_pCamera->SetTimeLag(0.0f);
            m_pCamera->SetOffset(D3DXVECTOR3(0.0f, 20.0f, 0.0f));
            m_pCamera->GenerateProjectionMatrix(1.01f, 5000.0f, ASPECT_RATIO, 60.0f);
            break;
		case SPACESHIP_CAMERA:            
//플레이어의 특성을 스페이스-쉽 카메라 모드에 맞게 변경한다. 중력은 적용하지 않는다.
            SetFriction(125.0f); 
            SetGravity(D3DXVECTOR3(0.0f, 0.0f, 0.0f));
            SetMaxVelocityXZ(400.0f);
            SetMaxVelocityY(400.0f);
            m_pCamera = OnChangeCamera(pd3dDevice, SPACESHIP_CAMERA, nCurrentCameraMode);
            m_pCamera->SetTimeLag(0.0f);
            m_pCamera->SetOffset(D3DXVECTOR3(0.0f, 0.0f, 0.0f));
            m_pCamera->GenerateProjectionMatrix(1.01f, 5000.0f, ASPECT_RATIO, 60.0f);
            break;  
		case THIRD_PERSON_CAMERA:
//플레이어의 특성을 3인칭 카메라 모드에 맞게 변경한다. 지연 효과와 카메라 오프셋을 설정한다.
            SetFriction(250.0f); 
            SetGravity(D3DXVECTOR3(0.0f, 0.0f, 0.0f));
            SetMaxVelocityXZ(125.0f);
            SetMaxVelocityY(400.0f);
            m_pCamera = OnChangeCamera(pd3dDevice, THIRD_PERSON_CAMERA, nCurrentCameraMode);
            m_pCamera->SetTimeLag(0.25f);
            m_pCamera->SetOffset(D3DXVECTOR3(0.0f, 130.0f, -80.0f));
            m_pCamera->GenerateProjectionMatrix(1.01f, 5000.0f, ASPECT_RATIO, 60.0f);
            break;
		default:
            break;
	}
//카메라 정보를 시간에 따라 갱신한다.
	Update(fTimeElapsed);
}
Esempio n. 2
0
Character::Character(Settings *settings, int mapWidth, int mapHeight, std::vector<std::vector<Cell>> *cellMap)
{
    hasText_ = false;
    movespeed_ = 0;
    currentRotation_ = 0;
    hasImage_ = false;
    hasColor_ = false;
    hasImageReference_ = false;
    aiEnabled_ = true;

    mapWidth_ = mapWidth;
    mapHeight_ = mapHeight;

    cellMap_ = cellMap;


    settings_ = settings;
    KeyLeft_ = false;
    KeyRight_ = false;
    KeySpace_ = false;
    SetCurrentPosition(mapWidth_ / Constants::TileSize() + 1, mapHeight_ / Constants::TileSize() + 1);
    SetColor(al_map_rgb_f(1, 1, 1));
    SetWidth(0.8);
    SetHeight(0.8);

    SetGravityY(-9.8);
    SetVelocityY(0.125);
    SetMaxVelocityY(1);
    SetAccelerationY(0.03125);


    SetMoveSpeedDelta(0.0625);
    SetMoveSpeed(30);
    SetJumpSpeed(12);

    font30_ = al_load_font("arial.ttf", Constants::TileSize(), 0);



    SetCharacterYAxisState(CHARACTERYAXISSTATES::CHARACTERFALLING);



}