Removed membervariable m_NextPossibleCapturePointand added it as local instead
This commit is contained in:
@@ -44,7 +44,6 @@ private:
|
||||
|
||||
//std::vector<ComponentWrapper>
|
||||
|
||||
std::map<std::string, int> m_NextPossibleCapturePoint;
|
||||
const double m_CaptureTimeToTakeOver = 15.0;
|
||||
|
||||
//vectors which will keep track of enter/leave changes
|
||||
|
||||
@@ -5,52 +5,6 @@
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
|
||||
<Children>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Health/>
|
||||
<c:AABB/>
|
||||
<c:Player/>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:AABB/>
|
||||
<c:CapturePoint>
|
||||
<CaptureTimer>-0.049999997019767761</CaptureTimer>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitBox.obj</Resource>
|
||||
</c:Model>
|
||||
<c:Team/>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="-1.3012079"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Camera/>
|
||||
<c:Listener/>
|
||||
<c:Transform>
|
||||
<Position X="-3.49205208" Y="1.56239843" Z="0.419225603"/>
|
||||
<Orientation X="-0.296706051" Y="-0.87263751" Z="1.15912798e-07"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/DummyScene.obj</Resource>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
<Children/>
|
||||
|
||||
</Entity>
|
||||
|
||||
@@ -57,34 +57,35 @@ void CapturePointSystem::UpdateComponent(World* world, EntityWrapper& entity, Co
|
||||
}
|
||||
|
||||
//calculate next possible capturePoint for both teams
|
||||
m_NextPossibleCapturePoint["Red"] = -1;
|
||||
m_NextPossibleCapturePoint["Blue"] = -1;
|
||||
std::map<std::string, int> nextPossibleCapturePoint;
|
||||
nextPossibleCapturePoint["Red"] = -1;
|
||||
nextPossibleCapturePoint["Blue"] = -1;
|
||||
for (size_t i = 0; i < m_NumberOfCapturePoints; i++)
|
||||
{
|
||||
ComponentWrapper& capturePointOwnedBy = world->GetComponent(m_CapturePointNumberToEntityIDMap[i], "Team");
|
||||
if ((int)capturePointOwnedBy["Team"] == redTeam && m_RedTeamHomeCapturePoint == 0) {
|
||||
m_NextPossibleCapturePoint["Red"] = i + 1;
|
||||
nextPossibleCapturePoint["Red"] = i + 1;
|
||||
}
|
||||
if ((int)capturePointOwnedBy["Team"] == blueTeam && m_BlueTeamHomeCapturePoint == 0) {
|
||||
m_NextPossibleCapturePoint["Blue"] = i + 1;
|
||||
nextPossibleCapturePoint["Blue"] = i + 1;
|
||||
}
|
||||
}
|
||||
for (int i = m_NumberOfCapturePoints - 1; i >= 0; i--)
|
||||
{
|
||||
ComponentWrapper& capturePointOwnedBy = world->GetComponent(m_CapturePointNumberToEntityIDMap[i], "Team");
|
||||
if ((int)capturePointOwnedBy["Team"] == redTeam && m_RedTeamHomeCapturePoint != 0) {
|
||||
m_NextPossibleCapturePoint["Red"] = i - 1;
|
||||
nextPossibleCapturePoint["Red"] = i - 1;
|
||||
}
|
||||
if ((int)capturePointOwnedBy["Team"] == blueTeam && m_BlueTeamHomeCapturePoint != 0) {
|
||||
m_NextPossibleCapturePoint["Blue"] = i - 1;
|
||||
nextPossibleCapturePoint["Blue"] = i - 1;
|
||||
}
|
||||
}
|
||||
|
||||
//colorize next possible capturepoint
|
||||
if (m_NextPossibleCapturePoint["Red"] == capturePointNumber) {
|
||||
if (nextPossibleCapturePoint["Red"] == capturePointNumber) {
|
||||
entity["Model"]["Color"] = glm::vec4(1, 1, 0, 1);
|
||||
}
|
||||
if (m_NextPossibleCapturePoint["Blue"] == capturePointNumber) {
|
||||
if (nextPossibleCapturePoint["Blue"] == capturePointNumber) {
|
||||
entity["Model"]["Color"] = glm::vec4(0, 1, 1, 1);
|
||||
}
|
||||
|
||||
@@ -127,12 +128,12 @@ void CapturePointSystem::UpdateComponent(World* world, EntityWrapper& entity, Co
|
||||
if (redTeamPlayersStandingInside > 0 && blueTeamPlayersStandingInside == 0) {
|
||||
timerDeltaChange = redTeamPlayersStandingInside*dt;
|
||||
currentTeam = redTeam;
|
||||
canCapture = m_NextPossibleCapturePoint["Red"] == capturePointNumber;
|
||||
canCapture = nextPossibleCapturePoint["Red"] == capturePointNumber;
|
||||
}
|
||||
if (redTeamPlayersStandingInside == 0 && blueTeamPlayersStandingInside > 0) {
|
||||
timerDeltaChange = -blueTeamPlayersStandingInside*dt;
|
||||
currentTeam = blueTeam;
|
||||
canCapture = m_NextPossibleCapturePoint["Blue"] == capturePointNumber;
|
||||
canCapture = nextPossibleCapturePoint["Blue"] == capturePointNumber;
|
||||
}
|
||||
|
||||
if (redTeamPlayersStandingInside == 0 && blueTeamPlayersStandingInside == 0) {
|
||||
|
||||
Reference in New Issue
Block a user