CPressurePlate::CPressurePlate( XMFLOAT3 _location, bool _used ) : IObject( "PressurePlate" ) { AudioSystemWwise::Get()->RegisterEntity( this, "PressurePlate" ); XMFLOAT3 newLocation = _location; newLocation.y = 1; SetPosition( newLocation ); CMesh* vPressureMesh = CAssetManager::GetInstance()->GetPrefabMesh("PressurePlate"); SetRenderMesh( new CRenderMesh( vPressureMesh, GRAPHICS->GetVertexShader(), GRAPHICS->GetNormalMapPS(), nullptr, nullptr, nullptr, L"../Game/Assets/Art/2D/Textures/Bricks.dds" ) ); m_cpRenderMesh->SetNormals(L"../Game/Assets/Art/2D/Normal Maps/Bricks.dds"); m_cpRenderMesh->GetSpecular() = 1.5f; GRAPHICS->AddRenderMesh( m_cpRenderMesh ); //tempFloor->SetRenderMesh( new CRenderMesh( tempMesh->GetIndices(), tempMesh->GetVertices(), GRAPHICS->GetVertexShader(), GRAPHICS->GetNormalMapPS(), nullptr, nullptr, nullptr, L"../Game/Assets/Art/2D/Textures/Maze_Ground.dds" ) ); //tempFloor->GetRenderMesh()->SetNormals( L"../Game/Assets/Art/2D/Normal Maps/Rocky.dds" ); //tempFloor->GetRenderMesh()->GetSpecular() = 1.5f; //if (_used) { AddCollider( new CCollider( false, Bounds::AABB, vPressureMesh->GetVertices(), _used,false ) ); for( size_t i = 0; i < m_pvColliders.size(); i++ ) { ( (CAABB*)m_pvColliders[i]->GetBounds() )->SetCenter( { m_mWorld._41, m_mWorld._42, m_mWorld._43 } ); } } CAddObjectMessage* addObj = new CAddObjectMessage( this, CObjectManager::Static ); addObj->Send(); }
/***************************************************************** * CSkeleton() Skeleton Constructor that initializes the data members * * Ins: CObjectManager* * CAnimationManager* * * Outs: None * * Returns: void * * Mod. Date: 08/20/2015 * Mod. Initials: NS *****************************************************************/ CSkeleton::CSkeleton(CObjectManager* _manager, CAnimationManager* _animManager, CDayNight* _dayNight, CSkeletonController* skeletonController) : CBoid(10.0f, 500.0f, "Skeleton") { // Drop Shadow Creation // CMesh cDropShadow; cDropShadow.GetIndices().push_back(0); cDropShadow.GetIndices().push_back(1); cDropShadow.GetIndices().push_back(2); cDropShadow.GetIndices().push_back(0); cDropShadow.GetIndices().push_back(2); cDropShadow.GetIndices().push_back(3); cDropShadow.GetVertices().push_back ({ { -100.0f, 3.0f, 100.0f, 1.0f }, { 0.0f, 1.0f, 0.0f, 1.0f }, { 0, 0 } }); cDropShadow.GetVertices().push_back ({ { 100.0f, 3.0f, 100.0f, 1.0f }, { 0.0f, 1.0f, 0.0f, 1.0f }, { 1, 0 } }); cDropShadow.GetVertices().push_back ({ { 100.0f, 3.0f, -100.0f, 1.0f }, { 0.0f, 1.0f, 0.0f, 1.0f }, { 1, 1 } }); cDropShadow.GetVertices().push_back ({ { -100.0f, 3.0f, -100.0f, 1.0f }, { 0.0f, 1.0f, 0.0f, 1.0f }, { 0, 1 } }); m_cDropShadow = new CRenderMesh(&cDropShadow, GRAPHICS->GetStandardVS(), GRAPHICS->GetStandardPS()); m_cDropShadow->SetTexture(L"../Game/Assets/Art/2D/Textures/Shadow.dds"); m_cDropShadow->GetTransparent() = true; m_cDropShadow->GetRender() = false; GRAPHICS->AddRenderMesh(m_cDropShadow); // Initilize Managers #if _DEBUG m_pPathPlanner = new CPathFinding("SkeletonNavGraph", _manager, false); #else m_pPathPlanner = new CPathFinding("SkeletonNavGraph", _manager, false); #endif m_pDayNight = _dayNight; m_fScale = 1.0f; m_pAssetManager = CAssetManager::GetInstance(); m_bPoweringUp = false; //Set the Animation Manager m_cpAnimationManager = _animManager; m_cpAnimations = new CAnimation[eAnimCount]; m_cpSkeletonController = skeletonController; // Set the object manager m_cpObjectManager = _manager; m_bBuffed = false; TPointLight tempLight; tempLight.m_fRadius = 0.0f; tempLight.m_fColor[0] = 1.0f; tempLight.m_fColor[1] = 0.0f; tempLight.m_fColor[2] = 0.0f; tempLight.m_fBrightness = 2.5f; tempLight.m_fPosition[0] = 0.0f; tempLight.m_fPosition[1] = 0.0f; tempLight.m_fPosition[2] = 0.0f; tempLight.m_fPosition[3] = 1.0f; AddLight(tempLight); m_bHit = false; // Load the asset /*CMesh* m_cShieldMesh = m_pAssetManager->GetMesh(CAssetManager::eMeshType::SkeletonShield)[0]; m_cShieldRender[0] = new CRenderMesh(m_cShieldMesh, GRAPHICS->GetStandardVS(), GRAPHICS->GetStandardPS(), nullptr, nullptr, nullptr, L"../Game/Assets/Art/2D/Textures/Shield2_Diffuse.dds"); m_cShieldRender[1] = new CRenderMesh(m_cShieldMesh, GRAPHICS->GetStandardVS(), GRAPHICS->GetStandardPS(), nullptr, nullptr, nullptr, L"../Game/Assets/Art/2D/Textures/Shield2_Diffuse.dds");*/ CMesh* m_cMesh = CAssetManager::GetInstance()->GetPrefabMesh("RemnantMesh"); // Create a render mesh for the object m_cpRenderMesh = new CAnimationMesh(m_cMesh, GRAPHICS->GetSkinningVS(), GRAPHICS->GetNormalMapPS(), nullptr, nullptr, nullptr, L"../Game/Assets/Art/2D/Textures/RemnantDiffuse.dds"); m_cpRenderMesh->SetNormals(L"../Game/Assets/Art/2D/Normal Maps/RemnantNormal.dds"); // Set the animation mesh m_cpSword = new CSkeletonSword; XMMATRIX mSkele = XMMatrixIdentity(); XMStoreFloat4x4(&m_mSkeleLocal, mSkele); // AttachToJoint(m_cpSword->S(), LEFT_HAND); m_cpRenderMesh->GetRender() = false; m_cpAnimations[eRunAnim] = CAssetManager::GetInstance()->GetAnimation("RemnantRun"); m_cpAnimations[eRunAnim].SetLooping(true); m_cpAnimations[eBlockWalkAnim] = CAssetManager::GetInstance()->GetAnimation("RemnantRun"); m_cpAnimations[eBlockWalkAnim].SetLooping(true); m_cpAnimations[eAttackAnim] = CAssetManager::GetInstance()->GetAnimation("RemnantLightAttack1"); m_cpAnimations[eAttackAnim].SetLooping(false); m_cpAnimations[eAttackAnim].SetScale(1.33f); m_cpAnimations[eDeathAnim] = CAssetManager::GetInstance()->GetAnimation("RemnantDeath1"); m_cpAnimations[eDeathAnim].SetLooping(false); m_cpAnimations[eHurtAnim] = CAssetManager::GetInstance()->GetAnimation("RemnantHurt"); m_cpAnimations[eHurtAnim].SetLooping(false); m_cpAnimations[eHurtAnim].SetScale(1.0f); m_cpAnimations[eHurt2Anim] = CAssetManager::GetInstance()->GetAnimation("RemnantHurt"); m_cpAnimations[eHurt2Anim].SetLooping(false); m_cpAnimations[eSpawnAnim] = CAssetManager::GetInstance()->GetAnimation("RemnantSpawn1"); m_cpAnimations[eSpawnAnim].SetLooping(false); m_cpAnimations[eSpawnAnim].SetScale(0.0f); m_pParticleManager = new CParticleManager(_manager); m_unParticleEmitters[eBoneParticle] = m_pParticleManager->LoadEmitter("BoneFragment.xml"); m_unParticleEmitters[eDustParticle] = m_pParticleManager->LoadEmitter("BoneDust.xml"); m_unParticleEmitters[eFadeAway] = m_pParticleManager->LoadEmitter("EnemyFadeAway.xml"); for (unsigned int animation = 0; animation < eAnimCount; animation++) { m_cpAnimations[animation].SetAnimMesh((CAnimationMesh*)m_cpRenderMesh); m_cpAnimations[animation].IntializeAnimation(); } // Add the starting animation m_cpAnimationManager->AddAnimation(&m_cpAnimations[eSpawnAnim]); // Set the current animaton m_unCurrAnim = eSpawnAnim; // Add collision box AddCollider(new CCollider(true, new CAABB(XMFLOAT3(m_mWorld._41, 55.0f, m_mWorld._43), XMFLOAT3(90.0f, 90.f, 90.f)), false)); CCapsule* theCapsule = new CCapsule({ m_mWorld._41, 45.0f, m_mWorld._43 }, { m_mWorld._41, 240.0f, m_mWorld._43 }, 45.0f); AddCollider(new CCollider(true, theCapsule)); ((CAABB*)m_pvColliders[0]->GetBounds())->SetCenter({ m_mWorld._41, m_mWorld._42, m_mWorld._43 }); // Create the attack instance AttachToJoint(m_cpSword->GetRenderMesh(), "RightHand"); GRAPHICS->AddRenderMesh(m_cpSword->GetRenderMesh()); m_cpAttack = new CAttack(this, CAssetManager::GetInstance()->GetPrefabMesh("OrcDagger"), &m_cpSword->GetRenderMesh()->GetPositionMatrix(), 20, "SkeletonAttack"); m_cpAttack->SetParent(this); // Add the object to start attacking. CAddObjectMessage* addObj = new CAddObjectMessage(m_cpAttack, CObjectManager::Dynamic); // Send the message addObj->Send(); SetWorldVelocity(XMFLOAT3(0.0f, 0.0f, 0.0f)); GRAPHICS->AddRenderMesh(m_cpRenderMesh); GRAPHICS->AddLight(&m_vtPointLights[0]); m_ipCurrentState = SPAWN; EnterSubState(); m_cpTheLoot = new CBone(m_cpObjectManager, this); m_cpThePowder = new CGunpowder(m_cpObjectManager, this); }
CMinotaur::CMinotaur(const XMFLOAT3& spawnPosition, CObjectManager* _manager, CAnimationManager* _animManager) : CBoid(15.0f, 300.0f, "Minotaur") { // Drop Shadow Creation // CMesh cDropShadow; cDropShadow.GetIndices().push_back(0); cDropShadow.GetIndices().push_back(1); cDropShadow.GetIndices().push_back(2); cDropShadow.GetIndices().push_back(0); cDropShadow.GetIndices().push_back(2); cDropShadow.GetIndices().push_back(3); cDropShadow.GetVertices().push_back ({ { -400.0f, 3.0f, 400.0f, 1.0f }, { 0.0f, 1.0f, 0.0f, 1.0f }, { 0, 0 } }); cDropShadow.GetVertices().push_back ({ { 400.0f, 3.0f, 400.0f, 1.0f }, { 0.0f, 1.0f, 0.0f, 1.0f }, { 1, 0 } }); cDropShadow.GetVertices().push_back ({ { 400.0f, 3.0f, -400.0f, 1.0f }, { 0.0f, 1.0f, 0.0f, 1.0f }, { 1, 1 } }); cDropShadow.GetVertices().push_back ({ { -400.0f, 3.0f, -400.0f, 1.0f }, { 0.0f, 1.0f, 0.0f, 1.0f }, { 0, 1 } }); m_cDropShadow = new CRenderMesh(&cDropShadow, GRAPHICS->GetStandardVS(), GRAPHICS->GetStandardPS()); m_cDropShadow->SetTexture(L"../Game/Assets/Art/2D/Textures/Shadow.dds"); m_cDropShadow->GetTransparent() = true; m_cDropShadow->GetRender() = false; GRAPHICS->AddRenderMesh(m_cDropShadow); XMStoreFloat4x4(&m_mWorld, XMMatrixTranslation(spawnPosition.x, spawnPosition.y, spawnPosition.z)); m_tSpawnPosition = spawnPosition; m_pPathPlanner = new CPathFinding("MinotaurNavGraph", _manager, false); CNavGraph* cNavGraph = CNavGraphManager::GetReference().GetNavGraph("MinotaurNavGraph"); int unNodes[2]; unNodes[0] = rand() % cNavGraph->GetNodes().size(); unNodes[1] = rand() % cNavGraph->GetNodes().size(); if (unNodes[1] == unNodes[0]) { unNodes[1]++; } m_vWaypoints.push_back(unNodes[0]); m_vWaypoints.push_back(unNodes[1]); //m_pSteering = new CSteeringManager(this); m_pAssetManager = CAssetManager::GetInstance(); m_cpAnimationManager = _animManager; m_cpObjectManager = _manager; m_pPlayer = m_cpObjectManager->GetPlayer(); CMesh* m_cMesh = m_pAssetManager->GetPrefabMesh("minotaur"); m_cpRenderMesh = new CAnimationMesh(m_cMesh, GRAPHICS->GetSkinningVS(), GRAPHICS->GetStandardPS(), nullptr, nullptr, nullptr, L"../Game/Assets/Art/2D/Textures/Minotaur.dds"); m_cpRenderMesh->GetRender() = false; GRAPHICS->AddRenderMesh(m_cpRenderMesh); enum EMinotaurAnimation{ eIdleAnim, eRunAnim, eTellAnim, eChargeAnim, eStompAnim, eDeathAnim, eEnrageAnim, eStunnedAnim, eAnimCount }; m_cpAnimations[eIdleAnim] = CAssetManager::GetInstance()->GetAnimation("MinotaurIdle"); m_cpAnimations[eRunAnim] = CAssetManager::GetInstance()->GetAnimation("MinotaurRun"); m_cpAnimations[eTellAnim] = CAssetManager::GetInstance()->GetAnimation("MinotaurTell"); m_cpAnimations[eChargeAnim] = CAssetManager::GetInstance()->GetAnimation("MinotaurCharge"); m_cpAnimations[eStompAnim] = CAssetManager::GetInstance()->GetAnimation("MinotaurStomp"); m_cpAnimations[eDeathAnim] = CAssetManager::GetInstance()->GetAnimation("MinotaurDeath"); m_cpAnimations[eEnrageAnim] = CAssetManager::GetInstance()->GetAnimation("MinotaurEnrage"); m_cpAnimations[eStunnedAnim] = CAssetManager::GetInstance()->GetAnimation("MinotaurHurt"); for (unsigned int animation = 0; animation < eAnimCount; animation++) { m_cpAnimations[animation].SetAnimMesh((CAnimationMesh*)m_cpRenderMesh); } //m_cpAnimationManager->AddAnimation(&m_cpAnimations[eRunAnim]); /*m_cpAnimationManager->AddAnimation(&m_cpAnimations[eWalkAnim]); m_cpAnimationManager->AddAnimation(&m_cpAnimations[eRunAnim]); m_cpAnimationManager->AddAnimation(&m_cpAnimations[eStompAnim]);*/ CCapsule* pCapsule = new CCapsule(XMFLOAT3(spawnPosition.x, 90.0f, spawnPosition.z), XMFLOAT3(spawnPosition.x, 250.0f, spawnPosition.z), 90.0f); CCollider* pCapCollider = new CCollider(true, pCapsule, true, false); CCollider* pBoxCollider = new CCollider(true, new CAABB(float3(spawnPosition.x, 250.0f, spawnPosition.z), float3(250.0f, 250.0f, 250.0f)), false, false); CCollider* pZoneCollider = new CCollider(true, new CAABB(float3(spawnPosition.x, 250.0f, spawnPosition.z), float3(2500.0f, 250.0f, 2500.0f)), true, false); m_pMinotaurZone = new CMinotaurZone(); m_pMinotaurZone->AddCollider(pZoneCollider); pBoxCollider->GetBounds()->UpdatePosition(spawnPosition); AddCollider(pBoxCollider); AddCollider(pCapCollider); m_pParticleManager = new CParticleManager(_manager); m_unParticleEmitters[eBloodParticle] = m_pParticleManager->LoadEmitter("BloodDrop.xml"); m_unParticleEmitters[eBloodString] = m_pParticleManager->LoadEmitter("BloodString.xml"); m_unParticleEmitters[eBloodMist] = m_pParticleManager->LoadEmitter("BloodMist.xml"); m_unParticleEmitters[eBloodMist2] = m_pParticleManager->LoadEmitter("BloodMist.xml"); m_unParticleEmitters[eStompDustOut] = m_pParticleManager->LoadEmitter("MinotaurStompDust1.xml"); m_unParticleEmitters[eStompDustUp] = m_pParticleManager->LoadEmitter("MinotaurStompDust2.xml"); m_unParticleEmitters[eStepDust] = m_pParticleManager->LoadEmitter("MinoStepDust.xml"); m_unParticleEmitters[eChargeParticle] = m_pParticleManager->LoadEmitter("MinoCharge.xml"); m_pParticleManager->GetEmitter(m_unParticleEmitters[eChargeParticle])->GetParent() = this; m_pParticleManager->GetEmitter(m_unParticleEmitters[eChargeParticle])->Stop(); m_pStates[ePatrolState] = new CMinotaurPatrol; m_pStates[eHostileState] = new CMinotaurHostile; m_pStates[eDeadState] = new CMinotaurDead; m_unCurrAnim = -1; m_nCurrState = ePatrolState; //Activate(); }
/***************************************************************** * ProcessLevelNode() Processes a single fbx node and loads in appropiate data * * Ins: node * * Outs: meshes * * Returns: bool * * Mod. Date: 09/02/2015 * Mod. Initials: NH *****************************************************************/ bool CLevelLoader::ProcessLevelNode(FbxNode* node, vector<CMesh>& meshes) { FbxNodeAttribute* attribute = node->GetNodeAttribute(); if (attribute != NULL) { if (attribute->GetAttributeType() == FbxNodeAttribute::eMesh) { CMesh* tempMesh = new CMesh; FbxMesh* attributeMesh = (FbxMesh*)attribute; CAssetManager * assetManager = CAssetManager::GetInstance(); bool errorCheck = assetManager->LoadMesh(attributeMesh, *tempMesh); if (errorCheck == false) { attribute->Destroy(); return false; } //now get prefix and apply texture, collision, etc... const char* objName = node->GetName(); std::string prefix = " "; for (unsigned int i = 0; i < 4; i++) { prefix[i] = objName[i]; } if (strcmp(prefix.c_str(), "Wal_") == 0)//wall prefab { tempMesh->ConvertVertices(); CWallObject* tempWall = new CWallObject("Wall"); tempWall->AddCollider(new CCollider(false, Bounds::AABB, tempMesh->GetVertices())); tempWall->SetRenderMesh(new CRenderMesh(tempMesh, GRAPHICS->GetVertexShader(), GRAPHICS->GetNormalMapPS(), nullptr, nullptr, nullptr, L"../Game/Assets/Art/2D/Textures/Maze_Wall.dds")); tempWall->GetRenderMesh()->SetNormals(L"../Game/Assets/Art/2D/Normal Maps/Rocky.dds"); tempWall->GetRenderMesh()->GetSpecular() = 0.5f; m_cpEnvironmentObjects.push_back(tempWall); m_cpObjectManager->AddObject(tempWall, CObjectManager::eObjectType::Static); } else if (strcmp(prefix.c_str(), "Flr_") == 0)//floor prefab { tempMesh->ConvertVertices(); CFloorObject* tempFloor = new CFloorObject("Floor"); tempFloor->AddCollider(new CCollider(false, Bounds::Plane, tempMesh->GetVertices())); tempFloor->SetRenderMesh(new CRenderMesh(tempMesh, GRAPHICS->GetVertexShader(), GRAPHICS->GetNormalMapPS(), nullptr, nullptr, nullptr, L"../Game/Assets/Art/2D/Textures/Maze_Ground.dds")); tempFloor->GetRenderMesh()->SetNormals(L"../Game/Assets/Art/2D/Normal Maps/Rocky.dds"); tempFloor->GetRenderMesh()->GetSpecular() = 1.5f; m_cpEnvironmentObjects.push_back(tempFloor); m_cpObjectManager->AddObject(tempFloor, CObjectManager::eObjectType::Static); } else if (strcmp(prefix.c_str(), "Grd_") == 0)//ground prefab(around pits) { tempMesh->ConvertVertices(); /* float f3Min[3] = { FLT_MAX, FLT_MAX, FLT_MAX }; float f3Max[3] = { -FLT_MAX, -FLT_MAX, -FLT_MAX }; for (unsigned int i = 0; i < tempMesh->GetVertices().size(); i++) { for (unsigned int xyz = 0; xyz < 3; xyz++) { if (tempMesh->GetVertices()[i].m_fPosition[xyz] < f3Min[xyz]) { f3Min[xyz] = tempMesh->GetVertices()[i].m_fPosition[xyz]; } if (tempMesh->GetVertices()[i].m_fPosition[xyz] > f3Max[xyz]) { f3Max[xyz] = tempMesh->GetVertices()[i].m_fPosition[xyz]; } } } XMFLOAT3 f3Center; f3Center.x = (f3Min[0] + f3Max[0]) / 2.0f; f3Center.y = (f3Min[1] + f3Max[1]) / 2.0f; f3Center.z = (f3Min[2] + f3Max[2]) / 2.0f; f3Center.y -= 20.0f; XMFLOAT3 f3Extents; f3Extents.x = f3Max[0] - f3Center.x; f3Extents.y = f3Max[1] - f3Center.y; f3Extents.z = f3Max[2] - f3Center.z; CBounds* tempBounds = new CAABB(f3Center, f3Extents); */ CPitWallObject* tempPitWall = new CPitWallObject("PitWall"); //tempPitWall->AddCollider(new CCollider(false, tempBounds, true)); tempPitWall->AddCollider(new CCollider(false, Bounds::AABB, tempMesh->GetVertices())); tempPitWall->SetRenderMesh(new CRenderMesh(tempMesh, GRAPHICS->GetVertexShader(), GRAPHICS->GetNormalMapPS(), nullptr, nullptr, nullptr, L"../Game/Assets/Art/2D/Textures/Maze_Ground.dds")); tempPitWall->GetRenderMesh()->SetNormals(L"../Game/Assets/Art/2D/Normal Maps/Rocky.dds"); tempPitWall->GetRenderMesh()->GetSpecular() = 1.5f; //try moving collider down //XMFLOAT3 newCenter = ((CAABB*)(tempPitWall->GetColliders()[0]->GetBounds()))->GetCenter(); //newCenter.y -= 20.0f; //((CAABB*)(tempPitWall->GetColliders()[0]->GetBounds()))->SetCenter(newCenter); m_cpEnvironmentObjects.push_back(tempPitWall); m_cpObjectManager->AddObject(tempPitWall, CObjectManager::eObjectType::Static); } else if (strcmp(prefix.c_str(), "Dor_") == 0)//door prefab { //tempMesh->ConvertVertices(); // //CDoorObject* tempDoor = new CDoorObject("Door"); ////tempDoor-> ////tempDoor-> // //m_cpEnvironmentObjects.push_back(tempDoor); // //m_cpObjectManager->AddObject(tempDoor, CObjectManager::eObjectType::Dynamic); } else if (strcmp(prefix.c_str(), "Pit_") == 0)//pit bottom prefab { tempMesh->ConvertVertices(); CPitObject* tempPit = new CPitObject("Pit"); tempPit->AddCollider(new CCollider(false, Bounds::Plane, tempMesh->GetVertices())); tempPit->SetRenderMesh(new CRenderMesh(tempMesh, GRAPHICS->GetVertexShader(), GRAPHICS->GetNormalMapPS(), nullptr, nullptr, nullptr, L"../Game/Assets/Art/2D/Textures/Maze_Ground.dds")); tempPit->GetRenderMesh()->SetNormals(L"../Game/Assets/Art/2D/Normal Maps/Rocky.dds"); tempPit->GetRenderMesh()->GetSpecular() = 1.5f; m_cpEnvironmentObjects.push_back(tempPit); m_cpObjectManager->AddObject(tempPit, CObjectManager::eObjectType::Static); } else if (strcmp(prefix.c_str(), "BPT_") == 0)//big pit bottom prefab { tempMesh->ConvertVertices(); CPitObject* tempBigPit = new CPitObject("BigPit"); tempBigPit->AddCollider(new CCollider(false, Bounds::Plane, tempMesh->GetVertices())); tempBigPit->SetRenderMesh(new CRenderMesh(tempMesh, GRAPHICS->GetVertexShader(), GRAPHICS->GetNormalMapPS(), nullptr, nullptr, nullptr, L"../Game/Assets/Art/2D/Textures/Maze_Ground.dds")); tempBigPit->GetRenderMesh()->SetNormals(L"../Game/Assets/Art/2D/Normal Maps/Rocky.dds"); tempBigPit->GetRenderMesh()->GetSpecular() = 1.5f; m_cpEnvironmentObjects.push_back(tempBigPit); m_cpBigPitObjects.push_back(tempBigPit); m_cpObjectManager->AddObject(tempBigPit, CObjectManager::eObjectType::Static); //now create teleporter for this bridge location XMFLOAT3 teleportPoint = { 0.0f, 0.0f, 0.0f }; if (((CPlane*)(tempBigPit->GetColliders()[0]->GetBounds()))->GetExtents().x > ((CPlane*)(tempBigPit->GetColliders()[0]->GetBounds()))->GetExtents().z) { teleportPoint.x = ((CPlane*)(tempBigPit->GetColliders()[0]->GetBounds()))->GetCenter().x + 1000.0f; teleportPoint.y = ((CPlane*)(tempBigPit->GetColliders()[0]->GetBounds()))->GetCenter().y + 1000.0f; teleportPoint.z = ((CPlane*)(tempBigPit->GetColliders()[0]->GetBounds()))->GetCenter().z; } else { teleportPoint.x = ((CPlane*)(tempBigPit->GetColliders()[0]->GetBounds()))->GetCenter().x; teleportPoint.y = ((CPlane*)(tempBigPit->GetColliders()[0]->GetBounds()))->GetCenter().y + 1000.0f; teleportPoint.z = ((CPlane*)(tempBigPit->GetColliders()[0]->GetBounds()))->GetCenter().z + 1000.0f; } CWaypointObject* bridgeTeleport = new CWaypointObject("BridgeTeleporter"); bridgeTeleport->SetPosition(teleportPoint); m_cpBridgeTeleporters.push_back(bridgeTeleport); } else if (strcmp(prefix.c_str(), "Ext_") == 0)//exit door { m_cvExitDoorMeshes.push_back(*tempMesh); } else if (strcmp(prefix.c_str(), "GFL_") == 0)//grass floor { tempMesh->ConvertVertices(); CFloorObject* tempGrassFloor = new CFloorObject("SafeHavenFloor"); tempGrassFloor->AddCollider(new CCollider(false, Bounds::Plane, tempMesh->GetVertices())); tempGrassFloor->SetRenderMesh(new CRenderMesh(tempMesh, GRAPHICS->GetVertexShader(), GRAPHICS->GetPixelShader(), nullptr, nullptr, nullptr, L"../Game/Assets/Art/2D/Textures/Ground_Grass.dds")); m_cpEnvironmentObjects.push_back(tempGrassFloor); m_cpObjectManager->AddObject(tempGrassFloor, CObjectManager::eObjectType::Static); } else if (strcmp(prefix.c_str(), "Skl_") == 0)//skeleton spawn point { tempMesh->ConvertVertices(); XMFLOAT3 tempPos = GetAABBCentroid(tempMesh->GetVertices()); CSpawnerObject* tempSpawner = new CSpawnerObject("SkeletonSpawn"); tempSpawner->GetSpawnPosition() = tempPos; m_cpSkeletonSpawnObjects.push_back(tempSpawner); } else if (strcmp(prefix.c_str(), "Orc_") == 0)//orc spawn point { tempMesh->ConvertVertices(); XMFLOAT3 tempPos = GetAABBCentroid(tempMesh->GetVertices()); CSpawnerObject* tempSpawner = new CSpawnerObject("OrcSpawn"); tempSpawner->GetSpawnPosition() = tempPos; m_cpOrcSpawnObjects.push_back(tempSpawner); } else if (strcmp(prefix.c_str(), "ECS_") == 0)//enemy cave spawners { } else if (strcmp(prefix.c_str(), "Min_") == 0)//minotaur spawn point { tempMesh->ConvertVertices(); XMFLOAT3 tempPos = GetAABBCentroid(tempMesh->GetVertices()); CSpawnerObject* tempSpawner = new CSpawnerObject("MinotaurSpawn"); tempSpawner->GetSpawnPosition() = tempPos; m_cpMinotaurSpawnObjects.push_back(tempSpawner); } else if (strcmp(prefix.c_str(), "Mpt_") == 0)//minotaur waypoints { #pragma region Minotaur Waypoints string tempName = " "; for (int i = 4; i < 30; i++) { tempName[i] = objName[i]; if ((int)objName[i] == 'e') { break; } } //get waypoint ID int firstNum = (int)tempName[4] - 48; int secondNum = (int)tempName[5] - 48; int thirdNum = (int)tempName[6] - 48; int WayPointID = (firstNum * 100) + (secondNum * 10) + thirdNum; //get adjacent waypoint IDs int AdjacentIDs[4] = { -1, -1, -1, -1 }; int nextAdjacent = 0; for (int i = 7; i < 30; i++) { if ((int)tempName[i] == '_') { nextAdjacent++; continue; } if ((int)tempName[i] == 'e') { break; } int firstNum = (int)tempName[i] - 48; int secondNum = (int)tempName[i + 1] - 48; int thirdNum = (int)tempName[i + 2] - 48; AdjacentIDs[nextAdjacent] = (firstNum * 100) + (secondNum * 10) + thirdNum; if (AdjacentIDs[nextAdjacent] >= 147) { break; } i += 2; } //create node tempMesh->ConvertVertices(); XMFLOAT3 tempPos = GetAABBCentroid(tempMesh->GetVertices()); CNode* tempNode = new CNode(WayPointID, tempPos); //create and add edges for (unsigned int i = 0; i < 4; i++) { if (AdjacentIDs[i] == -1) { continue; } tempNode->addEdge(new CEdge(1.0f, AdjacentIDs[i])); } //add node to navgraph m_cpMinotaurNavGraph->AddNode(tempNode); #pragma endregion } else if (strcmp(prefix.c_str(), "CWL_") == 0)//cracked wall location { //tempMesh->ConvertVertices(); //CCrackedWall* tempCrackedWall = new CCrackedWall("CrackedWall"); //tempCrackedWall->AddCollider(new CCollider(false, Bounds::AABB, tempMesh->GetVertices())); //tempCrackedWall->SetRenderMesh(new CRenderMesh(tempMesh->GetIndices(), tempMesh->GetVertices(), GRAPHICS->GetVertexShader(), GRAPHICS->GetPixelShader(), nullptr, nullptr, nullptr)); //m_cpEnvironmentObjects.push_back(tempCrackedWall); //m_cpObjectManager->AddObject(tempCrackedWall, CObjectManager::eObjectType::Static); } else if (strcmp(prefix.c_str(), "LWC_") == 0)//light weapon upgrade chest location { } else if (strcmp(prefix.c_str(), "HWC_") == 0)//heavy weapon upgrade chest location { } else if (strcmp(prefix.c_str(), "HUC_") == 0)//health upgrade chest location { } else if (strcmp(prefix.c_str(), "Tor_") == 0)//torch location { #pragma region Torches std::string tempName = " "; for (unsigned int i = 4; i < 12; i++) { tempName[i] = objName[i]; } XMFLOAT3 tiltDirection = { 0, 0, 0 }; //get x value int secondNum = (int)tempName[5] - 48; if (tempName[4] == 'n') { tiltDirection.x = -((float)secondNum); } else { tiltDirection.x = (float)secondNum; } //get y value secondNum = (int)tempName[8] - 48; if (tempName[7] == 'n') { tiltDirection.y = -((float)secondNum); } else { tiltDirection.y = (float)secondNum; } //get z value secondNum = (int)tempName[11] - 48; if (tempName[10] == 'n') { tiltDirection.z = -((float)secondNum); } else { tiltDirection.z = (float)secondNum; } tempMesh->ConvertVertices(); XMFLOAT3 tempPos = GetAABBCentroid(tempMesh->GetVertices()); m_cpTorchObjects.push_back(new CTorch(m_cpObjectManager, tempPos, tiltDirection)); #pragma endregion } else if (strcmp(prefix.c_str(), "STL_") == 0)//pressure plate spike trap { tempMesh->ConvertVertices(); XMFLOAT3 tempPos = GetAABBCentroid(tempMesh->GetVertices()); m_cpSpikeTrapObjects.push_back(new CSpikeTrap(tempPos, true, 0.0f, 1.0f)); } else if (strcmp(prefix.c_str(), "AST_") == 0)//alternating spike trap { std::string tempName = " "; for (unsigned int i = 4; i < 9; i++) { tempName[i] = objName[i]; } int firstNum = (int)tempName[4] - 48; int secondNum = (int)tempName[5] - 48; float startTime = (float)firstNum + ((float)secondNum / 10.0f); firstNum = (int)tempName[7] - 48; secondNum = (int)tempName[8] - 48; float offsetTime = (float)firstNum + ((float)secondNum / 10.0f); tempMesh->ConvertVertices(); XMFLOAT3 tempPos = GetAABBCentroid(tempMesh->GetVertices()); m_cpAltSpikeTrapObjects.push_back(new CSpikeTrap(tempPos, false, startTime, offsetTime)); } else if (strcmp(prefix.c_str(), "SBT_") == 0)//spinning blade trap { std::string tempName = " "; for (unsigned int i = 4; i < 7; i++) { tempName[i] = objName[i]; } int firstNum = (int)tempName[4] - 48; int secondNum = (int)tempName[5] - 48; float rotationTime = (float)firstNum + ((float)secondNum / 10.0f); tempMesh->ConvertVertices(); XMFLOAT3 tempPos = GetAABBCentroid(tempMesh->GetVertices()); m_cpSpinningBladeObjects.push_back(new CSpinningBlade(tempPos, rotationTime)); } else if (strcmp(prefix.c_str(), "FTE_") == 0)//fire trap emmiter { #pragma region Fire Trap std::string tempName = " "; for (unsigned int i = 4; i < 12; i++) { tempName[i] = objName[i]; } XMFLOAT3 fireDirection = { 0, 0, 0 }; int secondNum = (int)tempName[5] - 48; if (tempName[4] == 'n') { fireDirection.x = -((float)secondNum); } else { fireDirection.x = (float)secondNum; } secondNum = (int)tempName[8] - 48; if (tempName[7] == 'n') { fireDirection.y = -((float)secondNum); } else { fireDirection.y = (float)secondNum; } secondNum = (int)tempName[11] - 48; if (tempName[10] == 'n') { fireDirection.z = -((float)secondNum); } else { fireDirection.z = (float)secondNum; } tempMesh->ConvertVertices(); XMFLOAT3 tempPos = GetAABBCentroid(tempMesh->GetVertices()); m_cpFireTrapObjects.push_back(new CFireTrap(m_cpObjectManager, tempPos, fireDirection)); #pragma endregion } else if (strcmp(prefix.c_str(), "Tre_") == 0)//cuttable trees { } else if (strcmp(prefix.c_str(), "Bsh_") == 0)//bushes { tempMesh->ConvertVertices(); XMFLOAT3 tempPos = GetAABBCentroid(tempMesh->GetVertices()); m_cpBushObjects.push_back(new CBush(m_cpObjectManager, tempPos)); } else if (strcmp(prefix.c_str(), "EDT_") == 0)//exit door teleporters { m_cvExitTeleporterMeshes.push_back(*tempMesh); } else if (strcmp(prefix.c_str(), "Inv_") == 0)//invisible walls { tempMesh->ConvertVertices(); CWallObject* tempWall = new CWallObject("Wall"); tempWall->AddCollider(new CCollider(false, Bounds::AABB, tempMesh->GetVertices())); tempWall->SetRenderMesh(new CRenderMesh(tempMesh, GRAPHICS->GetVertexShader(), GRAPHICS->GetPixelShader())); tempWall->GetRenderMesh()->GetRender() = false; m_cpInvisibleWallObjects.push_back(tempWall); m_cpObjectManager->AddObject(tempWall, CObjectManager::eObjectType::Static); } else if (strcmp(prefix.c_str(), "Kil_") == 0)//kill floor { tempMesh->ConvertVertices(); CFloorObject* tempFloor = new CFloorObject("KillFloor"); tempFloor->AddCollider(new CCollider(false, Bounds::Plane, tempMesh->GetVertices())); tempFloor->SetRenderMesh(new CRenderMesh(tempMesh, GRAPHICS->GetVertexShader(), GRAPHICS->GetPixelShader())); tempFloor->GetRenderMesh()->GetRender() = false; m_cpKillFloorObjects.push_back(tempFloor); m_cpObjectManager->AddObject(tempFloor, CObjectManager::eObjectType::Static); } else { meshes.push_back(*tempMesh); } attributeMesh->Destroy(); delete tempMesh; } } for (int i = 0; i < node->GetChildCount(); i++) { ProcessLevelNode(node->GetChild(i), meshes); } return true; }