mirror of
https://github.com/ConjureETS/PixelSphinx.git
synced 2026-03-24 10:30:59 +00:00
Instatiation des WedgePrefab dans le planetManager
This commit is contained in:
parent
6199b0e29f
commit
c19b71cfa8
BIN
Assets/Prefabs/WedgePrefab.prefab
Normal file
BIN
Assets/Prefabs/WedgePrefab.prefab
Normal file
Binary file not shown.
8
Assets/Prefabs/WedgePrefab.prefab.meta
Normal file
8
Assets/Prefabs/WedgePrefab.prefab.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 901b80ca01ac0de4ca89de7f82c3709f
|
||||||
|
timeCreated: 1460092920
|
||||||
|
licenseType: Pro
|
||||||
|
NativeFormatImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -9,9 +9,12 @@ public class PlanetManager : MonoBehaviour
|
|||||||
public int NbCartiers = 10;
|
public int NbCartiers = 10;
|
||||||
public float TailleCartiersEnDegres = 0; //radian -> valeurs 0 a 360
|
public float TailleCartiersEnDegres = 0; //radian -> valeurs 0 a 360
|
||||||
|
|
||||||
|
public GameObject WedgePrefab = null;
|
||||||
|
|
||||||
public List<Wedge> wedges = new List<Wedge>();
|
public List<Wedge> wedges = new List<Wedge>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Use this for initialization
|
// Use this for initialization
|
||||||
void Start () {
|
void Start () {
|
||||||
TailleCartiersEnDegres = 360.0f / NbCartiers;
|
TailleCartiersEnDegres = 360.0f / NbCartiers;
|
||||||
@ -19,8 +22,18 @@ public class PlanetManager : MonoBehaviour
|
|||||||
for(int i = 0; i < NbCartiers; i++)
|
for(int i = 0; i < NbCartiers; i++)
|
||||||
{
|
{
|
||||||
float debutAngleTheta = i* TailleCartiersEnDegres;
|
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
|
// 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()
|
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 tMin = 0; //theta min et theta max : angle thetat de début et fin du cartier;
|
||||||
public float tMax = 0;
|
public float tMax = 0;
|
||||||
|
|
||||||
|
public GameObject sprite; //sprite et collider 2D
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user