diff --git a/resources/Schema/Entities/CapturePointTest b/resources/Schema/Entities/CapturePointTest deleted file mode 100644 index 669d5032..00000000 --- a/resources/Schema/Entities/CapturePointTest +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/resources/Schema/Entities/CaptureTest.xml b/resources/Schema/Entities/CaptureTest.xml new file mode 100644 index 00000000..fef6c839 --- /dev/null +++ b/resources/Schema/Entities/CaptureTest.xml @@ -0,0 +1,149 @@ + + + + + + + + + + + + ../assets/Models/DummyScene.obj + + + + + + + + + 60 + + + + + + + 3 + + + + + + + + + + + + + + ../assets/Models/Core/UnitSphere.obj + + + + 3 + + + + + + + + + + + + + 1 + + + ../assets/Models/Core/UnitSphere.obj + + + + + + + + + + + + + + + 2 + + + ../assets/Models/Core/UnitSphere.obj + + + + + + + + + + + + + + + 3 + + + ../assets/Models/Core/UnitSphere.obj + + + + 2 + + + + + + + + + + + + + + ../assets/Models/Core/UnitCube.obj + + + + + 2 + + + + + + + + + + + + + ../assets/Models/Core/UnitCube.obj + + + + + 3 + + + + + + + + + + diff --git a/src/Game/Systems/CapturePointSystem.cpp b/src/Game/Systems/CapturePointSystem.cpp index 4fd91690..af82e95a 100644 --- a/src/Game/Systems/CapturePointSystem.cpp +++ b/src/Game/Systems/CapturePointSystem.cpp @@ -60,7 +60,13 @@ void CapturePointSystem::UpdateComponent(World* world, EntityWrapper& entity, Co } int ownedBy = teamComponent["Team"]; - + //Probably want to distinguish the capturepoint depending on team affiliation. + if (entity.HasComponent("Model")) { + //Now sets team color to the capturepoint, or white if it is uncaptured. + entity["Model"]["Color"] = ownedBy == blueTeam ? glm::vec4(0, 0.2f, 1, 1) : + ownedBy == redTeam ? glm::vec4(1, 0.2f, 0, 1) : + glm::vec4(1, 1, 1, 1); + } //om ej next satt, förvänta sig att en capturepoint med en viss team färg kommer in... //sätt isåfall next och kör på.. //gör inget tills man fått den infon @@ -109,6 +115,9 @@ void CapturePointSystem::UpdateComponent(World* world, EntityWrapper& entity, Co //B. at most one of the teams have players inside (this means datavariable currentTeam is not 0) //if capturePoint is not owned by the take-over team, just modify the CaptureTimer accordingly if (ownedBy != currentTeam) { + if (abs((double)capturePoint["CaptureTimer"]) < 0.001f) { + LOG_DEBUG("Point is being captured by team %i", currentTeam); //Remove when we tested sufficiently. + } capturePoint["CaptureTimer"] = (double)capturePoint["CaptureTimer"] + timerDeltaChange; } //if capturePoint is owned by the team, and the other team has been trying to take it, then increase/decrease the timer towards 0.0 @@ -121,6 +130,7 @@ void CapturePointSystem::UpdateComponent(World* world, EntityWrapper& entity, Co teamComponent["Team"] = currentTeam; capturePoint["CaptureTimer"] = 0.0; //publish Captured event + LOG_DEBUG("Point is captured by team %i!", currentTeam); //Remove when we tested sufficiently. Events::Captured e; e.CapturePointID = capturePoint.EntityID; e.TeamNumberThatCapturedCapturePoint = currentTeam;