public void resetPositions(float duration = -1, bool resetTime = true) { duration = (duration == -1) ? goalResetDuration : duration; //use goalResetDuration as the default int[] indicies = new int[leftPoints.Length]; for (int i = 0; i < indicies.Length; i++) { indicies[i] = i; } indicies.Shuffle <int>(); int leftPointsIndex = 0; int rightPointsIndex = 0; for (int i = 0; i < players.Length; i++) { Transform t = players[i]; switch (t.GetComponent <Stats>().side) { case Side.LEFT: t.GetComponent <ResetScripting>().Reset(leftPoints[indicies[leftPointsIndex]], duration); leftPointsIndex++; break; case Side.RIGHT: t.GetComponent <ResetScripting>().Reset(rightPoints[indicies[rightPointsIndex]], duration); rightPointsIndex++; break; } } puck.Respawn(puckRespawnPoint.position); if (resetTime) { Callback.FireAndForget(() => timer.running = true, duration, this); } }