void cTerrainGen3D::BuildStairs(const tVector& origin, const tVector& ground_size, const Eigen::VectorXd& params, cRand& rand, std::vector<float>& out_data, std::vector<int>& out_flags) { double spacing_min = params[eParamsStepSpacingMin]; double spacing_max = params[eParamsStepSpacingMax]; double step_h_min = params[eParamsStepHeightMin]; double step_h_max = params[eParamsStepHeightMax]; Eigen::Vector2i start_coord = Eigen::Vector2i::Zero(); Eigen::Vector2i out_res = Eigen::Vector2i::Zero(); out_res[0] = CalcResX(ground_size[0]); out_res[1] = CalcResZ(ground_size[1]); return AddStairs(origin, start_coord, ground_size, spacing_min, spacing_max, step_h_min, step_h_max, out_res, rand, out_data, out_flags); }
GameEntitiesContainer EntityFactory::CreateLevel1(GameEntitiesContainer container, PlayerComponent *player, AIEntitiesInteractionContainer aiEntitiesContainer) { int height = 25; int width = 50; int length = 50; // Create the bounding walls and floor // F1 container = AddFloor( width , length, D3DXVECTOR3(0,0,0) , container); // W1 container = AddWall( height, width, D3DXVECTOR3(0,0,0), container, true); // W2 container = AddWall( height,length, D3DXVECTOR3(0,0,0) , container, false); // W3 container = AddWall( height,width, D3DXVECTOR3( 49, 0,0), container, true); // W4 container = AddWall(height,length, D3DXVECTOR3(0,0, 49 ), container, false); // F2 container = AddFloor( width,length , D3DXVECTOR3(0,24 , 0), container); // Containing walls // W5 container = AddWall( height, 26, D3DXVECTOR3(3 , 0, 0) , container, true); // W6 container = AddWall( (int)(height/2), 18 , D3DXVECTOR3( 3 , 0 , 25 ), container, false); // W7 container = AddWall( height, 7, D3DXVECTOR3( 24 , 0 , 25 ), container, false); // W8 container = AddWall( (int)(height / 2), 8 , D3DXVECTOR3( 30 , 0, 25 ), container, false); // W9 container = AddWall( height, 10 , D3DXVECTOR3( 37 , 0, 25 ) , container, false); // W10 container = AddWall( height, 22, D3DXVECTOR3( 46 , 0, 4 ), container, true); // W11 container = AddWall( height, 26, D3DXVECTOR3( 21 , 0, 4 ), container, false); // W12 container = AddWall( height, 5, D3DXVECTOR3( 21 , 0, 0), container, true, "Textures/door.png"); // S1 container = AddStairs( 6, 4, D3DXVECTOR3( 20 , 0 , 25 ), container, 4, false); // Plateau for staircase container = AddFloor( 5 , 5 , D3DXVECTOR3( 20 , 6 , 16 ), container ); // Second half of staircase container = AddStairs( 6, 1, D3DXVECTOR3( 24 , 6 , 16 ), container , 4, true); // Right for 2nd floor container = AddWall( height, 10 , D3DXVECTOR3( 20 , 0 , 16 ), container, true); // Left stair wall container = AddWall( height, 6, D3DXVECTOR3( 24 , 0, 20 ), container, true); // W27 container = AddWall( height, 6, D3DXVECTOR3( 30 , 0, 20 ), container, true); // container = AddWall( height, 7, D3DXVECTOR3( 24 , 0, 20 ), container, false); // 2nd floor at top of stairs container = AddFloor( 22 , 8, D3DXVECTOR3( 30 , (int)(height / 2) , 4 ), container); // container = AddWall( height, 11, D3DXVECTOR3(20 , 0, 16 ), container, false); // W21 container = AddWall( (int)(height / 2) , 21 , D3DXVECTOR3( 37 , (int)(height / 2) , 5 ), container, true); // W22 container = AddWall( (int)(height / 2) , 8, D3DXVECTOR3(30 , (int)(height / 2) , 4 ), container, true); // W23 container = AddWall( (int)(height / 2) , 18, D3DXVECTOR3(13 , (int)(height / 2) , 11 ), container, false); // W24 container = AddWall( (int)(height / 2) , 30, D3DXVECTOR3( 13 , (int)(height / 2) , 11 ), container, true); // W25 container = AddWall(( int)(height / 2), 16, D3DXVECTOR3( 20 , (int)(height / 2) , 25 ), container, true); // Floor for previous walls container = AddFloor( 6, 18 , D3DXVECTOR3( 13 , (int)(height/2) , 11 ), container); container = AddFloor( 14, 8, D3DXVECTOR3( 13 , (int)(height/2) , 16 ), container); // Add floor extending into main room container = AddFloor(8 , 2, D3DXVECTOR3( 19 , (int)(height/2) , 29 ), container); container = AddFloor(8 , 2, D3DXVECTOR3( 13 , (int)(height / 2) , 29 ), container); container = AddFloor(5 , 8, D3DXVECTOR3(13 , (int)(height / 2) , 36 ), container); // W26 container = AddWall(height, 47 , D3DXVECTOR3( 0, 0, 40 ), container, false); // W27 container = AddWall(height, 2, D3DXVECTOR3( 46 , 0 , 40 ), container, true); // W28 container = AddWall( height, 47, D3DXVECTOR3( 0, 0, 41 ), container, false); vector<D3DRECT> collisions; D3DRECT c1; c1.x1 = 3*20; c1.y1 = 0; c1.x2 = 16*20; c1.y2 = 26*20; //collisions.push_back(c1); AStarPathfindingGraph* graph = PathfindingUtil::CreateAStarGraphFromFloors(50, 50, 20, 20, D3DXVECTOR3(0, 0, 0), collisions); //create AI controller character GameEntity* aiEntity1 = this->CreateAIEntity( &container, D3DXVECTOR3(400, 60, 700), D3DXVECTOR3(10, 40, 10), 5, D3DCOLOR_RGBA(255, 0, 0, 255), 0, BasicEnemy, aiEntitiesContainer, graph, player); GameEntity* aiEntity2 = this->CreateAIEntity( &container, D3DXVECTOR3(700, 60, 700), D3DXVECTOR3(10, 40, 10), 5, D3DCOLOR_RGBA(0, 255, 0, 255), 1, RangedEnemy, aiEntitiesContainer, graph, player); GameEntity* aiEntity3 = this->CreateAIEntity( &container, D3DXVECTOR3(350, 60, 700), D3DXVECTOR3(10, 40, 10), 5, D3DCOLOR_RGBA(255, 0, 0, 255), 2, BasicEnemy, aiEntitiesContainer, graph, player); GameEntity* aiEntity4 = this->CreateAIEntity( &container, D3DXVECTOR3(650, 60, 650), D3DXVECTOR3(10, 40, 10), 5, D3DCOLOR_RGBA(0, 255, 0, 255), 3, RangedEnemy, aiEntitiesContainer, graph, player); GameEntity* aiEntity5 = this->CreateAIEntity( &container, D3DXVECTOR3(550, 60, 550), D3DXVECTOR3(10, 40, 10), 5, D3DCOLOR_RGBA(255, 0, 0, 255), 4, BasicEnemy, aiEntitiesContainer, graph, player); GameEntity* aiEntity6 = this->CreateAIEntity( &container, D3DXVECTOR3(600, 60, 650), D3DXVECTOR3(10, 40, 10), 5, D3DCOLOR_RGBA(0, 0, 255, 255), 4, HealerEnemy, aiEntitiesContainer, graph, player); //GameEntity* aiEntity6 = this->CreateAIEntity(&container, D3DXVECTOR3(650, 60, 700), D3DXVECTOR3(10, 40, 10), D3DCOLOR_RGBA(0, 255, 0, 255), 5, RangedEnemy, aiEntitiesContainer, graph); return container; }