Commit 2e620bee authored by Chae Ho Shin's avatar Chae Ho Shin

working proto level

parent b4184cd7
......@@ -793,7 +793,7 @@ GameObject:
- component: {fileID: 439858917}
- component: {fileID: 439858916}
m_Layer: 0
m_Name: Plane
m_Name: Plane1
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
......@@ -1059,6 +1059,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
Levelmanager: {fileID: 279236944}
starttime: 10
gamma: 1
theobject: {fileID: 439858915}
otherclock: {fileID: 1094934749}
--- !u!4 &535323109
......@@ -1783,7 +1784,7 @@ GameObject:
- component: {fileID: 839664888}
- component: {fileID: 839664893}
m_Layer: 0
m_Name: Plane
m_Name: Plane2
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
......@@ -2548,6 +2549,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
Levelmanager: {fileID: 279236944}
starttime: 0
gamma: 1
theobject: {fileID: 839664886}
otherclock: {fileID: 535323108}
--- !u!4 &1094934750
......@@ -2906,7 +2908,7 @@ GameObject:
- component: {fileID: 1320474663}
- component: {fileID: 1320474662}
m_Layer: 0
m_Name: Plane
m_Name: Playerplane
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
......@@ -3465,7 +3467,7 @@ MeshCollider:
m_GameObject: {fileID: 1756789504}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Enabled: 0
serializedVersion: 3
m_Convex: 0
m_CookingOptions: 14
......
......@@ -12,6 +12,7 @@ public class Planemovement : MonoBehaviour
Vector3 v;
public LevelManager Levelmanager;
public double starttime = 0.0f;
public double gamma = 1.0f;
Vector3 orientation;
double time = 0.0f;
......@@ -31,6 +32,7 @@ public class Planemovement : MonoBehaviour
//playergamma = 1.0f;
orientation = new Vector3(0.0f, 0.0f, 1.0f);
time = starttime;
gamma = 1.0f;
}
// Update is called once per frame
......@@ -86,9 +88,9 @@ public class Planemovement : MonoBehaviour
beta = v.magnitude / 1.0f;
double gamma = 1.0f / Mathf.Sqrt(1.0f - (float)(beta*beta));
gamma = 1.0f / Mathf.Sqrt(1.0f - (float)(beta*beta));
transform.Translate(v * Time.fixedDeltaTime, Space.World);
transform.Translate(v * Time.fixedDeltaTime * (float)Levelmanager.player.gamma, Space.World);
var vt = v + Vector3.up;
......@@ -113,7 +115,7 @@ public class Planemovement : MonoBehaviour
transform.localScale = new Vector3(1.0f, 1.0f, (float)gamma); // scale x' axis
time += Time.fixedDeltaTime * (float)Levelmanager.player.gamma / (float)gamma;
time += Time.fixedDeltaTime * (float)(Levelmanager.player.gamma / gamma);
}
public void OnCollisionStaychild(Collision collision)
......@@ -123,15 +125,17 @@ public class Planemovement : MonoBehaviour
// Debug.Log(collision.gameObject.name + " wow!");
if (collision.transform.parent != null)
{
if (collision.transform.parent.gameObject.Equals(otherclock))
var x = collision.transform.parent.gameObject.GetComponent(typeof(Planemovement)) as Planemovement;
if (x != null && x.Equals(otherclock))
{
Debug.Log("hit!");
if (Mathf.Abs((float)(otherclock.GetTime() - time)) < 1.0f)
if (Mathf.Abs((float)(otherclock.GetTime() - time)) <= 1.0f)
{
Levelmanager.winstate = true;
}
}
}
}
public double GetTime()
......
......@@ -64,7 +64,7 @@ public class PlayerMovement : MonoBehaviour
gamma = 1.0f / Mathf.Sqrt(1.0f - (float)(beta * beta));
transform.Translate(v * Time.fixedDeltaTime, Space.World);
transform.Translate(v * Time.fixedDeltaTime * (float)gamma, Space.World);
var vt = v + Vector3.up;
......
......@@ -35,7 +35,7 @@ public class UIManager : MonoBehaviour
clock2time.text = clock2.GetTime().ToString() + " s";
if(Levelmanager.winstate)
{
wintext.enabled = true;
wintext.gameObject.SetActive(true);
}
if (Input.GetMouseButtonDown(0))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment