Ajouté des valeur min max pour les ratios, activé la randomisation pour le reset des plateformes

This commit is contained in:
Jean-Sébastien Gervais 2016-04-08 09:38:11 -04:00
parent 78b679ac01
commit 7cad78c038
2 changed files with 14 additions and 15 deletions

View File

@ -8,8 +8,10 @@ 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 float CartierResetRatioSpeedFactor = 0.23f; //Entre 0.05 et 1 ou plus on aime que ca restore lentement, randomnly
public bool CartierResetRatioSpeedRandomize = true;
public float CartierMinRatio = 0.4f;
public float CartierMaxRatio = 2.0f;
public GameObject WedgePrefab = null;
public List<Wedge> wedges = new List<Wedge>();
@ -61,7 +63,7 @@ public class PlanetManager : MonoBehaviour
}
else
{
w.offset -= 0.005f*CartierResetRatioSpeedFactor*UnityEngine.Random.Range(0f, 2f);
w.offset -= 0.005f*CartierResetRatioSpeedFactor * UnityEngine.Random.Range(-0.5f, 2f);
}
}
else if (w.offset < 1.0f)
@ -72,7 +74,7 @@ public class PlanetManager : MonoBehaviour
}
else
{
w.offset += 0.005f*CartierResetRatioSpeedFactor*UnityEngine.Random.Range(0f, 2f);
w.offset += 0.005f*CartierResetRatioSpeedFactor*UnityEngine.Random.Range(0f, 3f);
}
}
@ -87,7 +89,7 @@ public class PlanetManager : MonoBehaviour
var w = wedges[index];
w.offset = w.offset - 0.25f;
if (w.offset < 0.5f)
if (w.offset < CartierMinRatio)
w.offset = 0.5f;
@ -98,7 +100,7 @@ public class PlanetManager : MonoBehaviour
var v = wedges[indexOppose];
v.offset = v.offset + 0.25f;
if (v.offset > 1.5f)
if (v.offset > CartierMaxRatio)
v.offset = 1.5f;
v.sprite.transform.localScale = new Vector3(v.offset, v.offset, 1);

View File

@ -6,15 +6,14 @@ public class testRotate : MonoBehaviour {
public float fireRate = 1.0f;
public float fireRate = 0.2f;
private float lastShot = 0.0f;
private float speed = 33.2f;
void Update()
{
if(Input.GetKeyDown("space") || Input.GetKey("s"))
{
Fire();
}
}
@ -25,17 +24,15 @@ public class testRotate : MonoBehaviour {
{
lastShot = Time.time;
var speed = 13.2f;
var theta = Time.realtimeSinceStartup * speed % 360.0f;
var pmgr = FindObjectOfType<PlanetManager>();
pmgr.PushWedge(theta);
var index = pmgr.GetWedgeIndex(theta);
}
@ -58,7 +55,7 @@ public class testRotate : MonoBehaviour {
/// </summary>
void FixedUpdate()
{
var speed = 13.2f;
var theta = Time.realtimeSinceStartup * speed % 360.0f; // Position X du player = angle theta