diff --git a/Assets/DirectionPaddle.cs b/Assets/DirectionPaddle.cs index 7d7f6a0..e581983 100644 --- a/Assets/DirectionPaddle.cs +++ b/Assets/DirectionPaddle.cs @@ -1,18 +1,18 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class DirectionPaddle : MonoBehaviour -{ - public void Switch() - { - gameObject.SetActive(!gameObject.activeSelf); - } - +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class DirectionPaddle : MonoBehaviour +{ + public void Switch() + { + gameObject.SetActive(!gameObject.activeSelf); + } + public void InteractNode() { this.GetComponent().enabled = !this.GetComponent().enabled; this.GetComponent().enabled = !this.GetComponent().enabled; - } -} + } +} diff --git a/Assets/Meta/MainCamera Blends.asset b/Assets/Meta/MainCamera Blends.asset new file mode 100644 index 0000000..09b3757 --- /dev/null +++ b/Assets/Meta/MainCamera Blends.asset @@ -0,0 +1,26 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 36baaa8bdcb9d8b49b9199833965d2c3, type: 3} + m_Name: MainCamera Blends + m_EditorClassIdentifier: + m_CustomBlends: + - m_From: PlayerFollowCamera + m_To: NetworkCamera + m_Blend: + m_Style: 1 + m_Time: 2 + m_CustomCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 0 + m_PostInfinity: 0 + m_RotationOrder: 0 diff --git a/Assets/Meta/MainCamera Blends.asset.meta b/Assets/Meta/MainCamera Blends.asset.meta new file mode 100644 index 0000000..752afed --- /dev/null +++ b/Assets/Meta/MainCamera Blends.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1a5487502a2d87546aacec9c115d0ae4 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Models/Mainzkraut.unity b/Assets/Models/Mainzkraut.unity index 74b91a8..fba0d48 100644 --- a/Assets/Models/Mainzkraut.unity +++ b/Assets/Models/Mainzkraut.unity @@ -249,7 +249,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 148347071} m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071068} - m_LocalPosition: {x: -20.6132, y: 2.7, z: 20.8} + m_LocalPosition: {x: -20.6132, y: 2.3741, z: 20.8} m_LocalScale: {x: 1, y: 0.1695, z: 13.294952} m_Children: [] m_Father: {fileID: 0} @@ -682,6 +682,8 @@ GameObject: - component: {fileID: 561286948} - component: {fileID: 561286950} - component: {fileID: 561286949} + - component: {fileID: 561286951} + - component: {fileID: 561286952} m_Layer: 0 m_Name: NetworkCamera m_TagString: MainCamera @@ -699,7 +701,8 @@ Transform: m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068} m_LocalPosition: {x: 21.1, y: 57.8, z: 2.9} m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] + m_Children: + - {fileID: 1669835644} m_Father: {fileID: 2007571030} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} @@ -754,6 +757,58 @@ Camera: m_OcclusionCulling: 1 m_StereoConvergence: 10 m_StereoSeparation: 0.022 +--- !u!114 &561286951 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 561286947} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 364c461b2fc6fda47a92951a29c3ffa6, type: 3} + m_Name: + m_EditorClassIdentifier: + targetPosition: {x: 0, y: 0, z: 0} + lerpSpeed: 10 +--- !u!114 &561286952 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 561286947} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 45e653bab7fb20e499bda25e1b646fea, type: 3} + m_Name: + m_EditorClassIdentifier: + m_ExcludedPropertiesInInspector: + - m_Script + m_LockStageInInspector: + m_StreamingVersion: 20170927 + m_Priority: 10 + m_StandbyUpdate: 2 + m_LookAt: {fileID: 0} + m_Follow: {fileID: 0} + m_Lens: + FieldOfView: 40 + OrthographicSize: 10 + NearClipPlane: 0.1 + FarClipPlane: 5000 + Dutch: 0 + ModeOverride: 0 + LensShift: {x: 0, y: 0} + GateFit: 2 + m_SensorSize: {x: 2.0142276, y: 1} + m_Transitions: + m_BlendHint: 0 + m_InheritPosition: 0 + m_OnCameraLive: + m_PersistentCalls: + m_Calls: [] + m_LegacyBlendHint: 0 + m_ComponentOwner: {fileID: 1669835644} --- !u!1001 &628834931 PrefabInstance: m_ObjectHideFlags: 0 @@ -1609,7 +1664,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1251740556} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -20.7115, y: 2.8659, z: 21.6117} + m_LocalPosition: {x: -20.7115, y: 2.54, z: 21.6117} m_LocalScale: {x: 13.023529, y: 0.6214046, z: 0.55476} m_Children: [] m_Father: {fileID: 0} @@ -2014,7 +2069,7 @@ BoxCollider: m_GameObject: {fileID: 1643453143} m_Material: {fileID: 0} m_IsTrigger: 0 - m_Enabled: 1 + m_Enabled: 0 serializedVersion: 2 m_Size: {x: 1, y: 1, z: 1} m_Center: {x: 0, y: 0, z: 0} @@ -2025,7 +2080,7 @@ MeshRenderer: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1643453143} - m_Enabled: 1 + m_Enabled: 0 m_CastShadows: 1 m_ReceiveShadows: 1 m_DynamicOccludee: 1 @@ -2075,13 +2130,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1643453143} - m_LocalRotation: {x: -0, y: -0.272418, z: -0, w: 0.96217906} - m_LocalPosition: {x: -27.88, y: 2.66, z: 21.26} + m_LocalRotation: {x: 0, y: -0.42198536, z: 0, w: 0.9066027} + m_LocalPosition: {x: -27.88, y: 2.66, z: 20.72} m_LocalScale: {x: -2.13, y: 1.72868, z: 0.44} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 17 - m_LocalEulerAnglesHint: {x: 0, y: -31.616, z: 0} + m_LocalEulerAnglesHint: {x: 0, y: -49.92, z: 0} --- !u!114 &1643453148 MonoBehaviour: m_ObjectHideFlags: 0 @@ -2094,6 +2149,49 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 1dd01c3c2c2957047b7d50418f02cc31, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1 &1669835643 +GameObject: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1669835644} + - component: {fileID: 1669835645} + m_Layer: 0 + m_Name: cm + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1669835644 +Transform: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1669835643} + m_LocalRotation: {x: -0.7071068, y: -0, z: -0, w: 0.7071068} + m_LocalPosition: {x: 11.851248, y: -2.522026, z: 34.29633} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 561286948} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1669835645 +MonoBehaviour: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1669835643} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ac0b09e7857660247b1477e93731de29, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &1670753798 GameObject: m_ObjectHideFlags: 0 @@ -2609,7 +2707,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2033690144} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -20.8937, y: 2.7696, z: 20.32} + m_LocalPosition: {x: -20.8937, y: 2.4436998, z: 20.32} m_LocalScale: {x: 13.3880825, y: 0.4286245, z: 0.021057745} m_Children: [] m_Father: {fileID: 0} @@ -6570,6 +6668,10 @@ PrefabInstance: propertyPath: far clip plane value: 500 objectReference: {fileID: 0} + - target: {fileID: 9005220659476430821, guid: 2d3a85ecde41a8246a79669975912b74, type: 3} + propertyPath: near clip plane + value: 0.2 + objectReference: {fileID: 0} - target: {fileID: 9005220659476430821, guid: 2d3a85ecde41a8246a79669975912b74, type: 3} propertyPath: orthographic size value: 10 @@ -6594,6 +6696,10 @@ PrefabInstance: propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} + - target: {fileID: 9018249871969862650, guid: 2d3a85ecde41a8246a79669975912b74, type: 3} + propertyPath: m_CustomBlends + value: + objectReference: {fileID: 11400000, guid: 1a5487502a2d87546aacec9c115d0ae4, type: 2} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 2d3a85ecde41a8246a79669975912b74, type: 3} --- !u!1001 &5393215579111688471 diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index f8e6871..4c7ca87 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -1,6 +1,7 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; +using UnityEngine.InputSystem; public class GameManager : MonoBehaviour { @@ -8,18 +9,20 @@ public class GameManager : MonoBehaviour public GameObject player; public Camera[] cameras; public GameObject networkCamera; - + public GameObject activeNode; + // Start is called before the first frame update void Start() { - + } public void SetActiveCamera(int cam) { for (int i = 0; i < cameras.Length; i++) { - if (i==cam) { + if (i == cam) + { } cameras[i].enabled = (i == cam); @@ -29,6 +32,17 @@ public class GameManager : MonoBehaviour // Update is called once per frame void Update() { - + + } + + private void FixedUpdate() + { + + if (Keyboard.current.xKey.wasPressedThisFrame) + { + SetActiveCamera(0); + activeNode.GetComponent().DisableNode(); + activeNode = null; + } } } diff --git a/Assets/Scripts/Items/Conveyer.cs b/Assets/Scripts/Items/Conveyer.cs index 98af165..d618d39 100644 --- a/Assets/Scripts/Items/Conveyer.cs +++ b/Assets/Scripts/Items/Conveyer.cs @@ -19,7 +19,11 @@ public class Conveyer : MonoBehaviour foreach (ContactPoint contact in collision.contacts) { //Debug.Log(string.Format("Current Collider: {0} Position {1}", contact.otherCollider.name, contact.otherCollider.transform.position.magnitude)); - contact.otherCollider.GetComponent().AddForce(transform.forward * (conveyerSpeed * direction), ForceMode.Acceleration); + if(contact.otherCollider.GetComponent().velocity.magnitude < conveyerSpeed) + { + contact.otherCollider.GetComponent().AddForce(transform.forward * (conveyerSpeed * direction), ForceMode.Acceleration); + + } } } } diff --git a/Assets/Scripts/Network/NetworkCamera.cs b/Assets/Scripts/Network/NetworkCamera.cs new file mode 100644 index 0000000..974877f --- /dev/null +++ b/Assets/Scripts/Network/NetworkCamera.cs @@ -0,0 +1,21 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class NetworkCamera : MonoBehaviour +{ + + public Vector3 targetPosition; + public float lerpSpeed = 2; + // Start is called before the first frame update + void Start() + { + targetPosition = transform.position; + } + + // Update is called once per frame + void Update() + { + transform.position = Vector3.Lerp(transform.position, targetPosition, Time.deltaTime * lerpSpeed); + } +} diff --git a/Assets/Scripts/Network/NetworkCamera.cs.meta b/Assets/Scripts/Network/NetworkCamera.cs.meta new file mode 100644 index 0000000..3d4cc51 --- /dev/null +++ b/Assets/Scripts/Network/NetworkCamera.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 364c461b2fc6fda47a92951a29c3ffa6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Network/Node.cs b/Assets/Scripts/Network/Node.cs index 92f2432..e7477d0 100644 --- a/Assets/Scripts/Network/Node.cs +++ b/Assets/Scripts/Network/Node.cs @@ -27,9 +27,16 @@ public class Node : MonoBehaviour { if (isActive) { return; } Debug.Log(string.Format("{0} became active node", gameObject.name)); - isActive = true; UI.SetActive(true); - gameManager.networkCamera.transform.position = new Vector3(transform.position.x, gameManager.networkCamera.transform.position.y, transform.position.z); + gameManager.activeNode = this.gameObject; + gameManager.networkCamera.GetComponent().targetPosition = new Vector3(transform.position.x, gameManager.networkCamera.transform.position.y, transform.position.z); + isActive = true; + } + + public void DisableNode() + { + UI.SetActive(false); + isActive = false; } public void MoveToDirection(Direction dir) @@ -38,8 +45,7 @@ public class Node : MonoBehaviour if (nodeComp) { nodeComp.SetActiveNode(); - UI.SetActive(false); - isActive = false; + DisableNode(); } else { connections[(int)dir].SendMessage("InteractNode"); diff --git a/Assets/Scripts/Network/Switch.cs b/Assets/Scripts/Network/Switch.cs index 5111f85..5af5079 100644 --- a/Assets/Scripts/Network/Switch.cs +++ b/Assets/Scripts/Network/Switch.cs @@ -30,7 +30,7 @@ public class Switch : MonoBehaviour { if (Vector3.Distance(transform.position, gameManager.player.transform.position) < interactionDistance) { //Debug.Log("Switch is visible and in range"); - if (Keyboard.current.eKey.wasPressedThisFrame) + if (Keyboard.current.eKey.wasPressedThisFrame && !gameManager.activeNode) { gameManager.SetActiveCamera(1); debugNode.SendMessage("SetActiveNode", debugNode.GetComponent());