diff --git a/Assets/Prefabs/WedgePrefab00.prefab b/Assets/Prefabs/WedgePrefab00.prefab index 479b5bd..f46b5df 100644 Binary files a/Assets/Prefabs/WedgePrefab00.prefab and b/Assets/Prefabs/WedgePrefab00.prefab differ diff --git a/Assets/Scripts/Asteroid.cs b/Assets/Scripts/Asteroid.cs index ab18c29..23cb82d 100644 --- a/Assets/Scripts/Asteroid.cs +++ b/Assets/Scripts/Asteroid.cs @@ -8,7 +8,10 @@ public class Asteroid : MonoBehaviour public float step; // Use this for initialization - void Start () { + void Start() + { + speed = Random.Range(0.1F, 2F); + print(speed); center = new Vector3(0, 0); } diff --git a/Assets/Scripts/Astronaut.cs b/Assets/Scripts/Astronaut.cs index 96c1487..d67b875 100644 --- a/Assets/Scripts/Astronaut.cs +++ b/Assets/Scripts/Astronaut.cs @@ -42,10 +42,10 @@ public class Astronaut : MonoBehaviour { SpriteDash.SetActive(false); } - /*if (_state == AstronautState.Walking) + if (_state == AstronautState.Walking) { StartCoroutine(WalkingStance()); - }*/ + } } } @@ -63,8 +63,8 @@ public class Astronaut : MonoBehaviour { // Update is called once per frame void Update () { - - /*if (State == AstronautState.Walking) + /* + if (State == AstronautState.Walking) { walkTime += Time.deltaTime / StepTime; Vector3 rotation = transform.rotation.eulerAngles; @@ -132,14 +132,15 @@ public class Astronaut : MonoBehaviour { Debug.Log("Clicked the button with an image"); } - /*IEnumerator WalkingStance() + IEnumerator WalkingStance() { Debug.Log("walking stance"); walkTime += Time.deltaTime / StepTime; - while (State <= AstronautState.Walking && walkTime <= 1f) + while (State <= AstronautState.Walking || walkTime <= 1f) { Vector3 rotation = transform.rotation.eulerAngles; - rotation.z = Mathf.Sin(walkTime*Mathf.PI); + rotation.z = Mathf.Sin(walkTime*Mathf.PI)*50; + print("rotation " + rotation); transform.rotation = Quaternion.Euler(rotation); yield return null; } @@ -149,5 +150,5 @@ public class Astronaut : MonoBehaviour { { StartCoroutine("WalkingStance"); } - }*/ + } } diff --git a/Assets/Scripts/Earthquake.cs b/Assets/Scripts/Earthquake.cs new file mode 100644 index 0000000..f7943aa --- /dev/null +++ b/Assets/Scripts/Earthquake.cs @@ -0,0 +1,33 @@ +using UnityEngine; +using System.Collections; + +public class Earthquake : MonoBehaviour { + int gaugeLevel; + const int gaugeMax=4; + + // Use this for initialization + void Start() + { + gaugeLevel = 0; + InvokeRepeating("fillGauge", 1, 1F); + + } + + // Update is called once per frame + void Update () { + + } + + void fillGauge() + { + if (gaugeLevel < gaugeMax) + { + gaugeLevel += 1; + } + else + { + gaugeLevel = 0; + } + print("gauge is at: " + gaugeLevel); + } +} diff --git a/Assets/Scripts/Earthquake.cs.meta b/Assets/Scripts/Earthquake.cs.meta new file mode 100644 index 0000000..318d54b --- /dev/null +++ b/Assets/Scripts/Earthquake.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c11fa6fea03561044843359e6d9d23a6 +timeCreated: 1460117184 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/PlanetManager.cs b/Assets/Scripts/PlanetManager.cs index 37ced3d..f9df79b 100644 --- a/Assets/Scripts/PlanetManager.cs +++ b/Assets/Scripts/PlanetManager.cs @@ -8,9 +8,11 @@ public class PlanetManager : MonoBehaviour public int NbCartiers = 10; public float TailleCartiersEnDegres = 0; //radian -> valeurs 0 a 360 - + public float CartierResetRatioSpeedFactor = 0.23f; //Entre 0.05 et 1 ou plus on aime que ca restore lentement, randomnly + public bool CartierResetRatioSpeedRandomize = true; + public float CartierMinRatio = 0.4f; + public float CartierMaxRatio = 2.0f; public GameObject WedgePrefab = null; - public List wedges = new List(); @@ -49,7 +51,34 @@ public class PlanetManager : MonoBehaviour foreach (var w in wedges) { + if (w.offset <= 1.05f && w.offset >= 0.95f) + { + w.offset = 1.0f; + } + else if (w.offset > 1.0f) + { + if (!CartierResetRatioSpeedRandomize) + { + w.offset -= 0.005f*CartierResetRatioSpeedFactor; + } + else + { + w.offset -= 0.005f*CartierResetRatioSpeedFactor * UnityEngine.Random.Range(-0.5f, 2f); + } + } + else if (w.offset < 1.0f) + { + if (!CartierResetRatioSpeedRandomize) + { + w.offset += 0.005f*CartierResetRatioSpeedFactor; + } + else + { + w.offset += 0.005f*CartierResetRatioSpeedFactor*UnityEngine.Random.Range(0f, 3f); + } + } + w.sprite.transform.localScale = new Vector3(w.offset, w.offset,0.0f); } } @@ -60,7 +89,7 @@ public class PlanetManager : MonoBehaviour var w = wedges[index]; w.offset = w.offset - 0.25f; - if (w.offset < 0.5f) + if (w.offset < CartierMinRatio) w.offset = 0.5f; @@ -71,7 +100,7 @@ public class PlanetManager : MonoBehaviour var v = wedges[indexOppose]; v.offset = v.offset + 0.25f; - if (v.offset > 1.5f) + if (v.offset > CartierMaxRatio) v.offset = 1.5f; v.sprite.transform.localScale = new Vector3(v.offset, v.offset, 1); diff --git a/Assets/Scripts/testRotate.cs b/Assets/Scripts/testRotate.cs index 55bbf88..34a9c2f 100644 --- a/Assets/Scripts/testRotate.cs +++ b/Assets/Scripts/testRotate.cs @@ -6,15 +6,14 @@ public class testRotate : MonoBehaviour { - public float fireRate = 1.0f; + public float fireRate = 0.2f; private float lastShot = 0.0f; - + private float speed = 33.2f; void Update() { if(Input.GetKeyDown("space") || Input.GetKey("s")) { - Fire(); } } @@ -25,17 +24,15 @@ public class testRotate : MonoBehaviour { { lastShot = Time.time; - var speed = 13.2f; + var theta = Time.realtimeSinceStartup * speed % 360.0f; var pmgr = FindObjectOfType(); pmgr.PushWedge(theta); - - - - var index = pmgr.GetWedgeIndex(theta); + + } @@ -58,7 +55,7 @@ public class testRotate : MonoBehaviour { /// void FixedUpdate() { - var speed = 13.2f; + var theta = Time.realtimeSinceStartup * speed % 360.0f; // Position X du player = angle theta diff --git a/Assets/m_asteroid.mat b/Assets/m_asteroid.mat index 6a10223..7bca657 100644 --- a/Assets/m_asteroid.mat +++ b/Assets/m_asteroid.mat @@ -8,10 +8,11 @@ Material: m_PrefabInternal: {fileID: 0} m_Name: m_asteroid m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} - m_ShaderKeywords: + m_ShaderKeywords: _ALPHAPREMULTIPLY_ON m_LightmapFlags: 5 - m_CustomRenderQueue: -1 - stringTagMap: {} + m_CustomRenderQueue: 3000 + stringTagMap: + RenderType: Transparent m_SavedProperties: serializedVersion: 2 m_TexEnvs: @@ -86,7 +87,7 @@ Material: data: first: name: _DstBlend - second: 0 + second: 10 data: first: name: _Cutoff @@ -98,7 +99,7 @@ Material: data: first: name: _ZWrite - second: 1 + second: 0 data: first: name: _Glossiness @@ -122,11 +123,11 @@ Material: data: first: name: _Mode - second: 0 + second: 3 data: first: name: _Metallic - second: 0 + second: 0.23 m_Colors: data: first: @@ -135,4 +136,4 @@ Material: data: first: name: _Color - second: {r: 0.3897059, g: 0.26947415, b: 0.054444212, a: 1} + second: {r: 0, g: 0.6838235, b: 0.14619671, a: 0.503}