This commit is contained in:
RosimInc 2016-04-08 09:55:54 -04:00
commit 4cb9578e10
8 changed files with 106 additions and 30 deletions

Binary file not shown.

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

@ -42,10 +42,10 @@ public class Astronaut : MonoBehaviour {
SpriteDash.SetActive(false); SpriteDash.SetActive(false);
} }
/*if (_state == AstronautState.Walking) if (_state == AstronautState.Walking)
{ {
StartCoroutine(WalkingStance()); StartCoroutine(WalkingStance());
}*/ }
} }
} }
@ -63,8 +63,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;
@ -132,14 +132,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;
} }
@ -149,5 +150,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,9 +8,11 @@ public class PlanetManager : MonoBehaviour
public int NbCartiers = 10; public int NbCartiers = 10;
public float TailleCartiersEnDegres = 0; //radian -> valeurs 0 a 360 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 GameObject WedgePrefab = null;
public List<Wedge> wedges = new List<Wedge>(); public List<Wedge> wedges = new List<Wedge>();
@ -49,7 +51,34 @@ public class PlanetManager : MonoBehaviour
foreach (var w in wedges) 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]; var w = wedges[index];
w.offset = w.offset - 0.25f; w.offset = w.offset - 0.25f;
if (w.offset < 0.5f) if (w.offset < CartierMinRatio)
w.offset = 0.5f; w.offset = 0.5f;
@ -71,7 +100,7 @@ public class PlanetManager : MonoBehaviour
var v = wedges[indexOppose]; var v = wedges[indexOppose];
v.offset = v.offset + 0.25f; v.offset = v.offset + 0.25f;
if (v.offset > 1.5f) if (v.offset > CartierMaxRatio)
v.offset = 1.5f; v.offset = 1.5f;
v.sprite.transform.localScale = new Vector3(v.offset, v.offset, 1); v.sprite.transform.localScale = new Vector3(v.offset, v.offset, 1);

View File

@ -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 lastShot = 0.0f;
private float speed = 33.2f;
void Update() void Update()
{ {
if(Input.GetKeyDown("space") || Input.GetKey("s")) if(Input.GetKeyDown("space") || Input.GetKey("s"))
{ {
Fire(); Fire();
} }
} }
@ -25,7 +24,7 @@ public class testRotate : MonoBehaviour {
{ {
lastShot = Time.time; lastShot = Time.time;
var speed = 13.2f;
var theta = Time.realtimeSinceStartup * speed % 360.0f; var theta = Time.realtimeSinceStartup * speed % 360.0f;
@ -35,8 +34,6 @@ public class testRotate : MonoBehaviour {
var index = pmgr.GetWedgeIndex(theta);
} }
} }
@ -58,7 +55,7 @@ public class testRotate : MonoBehaviour {
/// </summary> /// </summary>
void FixedUpdate() void FixedUpdate()
{ {
var speed = 13.2f;
var theta = Time.realtimeSinceStartup * speed % 360.0f; // Position X du player = angle theta var theta = Time.realtimeSinceStartup * speed % 360.0f; // Position X du player = angle theta

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}