Commit 61795bd8 authored by Michael But's avatar Michael But

SavePoint letzte Änderung (Tag-Abfrage und Scene laden).

parent 07b8f5b2
......@@ -4,6 +4,7 @@ using UnityEngine;
using LevelauswahlScript;
using PlayerSpawnPointScript;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class SavePoint : MonoBehaviour
{
......@@ -32,15 +33,19 @@ public class SavePoint : MonoBehaviour
public void OnTriggerStay2D(Collider2D collision)
{
if (Input.GetButtonDown("Interact"))
if (collision.tag.Equals("Player"))
{
button.interactable = true;
isUsed = true;
anim.SetBool("IsActive", true);
SaveSystem.SavePointUpdate(this);
} else if (Input.GetButtonDown("Teleport") && Levelauswahl.la.auswahlIsActive() == false)
{
Levelauswahl.la.GetLevelauswahl();
if (Input.GetButtonDown("Interact"))
{
button.interactable = true;
isUsed = true;
anim.SetBool("IsActive", true);
SaveSystem.SavePointUpdate(this);
}
else if (Input.GetButtonDown("Teleport") && Levelauswahl.la.auswahlIsActive() == false)
{
Levelauswahl.la.GetLevelauswahl();
}
}
}
......@@ -67,5 +72,6 @@ public class SavePoint : MonoBehaviour
{
SaveSystem.SavePointUpdate(this);
PlayerSpawnPoint.psp.SetPlayerToSafePoint(gameObject.transform.position);
SceneManager.LoadScene("MainLevel");
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment