From 088cee167b0f1c68c4dfecee64c06a11c6b14208 Mon Sep 17 00:00:00 2001 From: Fernando Cortez Date: Fri, 9 Dec 2022 17:31:31 -0500 Subject: [PATCH] random offset to ingredient spawns to prevent stacking --- Basic/ClientDriven/Assets/Scripts/ServerIngredientSpawner.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Basic/ClientDriven/Assets/Scripts/ServerIngredientSpawner.cs b/Basic/ClientDriven/Assets/Scripts/ServerIngredientSpawner.cs index f16aaf2b6..631cf83a9 100644 --- a/Basic/ClientDriven/Assets/Scripts/ServerIngredientSpawner.cs +++ b/Basic/ClientDriven/Assets/Scripts/ServerIngredientSpawner.cs @@ -52,7 +52,8 @@ void FixedUpdate() foreach (var spawnPoint in m_SpawnPoints) { var newIngredientObject = Instantiate(m_IngredientPrefab, spawnPoint.transform.position, spawnPoint.transform.rotation); - newIngredientObject.transform.position = spawnPoint.transform.position; + newIngredientObject.transform.position = spawnPoint.transform.position + + new Vector3(UnityEngine.Random.Range(-0.25f, 0.25f), 0, UnityEngine.Random.Range(-0.25f, 0.25f)); var ingredient = newIngredientObject.GetComponent(); ingredient.NetworkObject.Spawn(); ingredient.currentIngredientType.Value = (IngredientType)m_RandomGenerator.Next((int)IngredientType.MAX);