mehr sachen
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: be7333a9c36d5a9449c92a6ee32221af
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -206,7 +206,7 @@ Transform:
|
||||
m_GameObject: {fileID: 127041522}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 18.15, y: 10.32, z: -33.8}
|
||||
m_LocalPosition: {x: 53.2, y: 10.32, z: 32.1}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
@@ -567,6 +567,135 @@ PrefabInstance:
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 46014def5fa85504abb9cc3190ae45e3, type: 3}
|
||||
--- !u!1 &1585096096
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1585096100}
|
||||
- component: {fileID: 1585096099}
|
||||
- component: {fileID: 1585096098}
|
||||
- component: {fileID: 1585096103}
|
||||
- component: {fileID: 1585096101}
|
||||
m_Layer: 0
|
||||
m_Name: Cube
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!23 &1585096098
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1585096096}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RayTracingAccelStructBuildFlagsOverride: 0
|
||||
m_RayTracingAccelStructBuildFlags: 1
|
||||
m_SmallMeshCulling: 1
|
||||
m_ForceMeshLod: -1
|
||||
m_MeshLodSelectionBias: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
|
||||
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: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_GlobalIlluminationMeshLod: 0
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_MaskInteraction: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!33 &1585096099
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1585096096}
|
||||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!4 &1585096100
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1585096096}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 55.13, y: 9.57, z: 49.51}
|
||||
m_LocalScale: {x: 10, y: 18.479692, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!65 &1585096101
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1585096096}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Size: {x: 1, y: 0.99999994, z: 1}
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1585096103
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1585096096}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 06852f09d119f7647b099917df7e799a, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::Door_Rotate
|
||||
openAngle: 90
|
||||
rotationSpeed: 2
|
||||
interactionDistance: 18
|
||||
rotationOffset: {x: 1, y: 0, z: 0}
|
||||
--- !u!1 &1734103108
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -703,3 +832,4 @@ SceneRoots:
|
||||
- {fileID: 1196469502}
|
||||
- {fileID: 812433625}
|
||||
- {fileID: 718992225}
|
||||
- {fileID: 1585096100}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class Door_Rotate : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private float openAngle = 90f;
|
||||
[SerializeField] private float rotationSpeed = 2f;
|
||||
[SerializeField] private float interactionDistance = 5f;
|
||||
[SerializeField] private Vector3 rotationOffset = Vector3.zero;
|
||||
|
||||
private float targetRotation = 0f;
|
||||
private float currentRotation = 0f;
|
||||
private bool isOpen = false;
|
||||
private Camera playerCamera;
|
||||
private Vector3 pivotPoint;
|
||||
|
||||
|
||||
void Start()
|
||||
{
|
||||
playerCamera = Camera.main;
|
||||
currentRotation = transform.localEulerAngles.y;
|
||||
targetRotation = currentRotation;
|
||||
|
||||
// Calculate pivot point from rotation offset
|
||||
pivotPoint = transform.position + rotationOffset;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.E) && IsPlayerLooking())
|
||||
{
|
||||
ToggleDoor();
|
||||
}
|
||||
|
||||
SmoothRotateDoor();
|
||||
}
|
||||
|
||||
private void ToggleDoor()
|
||||
{
|
||||
isOpen = !isOpen;
|
||||
targetRotation = isOpen ? currentRotation + openAngle : currentRotation - openAngle;
|
||||
}
|
||||
|
||||
private void SmoothRotateDoor()
|
||||
{
|
||||
currentRotation = Mathf.Lerp(currentRotation, targetRotation, Time.deltaTime * rotationSpeed);
|
||||
|
||||
// Rotate around the pivot point
|
||||
transform.RotateAround(pivotPoint, Vector3.up, (currentRotation - transform.localEulerAngles.y));
|
||||
transform.localEulerAngles = new Vector3(
|
||||
transform.localEulerAngles.x,
|
||||
currentRotation,
|
||||
transform.localEulerAngles.z
|
||||
);
|
||||
}
|
||||
|
||||
private bool IsPlayerLooking()
|
||||
{
|
||||
if (playerCamera == null) return false;
|
||||
|
||||
Ray ray = new Ray(playerCamera.transform.position, playerCamera.transform.forward);
|
||||
float distanceToPlayer = Vector3.Distance(playerCamera.transform.position, transform.position);
|
||||
|
||||
if (distanceToPlayer > interactionDistance) return false;
|
||||
|
||||
if (Physics.Raycast(ray, out RaycastHit hit, interactionDistance))
|
||||
{
|
||||
return hit.collider.gameObject == gameObject;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 06852f09d119f7647b099917df7e799a
|
||||
@@ -1,4 +1,4 @@
|
||||
//Oliver
|
||||
//Oliver&Morten
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
<Solution>
|
||||
<Project Path="Assembly-CSharp-Editor.csproj" />
|
||||
<Project Path="Assembly-CSharp.csproj" />
|
||||
<Project Path="Assembly-CSharp-Editor.csproj" />
|
||||
</Solution>
|
||||
|
||||
Reference in New Issue
Block a user