Add changing scene to tutorial map after entering the cave

This commit is contained in:
kabix09 2022-05-15 16:40:58 +02:00
parent d4fcd571a7
commit fd0bbec1e9
8 changed files with 276 additions and 2 deletions

View File

@ -57,6 +57,7 @@
<Compile Include="Assets\Controller.cs" />
<Compile Include="Assets\Scripts\Objects&apos; Scripts\Chest.cs" />
<Compile Include="Assets\Scripts\Enemies&apos; Scprits\Slimes.cs" />
<Compile Include="Assets\Scripts\DoorBehaviour.cs" />
<Compile Include="Assets\Scripts\ChangeScene.cs" />
<Compile Include="Assets\Scripts\Player.cs" />
<None Include="Assets\TextMesh Pro\Shaders\TMPro.cginc" />

View File

@ -173,6 +173,7 @@ GameObject:
- component: {fileID: 167690938}
- component: {fileID: 167690943}
- component: {fileID: 167690944}
- component: {fileID: 167690945}
m_Layer: 0
m_Name: mainCh_standing
m_TagString: Player
@ -339,6 +340,18 @@ Animator:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0
--- !u!114 &167690945
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 167690937}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 48a2ec1fec857c946ae3ae8e69b29562, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &519420028
GameObject:
m_ObjectHideFlags: 0
@ -51475,6 +51488,99 @@ Tilemap:
e31: 0
e32: 0
e33: 1
--- !u!1 &1193017321
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1193017325}
- component: {fileID: 1193017324}
- component: {fileID: 1193017323}
- component: {fileID: 1193017322}
m_Layer: 0
m_Name: Door
m_TagString: SceneTransition
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1193017322
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1193017321}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d7edafbad889ba34e9aae593d927c3a5, type: 3}
m_Name:
m_EditorClassIdentifier:
SceneName: SampleScene
--- !u!50 &1193017323
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1193017321}
m_BodyType: 0
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 0
m_Material: {fileID: 0}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0
--- !u!61 &1193017324
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1193017321}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0, y: 0}
oldSize: {x: 0, y: 0}
newSize: {x: 0, y: 0}
adaptiveTilingThreshold: 0
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 1, y: 1}
m_EdgeRadius: 0
--- !u!4 &1193017325
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1193017321}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.55, y: -10.48, z: 0}
m_LocalScale: {x: 1.975, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1193056560
GameObject:
m_ObjectHideFlags: 0

View File

@ -780,6 +780,7 @@ GameObject:
- component: {fileID: 167690938}
- component: {fileID: 167690943}
- component: {fileID: 167690944}
- component: {fileID: 167690945}
m_Layer: 0
m_Name: mainCh_standing
m_TagString: Player
@ -946,6 +947,18 @@ Animator:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0
--- !u!114 &167690945
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 167690937}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 48a2ec1fec857c946ae3ae8e69b29562, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &184660452
GameObject:
m_ObjectHideFlags: 0
@ -91204,6 +91217,99 @@ Transform:
m_Father: {fileID: 166697418}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2020454682
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2020454686}
- component: {fileID: 2020454685}
- component: {fileID: 2020454684}
- component: {fileID: 2020454683}
m_Layer: 0
m_Name: Door
m_TagString: SceneTransition
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &2020454683
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2020454682}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d7edafbad889ba34e9aae593d927c3a5, type: 3}
m_Name:
m_EditorClassIdentifier:
SceneName: CaveEntrance
--- !u!50 &2020454684
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2020454682}
m_BodyType: 0
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 0
m_Material: {fileID: 0}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0
--- !u!61 &2020454685
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2020454682}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0, y: 0}
oldSize: {x: 0, y: 0}
newSize: {x: 0, y: 0}
adaptiveTilingThreshold: 0
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 1, y: 1}
m_EdgeRadius: 0
--- !u!4 &2020454686
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2020454682}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.01, y: -6.48, z: 0}
m_LocalScale: {x: 1.975, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2060891297
GameObject:
m_ObjectHideFlags: 0

View File

@ -2,6 +2,7 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using System;
public class ChangeScene : MonoBehaviour
{
@ -9,4 +10,12 @@ public class ChangeScene : MonoBehaviour
{
SceneManager.LoadScene(sceneID);
}
public void OnCollisionEnter2D(Collision2D collision)
{
if(collision.gameObject.tag == "SceneTransition")
{
DoorBehaviour.Instance.ScenetToMoveTo();
}
}
}

View File

@ -0,0 +1,38 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class DoorBehaviour : MonoBehaviour
{
public static DoorBehaviour Instance;
public string SceneName = "SampleScene";
private void Awake()
{
if(Instance == null)
{
Instance = this;
}else if (Instance != this)
{
Destroy(gameObject);
}
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void ScenetToMoveTo()
{
SceneManager.LoadScene(this.SceneName);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d7edafbad889ba34e9aae593d927c3a5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -23,4 +23,7 @@ EditorBuildSettings:
- enabled: 1
path: Assets/Scenes/SampleScene.unity
guid: 2cda990e2423bbf4892e6590ba056729
- enabled: 1
path: Assets/Scenes/CaveEntrance.unity
guid: 58d5d2c3457391e428ae5617f22e2cfd
m_configObjects: {}

View File

@ -21,10 +21,10 @@ EditorUserSettings:
value: 22424703114646680e0b0227036c72111f19352f223d667d6d051c3de5f5353fe7a923e7ee2e26
flags: 0
RecentlyUsedScenePath-5:
value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d
value: 22424703114646680e0b0227036c7c1100123d24383a273e2e2c5326ece92021
flags: 0
RecentlyUsedScenePath-6:
value: 22424703114646680e0b0227036c7c1100123d24383a273e2e2c5326ece92021
value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d
flags: 0
vcSharedLogLevel:
value: 0d5e400f0650