Conflicts:
	Assets/Prefabs/file.txt.meta
	Assets/Scripts/file.txt.meta
	Assets/Sounds/file.txt.meta
	Assets/_Scenes/file.txt.meta
This commit is contained in:
RosimInc 2016-04-08 02:20:15 -04:00
commit 578963f0a6
13 changed files with 211 additions and 12 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

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 956f6dc5d62f42447bf1cd7e795dd4f1
timeCreated: 1460088419
licenseType: Free
guid: afc3ba2bd5b70194e9fb05d80712eecb
timeCreated: 1460091048
licenseType: Pro
TextScriptImporter:
userData:
assetBundleName:

View File

@ -0,0 +1,121 @@
using System;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
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 () {
TailleCartiersEnDegres = 360.0f / NbCartiers;
for(int i = 0; i < NbCartiers; i++)
{
float debutAngleTheta = i* 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
void Update () {
}
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 gameObject.transform.localScale.x / 2.0f;
}
public Vector3 GetPlanetCoordinatesFromPlayerXY(float playerLocalX, float playerLocalY)
{
var theta = playerLocalX;
var x = GetPlanetRadius() * Math.Cos(theta * Math.PI / 180);
var y = GetPlanetRadius() * Math.Sin(theta * Math.PI / 180) + playerLocalY;
return new Vector3((float)x, (float)y, 0);
}
/// <summary>
/// retourn le no de plateforme
/// </summary>
/// <param name="thetaPlayerX"></param>
public int GetWedgeIndex(float thetaPlayerX)
{
return (int)Math.Floor(thetaPlayerX / TailleCartiersEnDegres);
}
/// <summary>
///
/// </summary>
/// <param name="wedgeIndex"></param>
/// <returns></returns>
public int GetWedgeOpposé(int wedgeIndex)
{
//(i + 5) % 10 => [0,9]
return (wedgeIndex + NbCartiers / 2) % (NbCartiers);
}
/// <summary>
/// retourne l'objet interne
/// </summary>
/// <param name="thetaPlayerX"></param>
/// <returns></returns>
public Wedge GetWedgeFromTheta(float thetaPlayerX)
{
return wedges[GetWedgeIndex(thetaPlayerX)];
}
/// <summary>
/// Représente une plateforme qui bouge.
/// </summary>
public class Wedge
{
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;
public GameObject sprite; //sprite et collider 2D
}
}

View 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:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 77f8a1d558598d9408cb2abb88189467
timeCreated: 1460088419
licenseType: Free
guid: 6681384214c3a3e4a90c112542387b03
timeCreated: 1460091047
licenseType: Pro
TextScriptImporter:
userData:
assetBundleName:

View File

@ -0,0 +1,38 @@
using System;
using UnityEngine;
using System.Collections;
public class testRotate : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
/// <summary>
/// Juste pour tester le mouvement du player autour du cercle.
/// Le player se déplace de gauche a droite en x et la valeur de x représente l'angle theta
/// saute en y
/// </summary>
void FixedUpdate()
{
var speed = 13.2;
var theta = Time.realtimeSinceStartup * speed % 360.0; // Position X du player = angle theta
var r = 5.0; //sphereradius
// XY coordinates
double x = r * Math.Cos(theta * Math.PI / 180);
double y = r * Math.Sin(theta * Math.PI / 180); // + y0 du player
var player = GameObject.Find("CubePlayer").gameObject;
player.transform.position = Vector3.Lerp(player.transform.position, new Vector3( (float)x, (float)y, 0 ), Time.deltaTime);
}
}

View 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:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 0f202c98948164344a3f24d311356aeb
timeCreated: 1460088418
licenseType: Free
guid: 6b2a8ad68d415d446ac7ecf9db5491bc
timeCreated: 1460091047
licenseType: Pro
TextScriptImporter:
userData:
assetBundleName:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 27f8660ce677f614998367591f127e5a
timeCreated: 1460088419
licenseType: Free
guid: 6e82e3d7221e4604f8b5b5ce23f8eccb
timeCreated: 1460091048
licenseType: Pro
TextScriptImporter:
userData:
assetBundleName:

BIN
Assets/_Scenes/planet.unity Normal file

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c5f60472012ea55409d7eb4b1ecaec89
timeCreated: 1460091041
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant: