Fixed rods not recoloring (#441)

This commit is contained in:
Rapandrasmus 2023-05-29 01:40:27 +02:00 committed by GitHub
parent 7ed0e3fafc
commit 966f0a3e6d
1 changed files with 14 additions and 0 deletions

View File

@ -97,6 +97,7 @@ namespace HeavenStudio.Games
private Material[] gridMaterials; private Material[] gridMaterials;
private Material[] firstPatternLights; private Material[] firstPatternLights;
private Material[] secondPatternLights; private Material[] secondPatternLights;
private Material[] elevatorObjectMats;
[Header("Properties")] [Header("Properties")]
[SerializeField] float beltSpeed = 1f; [SerializeField] float beltSpeed = 1f;
@ -127,6 +128,15 @@ namespace HeavenStudio.Games
elevatorMaterials = elevatorRenderer.materials; elevatorMaterials = elevatorRenderer.materials;
beltMaterial = Instantiate(environmentMaterials[8]); beltMaterial = Instantiate(environmentMaterials[8]);
environmentMaterials[8] = beltMaterial; environmentMaterials[8] = beltMaterial;
elevatorObjectMats = new Material[]
{
Instantiate(elevatorMaterials[0]),
Instantiate(elevatorMaterials[1]),
Instantiate(elevatorMaterials[2]),
};
elevatorMaterials[0] = elevatorObjectMats[0];
elevatorMaterials[1] = elevatorObjectMats[1];
elevatorMaterials[2] = elevatorObjectMats[2];
elevatorMaterial = Instantiate(elevatorMaterials[3]); elevatorMaterial = Instantiate(elevatorMaterials[3]);
elevatorMaterials[3] = elevatorMaterial; elevatorMaterials[3] = elevatorMaterial;
gridMaterials = new Material[] gridMaterials = new Material[]
@ -199,6 +209,10 @@ namespace HeavenStudio.Games
{ {
mat.SetColor("_Color", currentEnvironmentColor); mat.SetColor("_Color", currentEnvironmentColor);
} }
foreach (var mat in elevatorObjectMats)
{
mat.SetColor("_Color", currentObjectColor);
}
if (!lighting) if (!lighting)
{ {
foreach (var mat in firstPatternLights) foreach (var mat in firstPatternLights)