mirror of
https://github.com/PorktoberRevolution/ReStocked
synced 2024-09-01 17:34:42 +00:00
Use for loops instead of foreach loops to minimize GC
This commit is contained in:
parent
2a43d6d6b3
commit
516e0829a5
Binary file not shown.
@ -150,10 +150,10 @@ namespace Restock
|
||||
_propertyBlock.SetColor(_shaderBlackbodyID, Color.black);
|
||||
|
||||
}
|
||||
|
||||
foreach (var r in renderers)
|
||||
|
||||
for (var i = 0; i < renderers.Count; i++)
|
||||
{
|
||||
r.SetPropertyBlock(_propertyBlock);
|
||||
renderers[i].SetPropertyBlock(_propertyBlock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -312,11 +312,11 @@ namespace Restock
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var m in _modules)
|
||||
}
|
||||
|
||||
for (var i = 0; i < _modules.Count; i++)
|
||||
{
|
||||
if (m.ModuleIsActive())
|
||||
if (_modules[i].ModuleIsActive())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -100,10 +100,12 @@ namespace Restock
|
||||
texScale[pipeStretchIndex] = stretch;
|
||||
texOffset[pipeStretchIndex] = (1 - stretch) / 2;
|
||||
|
||||
foreach (var material in pipeMaterials)
|
||||
for (var i = 0; i < pipeMaterials.Length; i++)
|
||||
{
|
||||
foreach (var id in pipeMaterialIDs)
|
||||
var material = pipeMaterials[i];
|
||||
for (var j = 0; j < pipeMaterialIDs.Length; j++)
|
||||
{
|
||||
var id = pipeMaterialIDs[j];
|
||||
material.SetTextureScale(id, texScale);
|
||||
material.SetTextureOffset(id, texOffset);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user