Frank glitched nicht in Boden

This commit is contained in:
DominikB
2023-06-25 11:21:42 +02:00
parent 4f1b56e894
commit 12735a14ee
8 changed files with 171 additions and 17 deletions

View File

@@ -49,12 +49,13 @@ public AudioClip fadeSound; // The sound clip to be played
edge.enabled = true;
gone = false;
} else {
audioSource.PlayOneShot(fadeSound);
yield return new WaitForSeconds (fadeTime);
spriteRenderer.enabled = false;
col.enabled = false;
edge.enabled = false;
gone = true;
audioSource.PlayOneShot(fadeSound);
}
}

View File

@@ -1,14 +1,18 @@
using UnityEngine;
using System;
public class respawn : MonoBehaviour
{
private GameObject player;
[SerializeField] private Transform respawnPoint;
private AudioSource audioSource; // Reference to the AudioSource component
public AudioClip hurtSound; // The sound clip to be played
void Start()
{
player = GameObject.Find("Frank");
audioSource = GetComponent<AudioSource>();
}
@@ -20,6 +24,11 @@ public class respawn : MonoBehaviour
{
if (other.gameObject.CompareTag("Player"))
{
try{
audioSource.PlayOneShot(hurtSound);}
catch(Exception e){
;
}
player.transform.position = respawnPoint.position;
Debug.Log("Respawn: Move");
}