game: added scene transitions
This commit is contained in:
parent
290ec9182f
commit
7b1b1f3551
4 changed files with 101 additions and 1 deletions
|
@ -270210,6 +270210,59 @@ Mesh:
|
||||||
offset: 0
|
offset: 0
|
||||||
size: 0
|
size: 0
|
||||||
path:
|
path:
|
||||||
|
--- !u!1 &1357420348
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1357420350}
|
||||||
|
- component: {fileID: 1357420349}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: GameObject
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!65 &1357420349
|
||||||
|
BoxCollider:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1357420348}
|
||||||
|
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: 1, z: 1}
|
||||||
|
m_Center: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!4 &1357420350
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1357420348}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: -8.14, y: 21.52, z: 1100.15}
|
||||||
|
m_LocalScale: {x: 2.4713, y: 2.228, z: 5.2751546}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!43 &1359399347
|
--- !u!43 &1359399347
|
||||||
Mesh:
|
Mesh:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -481689,3 +481742,4 @@ SceneRoots:
|
||||||
- {fileID: 231932035}
|
- {fileID: 231932035}
|
||||||
- {fileID: 1168956924}
|
- {fileID: 1168956924}
|
||||||
- {fileID: 205722624}
|
- {fileID: 205722624}
|
||||||
|
- {fileID: 1357420350}
|
||||||
|
|
35
Game/Assets/Scripts/SceneTransition.cs
Normal file
35
Game/Assets/Scripts/SceneTransition.cs
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class SceneTransition : MonoBehaviour
|
||||||
|
{
|
||||||
|
public Image fadeImage; // Assign the black image here
|
||||||
|
public float fadeDuration = 2f;
|
||||||
|
|
||||||
|
private void OnTriggerEnter(Collider other)
|
||||||
|
{
|
||||||
|
if (other.CompareTag("School"))
|
||||||
|
{
|
||||||
|
StartCoroutine(FadeOutAndLoadScene());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerator FadeOutAndLoadScene()
|
||||||
|
{
|
||||||
|
float elapsed = 0f;
|
||||||
|
|
||||||
|
while (elapsed < fadeDuration)
|
||||||
|
{
|
||||||
|
elapsed += Time.deltaTime;
|
||||||
|
float alpha = Mathf.Clamp01(elapsed / fadeDuration);
|
||||||
|
fadeImage.color = new Color(0, 0, 0, alpha);
|
||||||
|
yield return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
SceneManager.LoadScene("NextScene");
|
||||||
|
}
|
||||||
|
}
|
11
Game/Assets/Scripts/SceneTransition.cs.meta
Normal file
11
Game/Assets/Scripts/SceneTransition.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e2f6a72b32042234d96a9c2363070f6a
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -144,7 +144,7 @@
|
||||||
{
|
{
|
||||||
"type": "System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
|
"type": "System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
|
||||||
"key": "ShapeBuilder.ActiveShapeIndex",
|
"key": "ShapeBuilder.ActiveShapeIndex",
|
||||||
"value": "{\"m_Value\":1}"
|
"value": "{\"m_Value\":6}"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
|
"type": "System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
|
||||||
|
|
Loading…
Add table
Reference in a new issue