DimShift umgeschrieben sodass es zwei Oberobjekte (Dim1,Dim2) sucht.

Script muss Frank gegeben werden
This commit is contained in:
GungHolo 2023-05-11 15:55:30 +02:00
parent ae790642dd
commit 6590b4ccb5
3 changed files with 182 additions and 81 deletions

View File

@ -8,22 +8,23 @@ public class DimShift : MonoBehaviour
// 0 = inactive in Dimension 1 // 0 = inactive in Dimension 1
// 1 = active in Dimension 1 // 1 = active in Dimension 1
public bool inFirstDim; public bool inFirstDim;
BoxCollider2D col; GameObject Dim1;
SpriteRenderer rend; GameObject Dim2;
void Start() void Start()
{ {
col = GetComponent<BoxCollider2D>(); Dim1 = GameObject.Find("Dim1");
rend = GetComponent<SpriteRenderer>(); Dim2 = GameObject.Find("Dim2");
if (inFirstDim) if (inFirstDim)
{ {
col.enabled = true; Dim1.SetActive(true);
rend.enabled = true; Dim2.SetActive(false);
} else } else
{ {
col.enabled = false; Dim2.SetActive(true);
rend.enabled = false; Dim1.SetActive(false);
} }
} }
@ -31,15 +32,15 @@ public class DimShift : MonoBehaviour
{ {
if (Input.GetKeyDown(KeyCode.LeftShift)&&inFirstDim) if (Input.GetKeyDown(KeyCode.LeftShift)&&inFirstDim)
{ {
col.enabled = false; Dim2.SetActive(true);
rend.enabled = false; Dim1.SetActive(false);
inFirstDim = !inFirstDim; inFirstDim = !inFirstDim;
} else } else
{ {
if (Input.GetKeyDown(KeyCode.LeftShift)&&!inFirstDim) if (Input.GetKeyDown(KeyCode.LeftShift)&&!inFirstDim)
{ {
col.enabled = true; Dim1.SetActive(true);
rend.enabled = true; Dim2.SetActive(false);
inFirstDim = !inFirstDim; inFirstDim = !inFirstDim;
} }
} }

View File

@ -123,6 +123,38 @@ NavMeshSettings:
debug: debug:
m_Flags: 0 m_Flags: 0
m_NavMeshData: {fileID: 0} m_NavMeshData: {fileID: 0}
--- !u!1 &1862626
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1862627}
m_Layer: 0
m_Name: Dim1
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1862627
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1862626}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 2.3932476, y: 0.73239166, z: -0.087166585}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 2028016242}
m_Father: {fileID: 0}
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &57474581 --- !u!1 &57474581
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -250,6 +282,7 @@ GameObject:
- component: {fileID: 103196401} - component: {fileID: 103196401}
- component: {fileID: 103196402} - component: {fileID: 103196402}
- component: {fileID: 103196403} - component: {fileID: 103196403}
- component: {fileID: 103196404}
m_Layer: 0 m_Layer: 0
m_Name: Frank m_Name: Frank
m_TagString: Player m_TagString: Player
@ -427,6 +460,19 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4760965f3d035f84db6a6741d746428c, type: 3} m_Script: {fileID: 11500000, guid: 4760965f3d035f84db6a6741d746428c, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
--- !u!114 &103196404
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 103196395}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bef524aa2ad305d4faf6b90a610e5be4, type: 3}
m_Name:
m_EditorClassIdentifier:
inFirstDim: 1
--- !u!1 &272128638 --- !u!1 &272128638
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -663,7 +709,7 @@ Transform:
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 9 m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &593477712 --- !u!1 &593477712
GameObject: GameObject:
@ -908,7 +954,39 @@ Transform:
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 8 m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &815780627
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 815780628}
m_Layer: 0
m_Name: Dim2
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &815780628
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 815780627}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 2.3932476, y: 0.73239166, z: -0.087166585}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1678984579}
m_Father: {fileID: 0}
m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &893552674 --- !u!1 &893552674
GameObject: GameObject:
@ -1165,7 +1243,6 @@ GameObject:
- component: {fileID: 1678984579} - component: {fileID: 1678984579}
- component: {fileID: 1678984578} - component: {fileID: 1678984578}
- component: {fileID: 1678984577} - component: {fileID: 1678984577}
- component: {fileID: 1678984580}
m_Layer: 0 m_Layer: 0
m_Name: "Schr\xE4geRunter" m_Name: "Schr\xE4geRunter"
m_TagString: Untagged m_TagString: Untagged
@ -1259,26 +1336,13 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1678984576} m_GameObject: {fileID: 1678984576}
m_LocalRotation: {x: -0, y: -0, z: -0.18762979, w: 0.98223984} m_LocalRotation: {x: -0, y: -0, z: -0.18762979, w: 0.98223984}
m_LocalPosition: {x: -0.45, y: -3.66, z: -0.20456332} m_LocalPosition: {x: -2.8432477, y: -4.3923917, z: -0.117396735}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 815780628}
m_RootOrder: 7 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: -21.629} m_LocalEulerAnglesHint: {x: 0, y: 0, z: -21.629}
--- !u!114 &1678984580
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1678984576}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bef524aa2ad305d4faf6b90a610e5be4, type: 3}
m_Name:
m_EditorClassIdentifier:
inFirstDim: 0
--- !u!1 &2028016239 --- !u!1 &2028016239
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1290,7 +1354,6 @@ GameObject:
- component: {fileID: 2028016242} - component: {fileID: 2028016242}
- component: {fileID: 2028016241} - component: {fileID: 2028016241}
- component: {fileID: 2028016240} - component: {fileID: 2028016240}
- component: {fileID: 2028016243}
m_Layer: 0 m_Layer: 0
m_Name: "Schr\xE4geHoch" m_Name: "Schr\xE4geHoch"
m_TagString: Untagged m_TagString: Untagged
@ -1384,23 +1447,10 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2028016239} m_GameObject: {fileID: 2028016239}
m_LocalRotation: {x: -0, y: -0, z: 0.22760111, w: 0.97375447} m_LocalRotation: {x: -0, y: -0, z: 0.22760111, w: 0.97375447}
m_LocalPosition: {x: -5.49, y: -3.75, z: -0.20456332} m_LocalPosition: {x: -7.8832474, y: -4.482392, z: -0.117396735}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 1862627}
m_RootOrder: 6 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 26.312} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 26.312}
--- !u!114 &2028016243
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2028016239}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bef524aa2ad305d4faf6b90a610e5be4, type: 3}
m_Name:
m_EditorClassIdentifier:
inFirstDim: 0

View File

@ -477,6 +477,7 @@ GameObject:
- component: {fileID: 792973168} - component: {fileID: 792973168}
- component: {fileID: 792973169} - component: {fileID: 792973169}
- component: {fileID: 792973170} - component: {fileID: 792973170}
- component: {fileID: 792973171}
m_Layer: 0 m_Layer: 0
m_Name: Player m_Name: Player
m_TagString: Untagged m_TagString: Untagged
@ -570,7 +571,7 @@ Transform:
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 5 m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!70 &792973168 --- !u!70 &792973168
CapsuleCollider2D: CapsuleCollider2D:
@ -621,6 +622,19 @@ MonoBehaviour:
gravityScale: 1.5 gravityScale: 1.5
mainCamera: {fileID: 0} mainCamera: {fileID: 0}
grounded: 0 grounded: 0
--- !u!114 &792973171
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 792973161}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bef524aa2ad305d4faf6b90a610e5be4, type: 3}
m_Name:
m_EditorClassIdentifier:
inFirstDim: 1
--- !u!1 &921148899 --- !u!1 &921148899
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -632,7 +646,6 @@ GameObject:
- component: {fileID: 921148901} - component: {fileID: 921148901}
- component: {fileID: 921148900} - component: {fileID: 921148900}
- component: {fileID: 921148902} - component: {fileID: 921148902}
- component: {fileID: 921148903}
m_Layer: 0 m_Layer: 0
m_Name: Platform m_Name: Platform
m_TagString: Untagged m_TagString: Untagged
@ -699,13 +712,13 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 921148899} m_GameObject: {fileID: 921148899}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 2, y: -0.5, z: 0} m_LocalPosition: {x: -0.3932476, y: -1.2323916, z: 0.087166585}
m_LocalScale: {x: 3.1765, y: 1, z: 1} m_LocalScale: {x: 3.1765, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 1561360181}
m_RootOrder: 4 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!61 &921148902 --- !u!61 &921148902
BoxCollider2D: BoxCollider2D:
@ -733,19 +746,70 @@ BoxCollider2D:
serializedVersion: 2 serializedVersion: 2
m_Size: {x: 1, y: 1} m_Size: {x: 1, y: 1}
m_EdgeRadius: 0 m_EdgeRadius: 0
--- !u!114 &921148903 --- !u!1 &1561360180
MonoBehaviour: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 921148899} serializedVersion: 6
m_Enabled: 1 m_Component:
m_EditorHideFlags: 0 - component: {fileID: 1561360181}
m_Script: {fileID: 11500000, guid: bef524aa2ad305d4faf6b90a610e5be4, type: 3} m_Layer: 0
m_Name: m_Name: Dim1
m_EditorClassIdentifier: m_TagString: Untagged
inFirstDim: 1 m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1561360181
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1561360180}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 2.3932476, y: 0.73239166, z: -0.087166585}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 921148901}
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1731851785
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1731851786}
m_Layer: 0
m_Name: Dim2
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1731851786
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1731851785}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 2.3932476, y: 0.73239166, z: -0.087166585}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 2021624531}
m_Father: {fileID: 0}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2021624529 --- !u!1 &2021624529
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -757,7 +821,6 @@ GameObject:
- component: {fileID: 2021624531} - component: {fileID: 2021624531}
- component: {fileID: 2021624530} - component: {fileID: 2021624530}
- component: {fileID: 2021624532} - component: {fileID: 2021624532}
- component: {fileID: 2021624533}
m_Layer: 0 m_Layer: 0
m_Name: Wall m_Name: Wall
m_TagString: Untagged m_TagString: Untagged
@ -824,13 +887,13 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2021624529} m_GameObject: {fileID: 2021624529}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 5.53, y: -0.4927, z: 0} m_LocalPosition: {x: 3.1367526, y: -1.2250917, z: 0.087166585}
m_LocalScale: {x: 1, y: 5.0057, z: 1} m_LocalScale: {x: 1, y: 5.0057, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 1731851786}
m_RootOrder: 3 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!61 &2021624532 --- !u!61 &2021624532
BoxCollider2D: BoxCollider2D:
@ -858,16 +921,3 @@ BoxCollider2D:
serializedVersion: 2 serializedVersion: 2
m_Size: {x: 1, y: 1} m_Size: {x: 1, y: 1}
m_EdgeRadius: 0 m_EdgeRadius: 0
--- !u!114 &2021624533
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2021624529}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bef524aa2ad305d4faf6b90a610e5be4, type: 3}
m_Name:
m_EditorClassIdentifier:
inFirstDim: 0