Scene Change und basic Inventory implementiert
This commit is contained in:
parent
792c90a214
commit
4ea6222f27
29
Assets/AssetsFORELLE/Script/ChangeScene.cs
Normal file
29
Assets/AssetsFORELLE/Script/ChangeScene.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class ChangeScene : MonoBehaviour
|
||||
{
|
||||
public Scene changeTo;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void OnCollisionEnter2D(Collision2D other)
|
||||
{
|
||||
if (other.gameObject.CompareTag("SceneChanger"))
|
||||
{
|
||||
SceneManager.LoadScene(other.gameObject.name);
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/AssetsFORELLE/Script/ChangeScene.cs.meta
generated
Normal file
11
Assets/AssetsFORELLE/Script/ChangeScene.cs.meta
generated
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: deb75ec73a5f4ec2b6cd07709279ceba
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
40
Assets/AssetsFORELLE/Script/PickupCollision.cs
Normal file
40
Assets/AssetsFORELLE/Script/PickupCollision.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
public class PickupCollision : MonoBehaviour
|
||||
{
|
||||
private List<GameObject> items;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
items = new List<GameObject>();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void OnCollisionEnter2D(Collision2D other)
|
||||
{
|
||||
switch (other.gameObject.tag) // switch-case hier damit in zukunft einfach fälle hinzugefügt werden können
|
||||
{
|
||||
case "Item":
|
||||
other.gameObject.SetActive(false);
|
||||
items.Add(other.gameObject);
|
||||
Debug.Log("Pickup: Take " + other.gameObject.name);
|
||||
break;
|
||||
|
||||
case "Openable":
|
||||
// Entfernt den ersten "Key" welcher unter den Items gefunden wird, falls es einen gibt
|
||||
if ( items.Remove((from item in items where item.name == "Key" select item).First()) )
|
||||
{ // falls ein "Key" gefunden wurde, wird dieser genutzt
|
||||
other.gameObject.SetActive(false);
|
||||
Debug.Log("Pickup: Use Key");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/AssetsFORELLE/Script/PickupCollision.cs.meta
generated
Normal file
11
Assets/AssetsFORELLE/Script/PickupCollision.cs.meta
generated
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5c8672c5b58eae84da6091aa48615de7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
619
Assets/Scenes/SampleScene.unity
generated
619
Assets/Scenes/SampleScene.unity
generated
File diff suppressed because it is too large
Load Diff
3
ProjectSettings/EditorBuildSettings.asset
generated
3
ProjectSettings/EditorBuildSettings.asset
generated
@ -8,4 +8,7 @@ EditorBuildSettings:
|
||||
- enabled: 1
|
||||
path: Assets/Scenes/SampleScene.unity
|
||||
guid: 8c9cfa26abfee488c85f1582747f6a02
|
||||
- enabled: 1
|
||||
path: Assets/Scenes/Prototype.unity
|
||||
guid: 690ad3268ada5f94b8d8d2ab06075ca8
|
||||
m_configObjects: {}
|
||||
|
3
ProjectSettings/TagManager.asset
generated
3
ProjectSettings/TagManager.asset
generated
@ -6,6 +6,9 @@ TagManager:
|
||||
tags:
|
||||
- PressurePlatable
|
||||
- PlayerIsOnIt
|
||||
- Item
|
||||
- Openable
|
||||
- SceneChanger
|
||||
layers:
|
||||
- Default
|
||||
- TransparentFX
|
||||
|
Loading…
x
Reference in New Issue
Block a user