From 546bfa405e3a22a11172dc43d9b614acc15ac863 Mon Sep 17 00:00:00 2001 From: Sophie Date: Fri, 8 Apr 2016 08:54:05 -0400 Subject: [PATCH] started earthquake --- Assets/Scripts/Asteroid.cs | 5 ++++- Assets/Scripts/Astronaut.cs | 17 ++++++++-------- Assets/Scripts/Earthquake.cs | 33 +++++++++++++++++++++++++++++++ Assets/Scripts/Earthquake.cs.meta | 12 +++++++++++ Assets/m_asteroid.mat | 17 ++++++++-------- 5 files changed, 67 insertions(+), 17 deletions(-) create mode 100644 Assets/Scripts/Earthquake.cs create mode 100644 Assets/Scripts/Earthquake.cs.meta 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 5aa35c7..44e3a47 100644 --- a/Assets/Scripts/Astronaut.cs +++ b/Assets/Scripts/Astronaut.cs @@ -40,10 +40,10 @@ public class Astronaut : MonoBehaviour { SpriteDash.SetActive(false); } - /*if (_state == AstronautState.Walking) + if (_state == AstronautState.Walking) { StartCoroutine(WalkingStance()); - }*/ + } } } @@ -60,8 +60,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; @@ -129,14 +129,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; } @@ -146,5 +147,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/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}