mirror of
https://github.com/ConjureETS/PixelSphinx.git
synced 2026-03-24 02:20:58 +00:00
PlanetManager : pas commité bonne version apparamment.
This commit is contained in:
parent
c138e191f3
commit
6199b0e29f
8
Assets/Prefabs/file.txt.meta
Normal file
8
Assets/Prefabs/file.txt.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: afc3ba2bd5b70194e9fb05d80712eecb
|
||||
timeCreated: 1460091048
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -1,5 +1,7 @@
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class PlanetManager : MonoBehaviour
|
||||
{
|
||||
@ -7,19 +9,17 @@ public class PlanetManager : MonoBehaviour
|
||||
public int NbCartiers = 10;
|
||||
public float TailleCartiersEnDegres = 0; //radian -> valeurs 0 a 360
|
||||
|
||||
var wedges = new List<Wedge>();
|
||||
public List<Wedge> wedges = new List<Wedge>();
|
||||
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
TailleCartiersEnRadiants = 360.0 / NbCartiers;
|
||||
|
||||
float debutAngleTheta = 0.0;
|
||||
TailleCartiersEnDegres = 360.0f / NbCartiers;
|
||||
|
||||
for(int i = 0; i < NbCartiers; i++)
|
||||
{
|
||||
debutAngleTheta = i*TailleCartiersEnRadiants;
|
||||
wedges.Add(new wedges(){tMin = debutAngleTheta, tMax = debutAngleTheta + TailleCartiersEnRadiants});
|
||||
float debutAngleTheta = i* TailleCartiersEnDegres;
|
||||
wedges.Add(new Wedge(){tMin = debutAngleTheta, tMax = debutAngleTheta + TailleCartiersEnDegres });
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,18 +33,17 @@ public class PlanetManager : MonoBehaviour
|
||||
|
||||
public float GetPlanetRadius()
|
||||
{
|
||||
|
||||
return 5.0f;
|
||||
}
|
||||
|
||||
|
||||
public Vector3 GetPlanetCoordinatesFromPlayerXY(float playerLocalX, float playerLocalY)
|
||||
{
|
||||
var theta = playerLocalX;
|
||||
double x = r * Math.Cos(theta * Math.PI / 180);
|
||||
double y = r * Math.Sin(theta * Math.PI / 180) + playerLocalY;
|
||||
var x = GetPlanetRadius() * Math.Cos(theta * Math.PI / 180);
|
||||
var y = GetPlanetRadius() * Math.Sin(theta * Math.PI / 180) + playerLocalY;
|
||||
|
||||
|
||||
return new Vector3(x,y,0);
|
||||
return new Vector3((float)x, (float)y, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -54,7 +53,7 @@ public class PlanetManager : MonoBehaviour
|
||||
/// <param name="thetaPlayerX"></param>
|
||||
public int GetWedgeIndex(float thetaPlayerX)
|
||||
{
|
||||
return Math.Floor(thetaPlayerX / TailleCartiersEnRadiants);
|
||||
return (int)Math.Floor(thetaPlayerX / TailleCartiersEnDegres);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -84,9 +83,9 @@ public class PlanetManager : MonoBehaviour
|
||||
/// </summary>
|
||||
public class Wedge
|
||||
{
|
||||
float yoffset = 0; //valeurs entre -1 et 1; -1 étant renfoncé, 0 position normale, et 1 vers l'extérieur
|
||||
float tMin = 0; //theta min et theta max : angle thetat de début et fin du cartier;
|
||||
float tMax = 0;
|
||||
public float yoffset = 0; //valeurs entre -1 et 1; -1 étant renfoncé, 0 position normale, et 1 vers l'extérieur
|
||||
public float tMin = 0; //theta min et theta max : angle thetat de début et fin du cartier;
|
||||
public float tMax = 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
12
Assets/Scripts/PlanetManager.cs.meta
Normal file
12
Assets/Scripts/PlanetManager.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 43d953650863ce04d8918939e0248654
|
||||
timeCreated: 1460091046
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Scripts/file.txt.meta
Normal file
8
Assets/Scripts/file.txt.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6681384214c3a3e4a90c112542387b03
|
||||
timeCreated: 1460091047
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
12
Assets/Scripts/testRotate.cs.meta
Normal file
12
Assets/Scripts/testRotate.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ac56b6226ed50a742a676cbfae403f88
|
||||
timeCreated: 1460091047
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Sounds/file.txt.meta
Normal file
8
Assets/Sounds/file.txt.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6b2a8ad68d415d446ac7ecf9db5491bc
|
||||
timeCreated: 1460091047
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/_Scenes/file.txt.meta
Normal file
8
Assets/_Scenes/file.txt.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e82e3d7221e4604f8b5b5ce23f8eccb
|
||||
timeCreated: 1460091048
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/_Scenes/planet.unity.meta
Normal file
8
Assets/_Scenes/planet.unity.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c5f60472012ea55409d7eb4b1ecaec89
|
||||
timeCreated: 1460091041
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user