Hi there!
I have 2 teams A and B. There is also a zone on the map, if you get into it (only to one team), then the timer decreases from 10 seconds and when the value is 0, a certain action occurs. This zone works through OnTriggerStay.
I have difficulties with this:
When one player enters this zone, then everything is ok, the timer tends from 10 seconds to 0 at normal speed, BUT, when another player comes in from the same team, then the timer passes twice as fast.
Piece of code:
private double _timeToNewScore = 10f;
private double _time;
private void OnTriggerStay(Collider other)
{
if (hasCapturedOne)
{
foreach (Health p in team1players)
{
ScorePointsFromPeriod(1);
}
private void ScorePointsFromPeriod(int team)
{
_time += Time.deltaTime;
if (_time >= _timeToNewScore)
{
DoSomething();
}
}
Please, help me)