Commit a36508da authored by Chae Ho Shin's avatar Chae Ho Shin

few major bug fix, add two tutorial levels

parent 98b89919
...@@ -13,7 +13,7 @@ GameObject: ...@@ -13,7 +13,7 @@ GameObject:
- component: {fileID: 951264406399792024} - component: {fileID: 951264406399792024}
- component: {fileID: 951264406399792026} - component: {fileID: 951264406399792026}
m_Layer: 1 m_Layer: 1
m_Name: Background (1) m_Name: Background
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
...@@ -76,8 +76,8 @@ SpriteRenderer: ...@@ -76,8 +76,8 @@ SpriteRenderer:
m_Color: {r: 0.04416871, g: 1, b: 0, a: 1} m_Color: {r: 0.04416871, g: 1, b: 0, a: 1}
m_FlipX: 0 m_FlipX: 0
m_FlipY: 0 m_FlipY: 0
m_DrawMode: 2 m_DrawMode: 1
m_Size: {x: 0.01, y: 0.01} m_Size: {x: 0.16, y: 0.16}
m_AdaptiveModeThreshold: 0.5 m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0 m_SpriteTileMode: 0
m_WasSpriteAssigned: 0 m_WasSpriteAssigned: 0
......
...@@ -410,7 +410,7 @@ MonoBehaviour: ...@@ -410,7 +410,7 @@ MonoBehaviour:
- "\u3147\u3147" - "\u3147\u3147"
winstate: 0 winstate: 0
DoubleClickMove: 1 DoubleClickMove: 1
PathRanderMove: 1 PathRenderMove: 1
WASDMove: 1 WASDMove: 1
Todo: Todo:
--- !u!1 &332710466 --- !u!1 &332710466
...@@ -747,6 +747,7 @@ MonoBehaviour: ...@@ -747,6 +747,7 @@ MonoBehaviour:
velocityslider: {fileID: 260633610} velocityslider: {fileID: 260633610}
accelslider: {fileID: 1086622590} accelslider: {fileID: 1086622590}
interactText: {fileID: 527034809} interactText: {fileID: 527034809}
thegrid: {fileID: 1489254841}
canvas: {fileID: 1193230064} canvas: {fileID: 1193230064}
mytime: {fileID: 1678224219} mytime: {fileID: 1678224219}
wintext: {fileID: 512200287} wintext: {fileID: 512200287}
...@@ -760,6 +761,7 @@ MonoBehaviour: ...@@ -760,6 +761,7 @@ MonoBehaviour:
scrollSpeed: 5 scrollSpeed: 5
WASDMove: 1 WASDMove: 1
DoubleCLickMove: 1 DoubleCLickMove: 1
PathMove: 1
alert: {fileID: 1878497986} alert: {fileID: 1878497986}
--- !u!4 &394305456 --- !u!4 &394305456
Transform: Transform:
...@@ -1220,7 +1222,7 @@ MonoBehaviour: ...@@ -1220,7 +1222,7 @@ MonoBehaviour:
gamma: 1 gamma: 1
time: 0 time: 0
theobject: {fileID: 535323107} theobject: {fileID: 535323107}
mass: 10 mass: 1
starttime: 0 starttime: 0
otherclock: {fileID: 1094934749} otherclock: {fileID: 1094934749}
--- !u!4 &535323109 --- !u!4 &535323109
...@@ -2873,7 +2875,7 @@ MonoBehaviour: ...@@ -2873,7 +2875,7 @@ MonoBehaviour:
gamma: 1 gamma: 1
time: 0 time: 0
theobject: {fileID: 1094934748} theobject: {fileID: 1094934748}
mass: 10 mass: 1
starttime: 0 starttime: 0
otherclock: {fileID: 535323108} otherclock: {fileID: 535323108}
--- !u!4 &1094934750 --- !u!4 &1094934750
...@@ -3620,6 +3622,99 @@ CanvasRenderer: ...@@ -3620,6 +3622,99 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1477382725} m_GameObject: {fileID: 1477382725}
m_CullTransparentMesh: 0 m_CullTransparentMesh: 0
--- !u!1 &1489254840
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1489254843}
- component: {fileID: 1489254842}
- component: {fileID: 1489254841}
m_Layer: 1
m_Name: grid
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1489254841
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1489254840}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 99fc8cfec3b50be41b7fe68464704a73, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!212 &1489254842
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1489254840}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 1
m_Sprite: {fileID: 21300000, guid: 0fc4471cd9111ad48a42227a09dacb03, type: 3}
m_Color: {r: 0.04416871, g: 1, b: 0, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 1
m_Size: {x: 3.68, y: 3.68}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!4 &1489254843
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1489254840}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: -300, z: -30}
m_LocalScale: {x: 500.00003, y: 500.00058, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 15
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1496132462 --- !u!1 &1496132462
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -3759,7 +3854,7 @@ Camera: ...@@ -3759,7 +3854,7 @@ Camera:
m_Depth: 0 m_Depth: 0
m_CullingMask: m_CullingMask:
serializedVersion: 2 serializedVersion: 2
m_Bits: 4294967295 m_Bits: 277
m_RenderingPath: 1 m_RenderingPath: 1
m_TargetTexture: {fileID: 8400000, guid: 13da20cf2d7183242bb9d73fcb1d0b9d, type: 2} m_TargetTexture: {fileID: 8400000, guid: 13da20cf2d7183242bb9d73fcb1d0b9d, type: 2}
m_TargetDisplay: 1 m_TargetDisplay: 1
...@@ -4753,6 +4848,41 @@ PrefabInstance: ...@@ -4753,6 +4848,41 @@ PrefabInstance:
propertyPath: m_Name propertyPath: m_Name
value: Player value: Player
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 951264407572948427, guid: cbc6e3e1c08a170489e9a338eee1257f,
type: 3}
propertyPath: levelManager
value:
objectReference: {fileID: 279236944}
- target: {fileID: 951264407572948427, guid: cbc6e3e1c08a170489e9a338eee1257f,
type: 3}
propertyPath: uiManager
value:
objectReference: {fileID: 394305455}
- target: {fileID: 951264407764097797, guid: cbc6e3e1c08a170489e9a338eee1257f,
type: 3}
propertyPath: square
value:
objectReference: {fileID: 934514725}
- target: {fileID: 951264407764097797, guid: cbc6e3e1c08a170489e9a338eee1257f,
type: 3}
propertyPath: playercamera
value:
objectReference: {fileID: 1661408489}
- target: {fileID: 951264407764097797, guid: cbc6e3e1c08a170489e9a338eee1257f,
type: 3}
propertyPath: levelManager
value:
objectReference: {fileID: 279236944}
- target: {fileID: 951264407764097797, guid: cbc6e3e1c08a170489e9a338eee1257f,
type: 3}
propertyPath: velocityslider
value:
objectReference: {fileID: 260633610}
- target: {fileID: 951264407764097797, guid: cbc6e3e1c08a170489e9a338eee1257f,
type: 3}
propertyPath: ui
value:
objectReference: {fileID: 394305455}
- target: {fileID: 951264407572948426, guid: cbc6e3e1c08a170489e9a338eee1257f, - target: {fileID: 951264407572948426, guid: cbc6e3e1c08a170489e9a338eee1257f,
type: 3} type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
...@@ -4808,45 +4938,15 @@ PrefabInstance: ...@@ -4808,45 +4938,15 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z propertyPath: m_LocalEulerAnglesHint.z
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 951264407572948427, guid: cbc6e3e1c08a170489e9a338eee1257f,
type: 3}
propertyPath: levelManager
value:
objectReference: {fileID: 279236944}
- target: {fileID: 951264407572948427, guid: cbc6e3e1c08a170489e9a338eee1257f,
type: 3}
propertyPath: uiManager
value:
objectReference: {fileID: 394305455}
- target: {fileID: 951264407063557759, guid: cbc6e3e1c08a170489e9a338eee1257f, - target: {fileID: 951264407063557759, guid: cbc6e3e1c08a170489e9a338eee1257f,
type: 3} type: 3}
propertyPath: plane propertyPath: plane
value: value:
objectReference: {fileID: 1756789504} objectReference: {fileID: 1756789504}
- target: {fileID: 951264407764097797, guid: cbc6e3e1c08a170489e9a338eee1257f, - target: {fileID: 951264406399792026, guid: cbc6e3e1c08a170489e9a338eee1257f,
type: 3}
propertyPath: square
value:
objectReference: {fileID: 934514725}
- target: {fileID: 951264407764097797, guid: cbc6e3e1c08a170489e9a338eee1257f,
type: 3}
propertyPath: playercamera
value:
objectReference: {fileID: 1661408489}
- target: {fileID: 951264407764097797, guid: cbc6e3e1c08a170489e9a338eee1257f,
type: 3} type: 3}
propertyPath: levelManager propertyPath: levelManager
value: value:
objectReference: {fileID: 279236944} objectReference: {fileID: 279236944}
- target: {fileID: 951264407764097797, guid: cbc6e3e1c08a170489e9a338eee1257f,
type: 3}
propertyPath: velocityslider
value:
objectReference: {fileID: 260633610}
- target: {fileID: 951264407764097797, guid: cbc6e3e1c08a170489e9a338eee1257f,
type: 3}
propertyPath: ui
value:
objectReference: {fileID: 394305455}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: cbc6e3e1c08a170489e9a338eee1257f, type: 3} m_SourcePrefab: {fileID: 100100000, guid: cbc6e3e1c08a170489e9a338eee1257f, type: 3}
This diff is collapsed.
This diff is collapsed.
fileFormatVersion: 2
guid: 75d221baaab6fff42966b5c132c589be
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
...@@ -84,17 +84,24 @@ public class ExtrudedMesh : MonoBehaviour ...@@ -84,17 +84,24 @@ public class ExtrudedMesh : MonoBehaviour
DestroyImmediate(t); DestroyImmediate(t);
; } ; }
if (clone.transform.childCount > 1) if (clone.transform.childCount > 1)
{
var size = clone.transform.childCount;
for (int i = 1; i < size; ++i)
{ {
DestroyImmediate(clone.transform.GetChild(1).gameObject); DestroyImmediate(clone.transform.GetChild(1).gameObject);
} }
}
DestroyImmediate(clone.GetComponentInChildren<ExtrudedMesh>()); DestroyImmediate(clone.GetComponentInChildren<ExtrudedMesh>());
clone.GetComponentInChildren<MeshCollider>().convex = false; clone.GetComponentInChildren<MeshCollider>().convex = false;
clone.GetComponentInChildren<MeshCollider>().sharedMesh = clone.GetComponentInChildren<MeshFilter>().mesh; clone.GetComponentInChildren<MeshCollider>().sharedMesh = clone.GetComponentInChildren<MeshFilter>().mesh;
clone.transform.GetChild(0).gameObject.AddComponent<RuntimeCSGFlatlandObject>(); clone.transform.GetChild(0).gameObject.AddComponent<RuntimeCSGFlatlandObject>();
clone.transform.GetChild(0).gameObject.GetComponent<RuntimeCSGFlatlandObject>().original = transform.parent.gameObject.GetComponent<FlatlandMovement>();
clone.transform.GetChild(0).gameObject.GetComponent<RuntimeCSGFlatlandObject>().clock = transform.parent.gameObject.GetComponent<FlatlandMovement>().time;
//clone.transform.GetChild(0).gameObject.GetComponent<RuntimeCSGFlatlandObject>().player = transform.parent.gameObject.GetComponent<FlatlandMovement>().levelManager.player;
clone.layer = 8; clone.layer = 8;
clone.transform.GetChild(0).gameObject.layer = 8; clone.transform.GetChild(0).gameObject.layer = 8;
Physics.IgnoreCollision(clone.GetComponentInChildren<MeshCollider>(), GetComponent<MeshCollider>()); Physics.IgnoreCollision(clone.GetComponentInChildren<MeshCollider>(), GetComponent<MeshCollider>());
Destroy(clone, 30); Destroy(clone, 20);
prevtime = sections[sections.Count - 1].time; prevtime = sections[sections.Count - 1].time;
} }
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Gridscale : MonoBehaviour
{
private Vector3 defaultScale;
// Start is called before the first frame update
void Start()
{
defaultScale = transform.localScale;
}
// Update is called once per frame
void Update()
{
}
public float Scale
{
set
{
transform.localScale = defaultScale * value;
}
}
}
fileFormatVersion: 2
guid: 99fc8cfec3b50be41b7fe68464704a73
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TutorialLevel2Manager : LevelManager
{
// Start is called before the first frame update
Vector3 orig;
public GameObject target1;
public GameObject target2;
public Clock clock;
bool isCond1;
bool isCond2;
bool isCond3;
protected override void Start()
{
ExplanationText = new string[]{"어서오게 영웅이여!",
"이동의 비법을 터득했으니, 이제 시공간 폭풍의 물체들을 직접 만져볼 때가 왔네.",
"일단 저번 처럼 왼쪽에 있는 목표로 이동을 하세."
};
Todo = "목표 지점까지 이동하세요.";
base.Start();
isCond1 = false;
isCond2 = false;
isCond3 = false;
}
protected override void Update()
{
if (XZLengthSquare(player.transform.position, target1.transform.position) < 0.1 && !isCond1)
Condition1();
if (XZLengthSquare(clock.transform.position, target2.transform.position) < 0.1 && !isCond2)
Condition2();
if (Mathf.Abs((float)(clock.GetApparentTime() - player.time)) > 10.0 && clock.IsGrabbed && !isCond3 && isCond2)
Condition3();
base.Update();
}
protected override bool WinCondition()
{
if (isCond1 && isCond2 && isCond3)
{
return true;
}
else
{
return false;
}
}
protected bool Condition1()
{
if (XZLengthSquare(player.transform.position, target1.transform.position) < 0.1 && !isCond1)
{
isCond1 = true;
ExplanationText = new string[]{"자, 이제 왼쪽에 빨간색의 정사각형의 물체가 보일 것일세.",
"그것은 시계라네. 가까이 다가가서 G를 누르면 잡을수 있고, 시계의 현재 시간을 읽을 수 있지.",
"또한 부딫히면 상대론적 운동량을 보존하면서 튕겨나가는 것을 볼수 있네.",
"참고로 시공간 폭풍의 세계에선 모든 충돌은 완전 탄성 충돌이라네.",
"완전 탄성 충돌이란 건 즉 충돌 전과 후 정지 질량이 변하지 않는다는 말일세!",
"그게 무슨 말이냐고? 으음...나중에 보여주겠네.",
"기획자가 일을 다 하면 말이지.",
"자, 그럼 어서 저 시계를 잡아 목표 지점까지 옮겨보게나.",
"잡고 옮기던, 몸을 부딫혀 던지던 상관 없네." };
uiManager.alert.Alert(ExplanationText);
Todo = "빨간식 시계를 목표 지점까지 옮기세요.";
uiManager.TodoText = Todo;
target1.gameObject.SetActive(false);
return true;
}
else
{
return false;
}
}
protected bool Condition2()
{
if (XZLengthSquare(clock.transform.position, target2.transform.position) < 0.1 && !isCond2)
{
isCond2 = true;
uiManager.WASDMove = WASDMove;
uiManager.PathCreateAble = PathRenderMove;
uiManager.DoubleCLickMove = DoubleClickMove;
ExplanationText = new string[]{"그래 바로 그거야!",
"좌측 상단에 My Proper Time 이라는 장소에 숫자가 있을 것이라네.",
"그건 해당 레벨이 시작한지 자네의 입장에서 몇 초가 지났는지를 재는 시계라네.",
"그런데 저 시계를 보게나. 자네의 시간과 미묘하게 다르지 않나?",
"그렇다네. 자네가 보기에 빠르게 이동하는 것들은 시간이 느리게 흘러간다네.",
"참고로 이건 반대로도 작용해. 모든 물체들은 항상 자기 자신이 정지해있다 생각해!",
"이는 즉, 저 시계 입장에선 자네의 시간이 느리게 흐르게 된다는 것이지.",
"모순 같다고? 전혀 아니라네. 시간과 공간을 따로 생각하지 말고, 함께 3차원 시공간으로 생각하면 전혀 모순이 아니지!",
"한번 저 시계와 자네 시간이 10초 이상 차이나게 바꿔본다음 시계를 잡아보게나."
};
uiManager.alert.Alert(ExplanationText);
Todo = "빨간 시계와 시간이 10초 이상 차이난 상태에서 잡기.";
uiManager.TodoText = Todo;
target2.gameObject.SetActive(false);
return true;
}
else
{
return false;
}
}
protected bool Condition3()
{
if (Mathf.Abs((float)(clock.GetApparentTime() - player.time)) > 10.0 && clock.IsGrabbed && !isCond3 && isCond2)
{
isCond3 = true;
ExplanationText = new string[]{"대단해! 역시 자네는 선택받았군.",
"이것이 바로 시간 지연일세.",
"자네가 방금 보았다 시피, 자네가 보기엔 시계의 시간이 느리게 흐르고, 시계가 보기엔 자네의 시간이 느리게 흐르지만, (계속)",
"시계와 다시 속도를 맞추니 시계가 더 빨리 흐른걸 볼수 있을 것이네.",
"이 이유는 자네가 중간에 가속을 했기 때문이지.",
"가속을 하는 동안은 관성계가 바뀌기 때문에 여러 재미있는 일들이 일어난다네.",
"아, 안타깝게도 새로운 영웅이 나를 부르는군. 여기서부턴 자네가 알아서 헤쳐나가야 한다네.",
"그럼, 이만! 시공간 폭풍에서 또 보게 된다면 그땐 같이 물리학 문제나 하나 풀세!"
};
uiManager.WASDMove = WASDMove;
uiManager.PathCreateAble = PathRenderMove;
uiManager.DoubleCLickMove = DoubleClickMove;
uiManager.alert.Alert(ExplanationText);
player.alpha = new Vector3(0, 0, 0);
player.v = new Vector3(0, 0, 0);
Todo = "";
uiManager.TodoText = Todo;
return true;
}
else
{
return false;
}
}
}
fileFormatVersion: 2
guid: 9794ad354f2c68749b41e08724fc3378
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
...@@ -34,7 +34,7 @@ public class LevelManager : MonoBehaviour ...@@ -34,7 +34,7 @@ public class LevelManager : MonoBehaviour
uiManager.WASDMove = WASDMove; uiManager.WASDMove = WASDMove;
//uiManager.PathCreateAble = PathRenderMove; uiManager.PathCreateAble = PathRenderMove;
uiManager.DoubleCLickMove = DoubleClickMove; uiManager.DoubleCLickMove = DoubleClickMove;
uiManager.TodoText = Todo; uiManager.TodoText = Todo;
...@@ -91,4 +91,9 @@ public class LevelManager : MonoBehaviour ...@@ -91,4 +91,9 @@ public class LevelManager : MonoBehaviour
} }
} }
} }
public float XZLengthSquare(Vector3 a, Vector3 b)
{
return (a.x - b.x) * (a.x - b.x) + (a.z - b.z) * (a.z - b.z);
}
} }
...@@ -8,14 +8,24 @@ using UnityEngine; ...@@ -8,14 +8,24 @@ using UnityEngine;
public class Clock : GrabableObject public class Clock : GrabableObject
{ {
public double starttime = 0.0f; public double starttime = 0.0f;
public Clock otherclock; //public Clock otherclock;
private new void Start() private new void Start()
{ {
base.Start(); base.Start();
time = starttime; time = starttime;
isClock = true;
} }
public override string InteractType
{
get
{
return "grab\n" + "Time : " + apparenttime;
}
}
/*
public override void OnCollisionStaychild(Collision collision) public override void OnCollisionStaychild(Collision collision)
{ {
base.OnCollisionStaychild(collision); base.OnCollisionStaychild(collision);
...@@ -39,12 +49,17 @@ public class Clock : GrabableObject ...@@ -39,12 +49,17 @@ public class Clock : GrabableObject
} }
} }
} }*/
public double GetTime() public double GetTime()
{ {
return time; return time;
} }
public double GetApparentTime()
{
return apparenttime;
}
} }
...@@ -35,6 +35,7 @@ public class FlatlandMovement : MonoBehaviour ...@@ -35,6 +35,7 @@ public class FlatlandMovement : MonoBehaviour
public double time = 0.0f; public double time = 0.0f;
public double apparenttime = 0.0f;
public GameObject theobject; public GameObject theobject;
...@@ -45,6 +46,8 @@ public class FlatlandMovement : MonoBehaviour ...@@ -45,6 +46,8 @@ public class FlatlandMovement : MonoBehaviour
bool isPatrol = false; bool isPatrol = false;
public bool isClock = false;
Vector3 nowDest; Vector3 nowDest;
/// <summary> /// <summary>
/// 앞으로 남은 목적지들. /// 앞으로 남은 목적지들.
...@@ -366,12 +369,11 @@ public class FlatlandMovement : MonoBehaviour ...@@ -366,12 +369,11 @@ public class FlatlandMovement : MonoBehaviour
tmp = new Vector3(tmp.x, 0, tmp.z); tmp = new Vector3(tmp.x, 0, tmp.z);
tmp = tmp.normalized; tmp = tmp.normalized;
tmp = -tmp;
Vector3 otherv = other.v; Vector3 otherv = other.v;
double[] tmpx = {0,tmp.x, tmp.z }; double[] tmpx = {0,tmp.x, tmp.z };
double[] othertmpx = { 0, -tmp.x, -tmp.z }; double[] othertmpx = { 0, tmp.x, tmp.z };
double[] tmpv = { Constants.Gamma(v.magnitude) * Constants.c, Constants.Gamma(v.magnitude) * v.x, Constants.Gamma(v.magnitude) * v.z }; double[] tmpv = { Constants.Gamma(v.magnitude) * Constants.c, Constants.Gamma(v.magnitude) * v.x, Constants.Gamma(v.magnitude) * v.z };
var direction = V.DenseOfArray(tmpx); var direction = V.DenseOfArray(tmpx);
...@@ -421,19 +423,37 @@ public class FlatlandMovement : MonoBehaviour ...@@ -421,19 +423,37 @@ public class FlatlandMovement : MonoBehaviour
- (other.mass * other.mass * other.mass * other.mass * Constants.c * Constants.c * Constants.c * Constants.c * Constants.c * Constants.c * Constants.c * Constants.c) - (other.mass * other.mass * other.mass * other.mass * Constants.c * Constants.c * Constants.c * Constants.c * Constants.c * Constants.c * Constants.c * Constants.c)
- (4 * mass * mass * Constants.c * Constants.c * Constants.c * Constants.c * initialmomentum * initialmomentum * Constants.c * Constants.c * cosine * cosine); - (4 * mass * mass * Constants.c * Constants.c * Constants.c * Constants.c * initialmomentum * initialmomentum * Constants.c * Constants.c * cosine * cosine);
var resultEnergy = (-b + Math.Sqrt((b * b) - 4*(a)*(c)))/(2*a); var resultEnergy = (-b - Math.Sqrt((b * b) - 4*(a)*(c)))/(2*a);
if(resultEnergy < 0) if(resultEnergy < other.mass * Constants.c * Constants.c)
{ {
resultEnergy = (-b - Math.Sqrt((b * b) - 4 * (a) * (c))) / (2 * a); ; var etmp = (-b + Math.Sqrt((b * b) - 4 * (a) * (c))) / (2 * a);
if (etmp > resultEnergy)
resultEnergy = etmp;
} }
resultEnergy = totalenergy - resultEnergy;
var resultvgamma = resultEnergy / (mass * Constants.c * Constants.c); var resultvgamma = resultEnergy / (mass * Constants.c * Constants.c);
var resultvbetamagnitude = Math.Sqrt(1.0 - (1.0/resultvgamma)); var resultvbetamagnitude = Math.Sqrt(1.0 - (1.0/resultvgamma));
double[] tmpv2 = {resultvgamma * Constants.c , resultvgamma * finalcollisionforcedirection.x, resultvgamma * finalcollisionforcedirection.z };
var realfinalvelocity = V.DenseOfArray(tmpv2);
if (otherv.magnitude > 0)
{
realfinalvelocity = Constants.BoostMatrix(-otherv) * realfinalvelocity;
}
if (v.magnitude > 0)
{
realfinalvelocity = Constants.BoostMatrix(v) * realfinalvelocity;
}
var realfinalcollisionvelocitygamma = realfinalvelocity[0] / Constants.c;
Vector3 realfinalcollisionvelocity = new Vector3((float)(realfinalvelocity[1] / realfinalcollisionvelocitygamma), 0, (float)(realfinalvelocity[2] / realfinalcollisionvelocitygamma));
resultvbetamagnitude = realfinalcollisionvelocity.magnitude / Constants.c;
StartCoroutine(_AcceleratetoConstantVelocityWithoutCorrection(realfinalforcedirection,(float)resultvbetamagnitude)); StartCoroutine(_AcceleratetoConstantVelocityWithoutCorrection(realfinalforcedirection,(float)resultvbetamagnitude));
//Debug.Log(collisions.Count); //Debug.Log(collisions.Count);
......
...@@ -54,7 +54,7 @@ public class PathRenderer : MonoBehaviour ...@@ -54,7 +54,7 @@ public class PathRenderer : MonoBehaviour
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{ {
if (Input.GetMouseButtonDown(1) && levelManager.player.IsInertial && pathcreatable) if (Input.GetMouseButtonDown(1) && levelManager.player.IsInertial && pathcreatable && ui.PathMove)
{ {
RaycastHit hit1; RaycastHit hit1;
var ray = Camera.main.ScreenPointToRay(Input.mousePosition); var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
......
...@@ -5,26 +5,39 @@ using MeshMakerNamespace; ...@@ -5,26 +5,39 @@ using MeshMakerNamespace;
public class RuntimeCSGFlatlandObject : MonoBehaviour public class RuntimeCSGFlatlandObject : MonoBehaviour
{ {
public GameObject PastLightCone; public PlayerMovement player;
public GameObject crosssection; public GameObject crosssection;
public Mesh m; public Mesh m;
public FlatlandMovement original;
int cnt = 0; public double clock = 0;
//public CSG csg; //public CSG csg;
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
PastLightCone = GameObject.Find("Cone"); //PastLightCone = GameObject.Find("Cone");
Physics.IgnoreLayerCollision(8, 8); Physics.IgnoreLayerCollision(8, 8);
} }
// Update is called once per frame // Update is called once per frame
void Update() void FixedUpdate()
{ {
if(player == null && original != null)
{
player = original.levelManager.player;
}
if (original != player && original.isClock)
{
var tmp = new Vector3(player.transform.position.x - transform.position.x, 0, player.transform.position.z - transform.position.z);
if (Mathf.Abs((player.transform.position.y - transform.position.y) - (tmp.magnitude)) < 0.1)
{
if (original.apparenttime < clock)
original.apparenttime = clock;
}
}
} }
......
...@@ -18,6 +18,8 @@ public class UIManager : MonoBehaviour ...@@ -18,6 +18,8 @@ public class UIManager : MonoBehaviour
LogScaleSlider accelslider; LogScaleSlider accelslider;
[SerializeField] [SerializeField]
private Text interactText; private Text interactText;
[SerializeField]
Gridscale thegrid;
public Canvas canvas; public Canvas canvas;
public Text mytime; public Text mytime;
...@@ -40,6 +42,7 @@ public class UIManager : MonoBehaviour ...@@ -40,6 +42,7 @@ public class UIManager : MonoBehaviour
public bool WASDMove = true; public bool WASDMove = true;
public bool DoubleCLickMove = true; public bool DoubleCLickMove = true;
public bool PathMove = true;
public AlertManager alert; public AlertManager alert;
...@@ -133,7 +136,7 @@ public class UIManager : MonoBehaviour ...@@ -133,7 +136,7 @@ public class UIManager : MonoBehaviour
cameraMovement.Size += scroll; cameraMovement.Size += scroll;
playerSquare.Scale = 1/cameraMovement.SizeScale; playerSquare.Scale = 1/cameraMovement.SizeScale;
thegrid.Scale = 1 / cameraMovement.SizeScale;
//player movement //player movement
...@@ -207,7 +210,7 @@ public class UIManager : MonoBehaviour ...@@ -207,7 +210,7 @@ public class UIManager : MonoBehaviour
{ {
set set
{ {
pathRenderer.pathcreatable = value; PathMove = value;
} }
} }
......
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