From 78b679ac01bcbc31d1b466c9419310fe42e73d03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20Gervais?= Date: Fri, 8 Apr 2016 09:13:58 -0400 Subject: [PATCH] =?UTF-8?q?Restaurer=20les=20plateformes=20=C3=A0=20leur?= =?UTF-8?q?=20=C3=A9tat=20normal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/PlanetManager.cs | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/PlanetManager.cs b/Assets/Scripts/PlanetManager.cs index 37ced3d..7e37f15 100644 --- a/Assets/Scripts/PlanetManager.cs +++ b/Assets/Scripts/PlanetManager.cs @@ -8,9 +8,9 @@ public class PlanetManager : MonoBehaviour public int NbCartiers = 10; public float TailleCartiersEnDegres = 0; //radian -> valeurs 0 a 360 - + public float CartierResetRatioSpeedFactor = 1.0f; + public bool CartierResetRatioSpeedRandomize = false; public GameObject WedgePrefab = null; - public List wedges = new List(); @@ -49,7 +49,34 @@ public class PlanetManager : MonoBehaviour foreach (var w in wedges) { + if (w.offset <= 1.05f && w.offset >= 0.95f) + { + w.offset = 1.0f; + } + else if (w.offset > 1.0f) + { + if (!CartierResetRatioSpeedRandomize) + { + w.offset -= 0.005f*CartierResetRatioSpeedFactor; + } + else + { + w.offset -= 0.005f*CartierResetRatioSpeedFactor*UnityEngine.Random.Range(0f, 2f); + } + } + else if (w.offset < 1.0f) + { + if (!CartierResetRatioSpeedRandomize) + { + w.offset += 0.005f*CartierResetRatioSpeedFactor; + } + else + { + w.offset += 0.005f*CartierResetRatioSpeedFactor*UnityEngine.Random.Range(0f, 2f); + } + } + w.sprite.transform.localScale = new Vector3(w.offset, w.offset,0.0f); } }