@@ -14,32 +14,55 @@ void PlayerEntity::handleAttack(glm::vec3 dir, float power)
1414{
1515}
1616
17- PlayerController::PlayerController ()
17+ PlayerController::PlayerController (EnemyTeam team )
1818{
19+ Team = team;
20+ std::string unitFolder = " textures/Units/NonColor Units/" ;
1921
20- auto texture = brl::GfxTexture2d::loadTexture (" textures/Units/Yellow Units/ Warrior/Warrior_Idle.png" );
21- auto walkTexture = brl::GfxTexture2d::loadTexture (" textures/Units/Yellow Units/ Warrior/Warrior_Run.png" );
22- auto attackTexture = brl::GfxTexture2d::loadTexture (" textures/Units/Yellow Units/ Warrior/Warrior_Attack1.png" );
23- auto guardTexture = brl::GfxTexture2d::loadTexture (" textures/Units/Yellow Units/ Warrior/Warrior_Guard.png" );
22+ auto texture = brl::GfxTexture2d::loadTexture (unitFolder + " Warrior/Warrior_Idle.png" );
23+ auto walkTexture = brl::GfxTexture2d::loadTexture (unitFolder + " Warrior/Warrior_Run.png" );
24+ auto attackTexture = brl::GfxTexture2d::loadTexture (unitFolder + " Warrior/Warrior_Attack1.png" );
25+ auto guardTexture = brl::GfxTexture2d::loadTexture (unitFolder + " Warrior/Warrior_Guard.png" );
2426 idleSprites = brl::GfxSprite::extractSpritesToArray (texture, 192 , 192 , true );
2527 walkSprites = brl::GfxSprite::extractSpritesToArray (walkTexture, 192 , 192 , true );
2628 attackSprites = brl::GfxSprite::extractSpritesToArray (attackTexture, 192 , 192 , true );
2729 guardSprites = brl::GfxSprite::extractSpritesToArray (guardTexture, 192 , 192 , true );
2830
31+
2932 auto shaderBins = new brl::GfxShader*[2 ];
3033
31- shaderBins[0 ] = new brl::GfxShader (GL_VERTEX_SHADER, brl::readFileString (" shaders/test/vtx.glsl " ));
32- shaderBins[1 ] = new brl::GfxShader (GL_FRAGMENT_SHADER, brl::readFileString (" shaders/test/frg.glsl " ));
34+ shaderBins[0 ] = new brl::GfxShader (GL_VERTEX_SHADER, brl::readFileString (" shaders/enemy/enemy.vert " ));
35+ shaderBins[1 ] = new brl::GfxShader (GL_FRAGMENT_SHADER, brl::readFileString (" shaders/enemy/enemy.frag " ));
3336 auto shader = new brl::GfxShaderProgram (shaderBins, 2 , true );
3437
35-
3638 material = new brl::GfxMaterial (shader);
3739 // material->setVec3("color", brl::vector3{1,0,0});
3840 material->setTexture (" idleSprite" , idleSprites);
3941 material->setTexture (" walkSprite" , walkSprites);
4042 material->setTexture (" attackSprite" , attackSprites);
4143 material->setTexture (" guardSprite" , guardSprites);
4244
45+ glm::vec3 v;
46+ switch (Team)
47+ {
48+
49+ case Red:
50+ v = glm::vec3 (212 , 28 , 64 );
51+ break ;
52+ case Blue:
53+ v = glm::vec3 (66 , 93 , 245 );
54+ break ;
55+ case Yellow:
56+ v = glm::vec3 (245 , 188 , 66 );
57+ break ;
58+ case Black:
59+ v = glm::vec3 (28 , 36 , 48 );
60+ break ;
61+ }
62+ material->setVec3 (" _color" , v);
63+ material->setVec3 (" _armorColor" , glm::vec3 (239 , 225 , 171 ));
64+ material->setVec3 (" _weaponColor" , glm::vec3 (212 , 237 , 194 ));
65+
4366 renderer = new brl::GfxMeshRenderer ();
4467 renderer->mesh = brl::GfxMesh::GetPrimitive (brl::QUAD);
4568 renderer->setMaterial (material);
0 commit comments