This commit is contained in:
Sophie 2016-04-08 02:33:40 -04:00
commit 0a92542f28
4 changed files with 40 additions and 3 deletions

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 901b80ca01ac0de4ca89de7f82c3709f
timeCreated: 1460092920
licenseType: Pro
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -9,8 +9,11 @@ public class PlanetManager : MonoBehaviour
public int NbCartiers = 10;
public float TailleCartiersEnDegres = 0; //radian -> valeurs 0 a 360
public GameObject WedgePrefab = null;
public List<Wedge> wedges = new List<Wedge>();
// Use this for initialization
void Start () {
@ -19,8 +22,18 @@ public class PlanetManager : MonoBehaviour
for(int i = 0; i < NbCartiers; i++)
{
float debutAngleTheta = i* TailleCartiersEnDegres;
wedges.Add(new Wedge(){tMin = debutAngleTheta, tMax = debutAngleTheta + TailleCartiersEnDegres });
var w = new Wedge() {tMin = debutAngleTheta, tMax = debutAngleTheta + TailleCartiersEnDegres};
wedges.Add(w); //pushes at end.
//float angle = i * Mathf.PI * 2 / NbCartiers * 360;
var wedgePos = GetPlanetCoordinatesFromPlayerXY(debutAngleTheta, 0);
wedgePos.x -= 8/ Mathf.PI * Mathf.Cos(debutAngleTheta * Mathf.PI / 180);
wedgePos.y -= 8/ Mathf.PI * Mathf.Sin(debutAngleTheta * Mathf.PI / 180);
Instantiate(WedgePrefab, wedgePos, Quaternion.Euler(0, 0, debutAngleTheta));
}
}
// Update is called once per frame
@ -29,11 +42,25 @@ public class PlanetManager : MonoBehaviour
}
void FixedUpdate()
{
//Ramener les plateforme vers leur position initiale 0;
foreach (var w in wedges)
{
}
}
/// <summary>
/// Radius sphere est scale/2
/// </summary>
/// <returns></returns>
public float GetPlanetRadius()
{
return 5.0f;
return gameObject.transform.localScale.x / 2.0f;
}
@ -87,6 +114,8 @@ public class PlanetManager : MonoBehaviour
public float tMin = 0; //theta min et theta max : angle thetat de début et fin du cartier;
public float tMax = 0;
public GameObject sprite; //sprite et collider 2D
}
}

Binary file not shown.