//============================================================================= // 終了処理 //============================================================================= void UninitEnemy(void) { for(int nCntType = 0; nCntType < ENEMY_TYPE_MAX; nCntType++) { // メッシュの開放 if(g_modelData[nCntType].pD3DXMesh != NULL) { g_modelData[nCntType].pD3DXMesh->Release(); g_modelData[nCntType].pD3DXMesh = NULL; } // マテリアルの開放 if(g_modelData[nCntType].pD3DXBuffMat != NULL) { g_modelData[nCntType].pD3DXBuffMat->Release(); g_modelData[nCntType].pD3DXBuffMat = NULL; } //テクスチャの開放 if(g_modelData[nCntType].pD3DTexture != NULL) { g_modelData[nCntType].pD3DTexture->Release(); g_modelData[nCntType].pD3DTexture = NULL; } } for(int nCntEnemy = 0; nCntEnemy < MAX_ENEMY; nCntEnemy++) { //影と判定の開放 ReleaseShadow(g_enemy[nCntEnemy].nIdxShadow); g_enemy[nCntEnemy].bUse = false; } }
//============================================================================= // 更新処理 //============================================================================= void UpdateBillboard(void) { D3DXVECTOR3 rotCamera; // カメラの回転を取得 rotCamera = GetRotCamera(); if(GetKeyboardPress(DIK_LEFT)) { if(GetKeyboardPress(DIK_UP)) {// 左前移動 } else if(GetKeyboardPress(DIK_DOWN)) {// 左後移動 } else {// 左移動 } } else if(GetKeyboardPress(DIK_RIGHT)) { if(GetKeyboardPress(DIK_UP)) {// 右前移動 } else if(GetKeyboardPress(DIK_DOWN)) {// 右後移動 } else {// 右移動 } } else if(GetKeyboardPress(DIK_UP)) {// 前移動 } else if(GetKeyboardPress(DIK_DOWN)) {// 後移動 } if(GetKeyboardTrigger(DIK_SPACE)) {// ジャンプ if(g_bEnableGravity == true) { // 上方向へ速度を追加 g_vecBillboard.y += 10.0f; } } // ビルボードの移動 g_posBillboard.x += g_vecBillboard.x; g_posBillboard.y += g_vecBillboard.y; g_posBillboard.z += g_vecBillboard.z; // 減速 g_vecBillboard.x += (0.0f - g_vecBillboard.x) * RATE_REGIST; g_vecBillboard.y += (0.0f - g_vecBillboard.y) * RATE_REGIST; g_vecBillboard.z += (0.0f - g_vecBillboard.z) * RATE_REGIST; // 範囲外チェック if(abs(g_vecBillboard.x) < 0.1 && abs(g_vecBillboard.y) < 0.1 && abs(g_vecBillboard.z) < 0.1 && g_bUse){ g_bUse = false; SetExplosion(g_posBillboard, 10, 10); ReleaseShadow(g_nIdxShadowBillboard); //g_posBillboard.z = 0.0f; g_vecBillboard.z = 0.0f; //SetVertexBillboard(BILLBOARD_SIZE_X, BILLBOARD_SIZE_Y); //g_nIdxShadowBillboard = CreateShadow(g_posBillboard, BILLBOARD_SIZE_X, BILLBOARD_SIZE_Y); } {// 影の設定 // 位置 SetPositionShadow( g_nIdxShadowBillboard, g_posBillboard ); // サイズ float fSizeX = BILLBOARD_SIZE_X + (g_posBillboard.y - 9.0f) * 0.025f; if(fSizeX < BILLBOARD_SIZE_X) { fSizeX = BILLBOARD_SIZE_X; } float fSizeY = BILLBOARD_SIZE_Y + (g_posBillboard.y - 9.0f) * 0.025f; if(fSizeY < BILLBOARD_SIZE_Y) { fSizeY = BILLBOARD_SIZE_Y; } SetVertexShadow(g_nIdxShadowBillboard, fSizeX, fSizeY); // α値 float colA = (400.0f - (g_posBillboard.y - 9.0f)) / 800.0f; if(colA < 0.0f) { colA = 0.0f; } SetColorShadow(g_nIdxShadowBillboard, D3DXCOLOR(1.0f, 1.0f, 1.0f, colA)); } }