started earthquake

This commit is contained in:
Sophie 2016-04-08 08:54:05 -04:00
parent 7e82a2b543
commit 546bfa405e
5 changed files with 67 additions and 17 deletions

View File

@ -8,7 +8,10 @@ public class Asteroid : MonoBehaviour
public float step; public float step;
// Use this for initialization // Use this for initialization
void Start () { void Start()
{
speed = Random.Range(0.1F, 2F);
print(speed);
center = new Vector3(0, 0); center = new Vector3(0, 0);
} }

View File

@ -40,10 +40,10 @@ public class Astronaut : MonoBehaviour {
SpriteDash.SetActive(false); SpriteDash.SetActive(false);
} }
/*if (_state == AstronautState.Walking) if (_state == AstronautState.Walking)
{ {
StartCoroutine(WalkingStance()); StartCoroutine(WalkingStance());
}*/ }
} }
} }
@ -60,8 +60,8 @@ public class Astronaut : MonoBehaviour {
// Update is called once per frame // Update is called once per frame
void Update () { void Update () {
/*
/*if (State == AstronautState.Walking) if (State == AstronautState.Walking)
{ {
walkTime += Time.deltaTime / StepTime; walkTime += Time.deltaTime / StepTime;
Vector3 rotation = transform.rotation.eulerAngles; Vector3 rotation = transform.rotation.eulerAngles;
@ -129,14 +129,15 @@ public class Astronaut : MonoBehaviour {
Debug.Log("Clicked the button with an image"); Debug.Log("Clicked the button with an image");
} }
/*IEnumerator WalkingStance() IEnumerator WalkingStance()
{ {
Debug.Log("walking stance"); Debug.Log("walking stance");
walkTime += Time.deltaTime / StepTime; walkTime += Time.deltaTime / StepTime;
while (State <= AstronautState.Walking && walkTime <= 1f) while (State <= AstronautState.Walking || walkTime <= 1f)
{ {
Vector3 rotation = transform.rotation.eulerAngles; 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); transform.rotation = Quaternion.Euler(rotation);
yield return null; yield return null;
} }
@ -146,5 +147,5 @@ public class Astronaut : MonoBehaviour {
{ {
StartCoroutine("WalkingStance"); StartCoroutine("WalkingStance");
} }
}*/ }
} }

View File

@ -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);
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: c11fa6fea03561044843359e6d9d23a6
timeCreated: 1460117184
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -8,10 +8,11 @@ Material:
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_Name: m_asteroid m_Name: m_asteroid
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: m_ShaderKeywords: _ALPHAPREMULTIPLY_ON
m_LightmapFlags: 5 m_LightmapFlags: 5
m_CustomRenderQueue: -1 m_CustomRenderQueue: 3000
stringTagMap: {} stringTagMap:
RenderType: Transparent
m_SavedProperties: m_SavedProperties:
serializedVersion: 2 serializedVersion: 2
m_TexEnvs: m_TexEnvs:
@ -86,7 +87,7 @@ Material:
data: data:
first: first:
name: _DstBlend name: _DstBlend
second: 0 second: 10
data: data:
first: first:
name: _Cutoff name: _Cutoff
@ -98,7 +99,7 @@ Material:
data: data:
first: first:
name: _ZWrite name: _ZWrite
second: 1 second: 0
data: data:
first: first:
name: _Glossiness name: _Glossiness
@ -122,11 +123,11 @@ Material:
data: data:
first: first:
name: _Mode name: _Mode
second: 0 second: 3
data: data:
first: first:
name: _Metallic name: _Metallic
second: 0 second: 0.23
m_Colors: m_Colors:
data: data:
first: first:
@ -135,4 +136,4 @@ Material:
data: data:
first: first:
name: _Color 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}