mirror of
https://github.com/ConjureETS/PixelSphinx.git
synced 2026-03-24 02:20:58 +00:00
Merge branch 'master' of https://github.com/ETSConjure/PixelSphinx
This commit is contained in:
commit
4810867fae
9
Assets/Prefabs.meta
Normal file
9
Assets/Prefabs.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 96533e08f1684a4499d445c8fefb7b3e
|
||||
folderAsset: yes
|
||||
timeCreated: 1460093246
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
1
Assets/Prefabs/file.txt
Normal file
1
Assets/Prefabs/file.txt
Normal file
@ -0,0 +1 @@
|
||||
tst
|
||||
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:
|
||||
92
Assets/Scripts/PlanetManager.cs
Normal file
92
Assets/Scripts/PlanetManager.cs
Normal file
@ -0,0 +1,92 @@
|
||||
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 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;
|
||||
wedges.Add(new Wedge(){tMin = debutAngleTheta, tMax = debutAngleTheta + TailleCartiersEnDegres });
|
||||
}
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public float GetPlanetRadius()
|
||||
{
|
||||
return 5.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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
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:
|
||||
1
Assets/Scripts/file.txt
Normal file
1
Assets/Scripts/file.txt
Normal file
@ -0,0 +1 @@
|
||||
tst
|
||||
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:
|
||||
38
Assets/Scripts/testRotate.cs
Normal file
38
Assets/Scripts/testRotate.cs
Normal 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);
|
||||
|
||||
}
|
||||
}
|
||||
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:
|
||||
1
Assets/Sounds/file.txt
Normal file
1
Assets/Sounds/file.txt
Normal file
@ -0,0 +1 @@
|
||||
tst
|
||||
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:
|
||||
1
Assets/_Scenes/file.txt
Normal file
1
Assets/_Scenes/file.txt
Normal file
@ -0,0 +1 @@
|
||||
tst
|
||||
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:
|
||||
BIN
Assets/_Scenes/planet.unity
Normal file
BIN
Assets/_Scenes/planet.unity
Normal file
Binary file not shown.
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