Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor fix and make transition scene clickable #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Assets/Scenes/Final_Levels/level_yusheng.unity
Original file line number Diff line number Diff line change
Expand Up @@ -9691,7 +9691,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 615815409}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 74836429c8b73004e974503e1586a567, type: 3}
m_Name:
Expand Down
209 changes: 6 additions & 203 deletions Assets/Scenes/Transition_1.unity
Original file line number Diff line number Diff line change
Expand Up @@ -840,126 +840,6 @@ Transform:
m_Children: []
m_Father: {fileID: 347191746}
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1001 &145147538
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 1820482420}
m_Modifications:
- target: {fileID: -8679921383154817045, guid: 9354bb6d278564e44b5f4d8ff24ef4d1,
type: 3}
propertyPath: m_LocalPosition.x
value: 10.469086
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 9354bb6d278564e44b5f4d8ff24ef4d1,
type: 3}
propertyPath: m_LocalPosition.y
value: -0.038270235
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 9354bb6d278564e44b5f4d8ff24ef4d1,
type: 3}
propertyPath: m_LocalPosition.z
value: 23.914597
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 9354bb6d278564e44b5f4d8ff24ef4d1,
type: 3}
propertyPath: m_LocalRotation.w
value: 0.00000044703478
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 9354bb6d278564e44b5f4d8ff24ef4d1,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 9354bb6d278564e44b5f4d8ff24ef4d1,
type: 3}
propertyPath: m_LocalRotation.y
value: -1
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 9354bb6d278564e44b5f4d8ff24ef4d1,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 9354bb6d278564e44b5f4d8ff24ef4d1,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 9354bb6d278564e44b5f4d8ff24ef4d1,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: -180
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 9354bb6d278564e44b5f4d8ff24ef4d1,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: -7511558181221131132, guid: 9354bb6d278564e44b5f4d8ff24ef4d1,
type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: 08f441f5727180f4daec77243ebad507, type: 2}
- target: {fileID: 919132149155446097, guid: 9354bb6d278564e44b5f4d8ff24ef4d1,
type: 3}
propertyPath: m_Name
value: BasicWall (28)
objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: 9354bb6d278564e44b5f4d8ff24ef4d1,
type: 3}
propertyPath: m_Layer
value: 6
objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: 9354bb6d278564e44b5f4d8ff24ef4d1,
type: 3}
propertyPath: m_StaticEditorFlags
value: 2147483647
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: 9354bb6d278564e44b5f4d8ff24ef4d1,
type: 3}
insertIndex: -1
addedObject: {fileID: 145147540}
m_SourcePrefab: {fileID: 100100000, guid: 9354bb6d278564e44b5f4d8ff24ef4d1, type: 3}
--- !u!1 &145147539 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: 9354bb6d278564e44b5f4d8ff24ef4d1,
type: 3}
m_PrefabInstance: {fileID: 145147538}
m_PrefabAsset: {fileID: 0}
--- !u!65 &145147540
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 145147539}
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: 2, y: 2, z: 0.26}
m_Center: {x: 0, y: 1, z: 0}
--- !u!4 &145147541 stripped
Transform:
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 9354bb6d278564e44b5f4d8ff24ef4d1,
type: 3}
m_PrefabInstance: {fileID: 145147538}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &149475369
PrefabInstance:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -4390,7 +4270,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!4 &615815410
Transform:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -4421,6 +4301,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
InteractPrompt:
DialogueFile: {fileID: 4900000, guid: c144c7b6013564e43bf485ab6030d7e9, type: 3}
spriteRenderer: {fileID: 0}
fadeDuration: 0.05
--- !u!136 &615815412
CapsuleCollider:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -12375,7 +12257,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!4 &1768742975
Transform:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -12406,6 +12288,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
InteractPrompt:
DialogueFile: {fileID: 4900000, guid: 6edf57fed374a014889849a1679c5dbb, type: 3}
spriteRenderer: {fileID: 0}
fadeDuration: 0.05
--- !u!136 &1768742977
CapsuleCollider:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -13105,7 +12989,6 @@ Transform:
- {fileID: 2067856035}
- {fileID: 1264355451}
- {fileID: 1579180835}
- {fileID: 145147541}
- {fileID: 189553964}
- {fileID: 247690065}
- {fileID: 113787271}
Expand Down Expand Up @@ -13666,7 +13549,6 @@ Transform:
- {fileID: 1594255093}
- {fileID: 766795502}
- {fileID: 999095457}
- {fileID: 1977271773}
- {fileID: 651929679}
- {fileID: 371356955}
- {fileID: 1493836067}
Expand Down Expand Up @@ -14350,85 +14232,6 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 1972700816}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &1977271772
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 1881055534}
m_Modifications:
- target: {fileID: 1288569082625665306, guid: b4bb0b6901f632d409cfd7a347760409,
type: 3}
propertyPath: m_Name
value: UpperWall (52)
objectReference: {fileID: 0}
- target: {fileID: 1288569082625665306, guid: b4bb0b6901f632d409cfd7a347760409,
type: 3}
propertyPath: m_StaticEditorFlags
value: 2147483647
objectReference: {fileID: 0}
- target: {fileID: 1921412428651066272, guid: b4bb0b6901f632d409cfd7a347760409,
type: 3}
propertyPath: m_LocalPosition.x
value: 10.45966
objectReference: {fileID: 0}
- target: {fileID: 1921412428651066272, guid: b4bb0b6901f632d409cfd7a347760409,
type: 3}
propertyPath: m_LocalPosition.y
value: 1.9617298
objectReference: {fileID: 0}
- target: {fileID: 1921412428651066272, guid: b4bb0b6901f632d409cfd7a347760409,
type: 3}
propertyPath: m_LocalPosition.z
value: 23.914597
objectReference: {fileID: 0}
- target: {fileID: 1921412428651066272, guid: b4bb0b6901f632d409cfd7a347760409,
type: 3}
propertyPath: m_LocalRotation.w
value: 0.00000044703478
objectReference: {fileID: 0}
- target: {fileID: 1921412428651066272, guid: b4bb0b6901f632d409cfd7a347760409,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 1921412428651066272, guid: b4bb0b6901f632d409cfd7a347760409,
type: 3}
propertyPath: m_LocalRotation.y
value: -1
objectReference: {fileID: 0}
- target: {fileID: 1921412428651066272, guid: b4bb0b6901f632d409cfd7a347760409,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 1921412428651066272, guid: b4bb0b6901f632d409cfd7a347760409,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1921412428651066272, guid: b4bb0b6901f632d409cfd7a347760409,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: -180
objectReference: {fileID: 0}
- target: {fileID: 1921412428651066272, guid: b4bb0b6901f632d409cfd7a347760409,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: b4bb0b6901f632d409cfd7a347760409, type: 3}
--- !u!4 &1977271773 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 1921412428651066272, guid: b4bb0b6901f632d409cfd7a347760409,
type: 3}
m_PrefabInstance: {fileID: 1977271772}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &1984661789
PrefabInstance:
m_ObjectHideFlags: 0
Expand Down
23 changes: 21 additions & 2 deletions Assets/Scripts/SceneSetup/TransitionSceneController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ public class Transition : MonoBehaviour
public float displayDuration = 3.0f; // Duration to show each image
private int currentImageIndex = 0; // Track the current image
private bool canMoveToNextLevel = false;
private bool isTransitioning = false; // Track if a transition is ongoing

// Start is called before the first frame update
void Start()
{
Expand All @@ -29,6 +31,7 @@ private void ShowNextImage()
{
// Activate the current image
transitionImages[currentImageIndex].SetActive(true);
isTransitioning = true;

// Schedule the next image to be shown after the current one has been displayed
Invoke(nameof(HideCurrentAndShowNext), displayDuration);
Expand All @@ -47,7 +50,7 @@ private void HideCurrentAndShowNext()

// Move to the next image
currentImageIndex++;

isTransitioning = false;
// Show the next image in sequence
ShowNextImage();
}
Expand All @@ -57,7 +60,23 @@ private void AllowPlayerToMove()
{
canMoveToNextLevel = true;
}
}

void Update()
{
// Detect mouse click or screen tap
if (Input.GetMouseButtonDown(0) && !canMoveToNextLevel) // Left mouse button or screen tap
{
// Cancel the automatic transition (Invoke)
if (isTransitioning)
{
CancelInvoke(nameof(HideCurrentAndShowNext));
}

// Move to the next image manually
HideCurrentAndShowNext();
}
}
}

// Update is called once per frame
//void Update()
Expand Down