Removed membervariable m_NextPossibleCapturePointand added it as local instead
This commit is contained in:
@@ -44,7 +44,6 @@ private:
|
|||||||
|
|
||||||
//std::vector<ComponentWrapper>
|
//std::vector<ComponentWrapper>
|
||||||
|
|
||||||
std::map<std::string, int> m_NextPossibleCapturePoint;
|
|
||||||
const double m_CaptureTimeToTakeOver = 15.0;
|
const double m_CaptureTimeToTakeOver = 15.0;
|
||||||
|
|
||||||
//vectors which will keep track of enter/leave changes
|
//vectors which will keep track of enter/leave changes
|
||||||
|
|||||||
@@ -5,52 +5,6 @@
|
|||||||
<c:Transform/>
|
<c:Transform/>
|
||||||
</Components>
|
</Components>
|
||||||
|
|
||||||
<Children>
|
<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>
|
|
||||||
|
|
||||||
</Entity>
|
</Entity>
|
||||||
|
|||||||
@@ -57,34 +57,35 @@ void CapturePointSystem::UpdateComponent(World* world, EntityWrapper& entity, Co
|
|||||||
}
|
}
|
||||||
|
|
||||||
//calculate next possible capturePoint for both teams
|
//calculate next possible capturePoint for both teams
|
||||||
m_NextPossibleCapturePoint["Red"] = -1;
|
std::map<std::string, int> nextPossibleCapturePoint;
|
||||||
m_NextPossibleCapturePoint["Blue"] = -1;
|
nextPossibleCapturePoint["Red"] = -1;
|
||||||
|
nextPossibleCapturePoint["Blue"] = -1;
|
||||||
for (size_t i = 0; i < m_NumberOfCapturePoints; i++)
|
for (size_t i = 0; i < m_NumberOfCapturePoints; i++)
|
||||||
{
|
{
|
||||||
ComponentWrapper& capturePointOwnedBy = world->GetComponent(m_CapturePointNumberToEntityIDMap[i], "Team");
|
ComponentWrapper& capturePointOwnedBy = world->GetComponent(m_CapturePointNumberToEntityIDMap[i], "Team");
|
||||||
if ((int)capturePointOwnedBy["Team"] == redTeam && m_RedTeamHomeCapturePoint == 0) {
|
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) {
|
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--)
|
for (int i = m_NumberOfCapturePoints - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
ComponentWrapper& capturePointOwnedBy = world->GetComponent(m_CapturePointNumberToEntityIDMap[i], "Team");
|
ComponentWrapper& capturePointOwnedBy = world->GetComponent(m_CapturePointNumberToEntityIDMap[i], "Team");
|
||||||
if ((int)capturePointOwnedBy["Team"] == redTeam && m_RedTeamHomeCapturePoint != 0) {
|
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) {
|
if ((int)capturePointOwnedBy["Team"] == blueTeam && m_BlueTeamHomeCapturePoint != 0) {
|
||||||
m_NextPossibleCapturePoint["Blue"] = i - 1;
|
nextPossibleCapturePoint["Blue"] = i - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//colorize next possible capturepoint
|
//colorize next possible capturepoint
|
||||||
if (m_NextPossibleCapturePoint["Red"] == capturePointNumber) {
|
if (nextPossibleCapturePoint["Red"] == capturePointNumber) {
|
||||||
entity["Model"]["Color"] = glm::vec4(1, 1, 0, 1);
|
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);
|
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) {
|
if (redTeamPlayersStandingInside > 0 && blueTeamPlayersStandingInside == 0) {
|
||||||
timerDeltaChange = redTeamPlayersStandingInside*dt;
|
timerDeltaChange = redTeamPlayersStandingInside*dt;
|
||||||
currentTeam = redTeam;
|
currentTeam = redTeam;
|
||||||
canCapture = m_NextPossibleCapturePoint["Red"] == capturePointNumber;
|
canCapture = nextPossibleCapturePoint["Red"] == capturePointNumber;
|
||||||
}
|
}
|
||||||
if (redTeamPlayersStandingInside == 0 && blueTeamPlayersStandingInside > 0) {
|
if (redTeamPlayersStandingInside == 0 && blueTeamPlayersStandingInside > 0) {
|
||||||
timerDeltaChange = -blueTeamPlayersStandingInside*dt;
|
timerDeltaChange = -blueTeamPlayersStandingInside*dt;
|
||||||
currentTeam = blueTeam;
|
currentTeam = blueTeam;
|
||||||
canCapture = m_NextPossibleCapturePoint["Blue"] == capturePointNumber;
|
canCapture = nextPossibleCapturePoint["Blue"] == capturePointNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (redTeamPlayersStandingInside == 0 && blueTeamPlayersStandingInside == 0) {
|
if (redTeamPlayersStandingInside == 0 && blueTeamPlayersStandingInside == 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user