2024-12-16 15:10:08 +01:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
public class Obstacle : MonoBehaviour
|
|
|
|
{
|
2024-12-16 16:19:59 +01:00
|
|
|
public PlayerScript playerScript;
|
|
|
|
public GameObject playerObject;
|
2025-01-06 16:11:40 +01:00
|
|
|
public AudioSource audioSource;
|
2024-12-16 15:10:08 +01:00
|
|
|
|
2024-12-16 16:19:59 +01:00
|
|
|
public void Start()
|
|
|
|
{
|
|
|
|
playerScript = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerScript>();
|
2024-12-16 15:10:08 +01:00
|
|
|
}
|
|
|
|
|
2024-12-16 16:19:59 +01:00
|
|
|
public void Update()
|
2024-12-16 15:10:08 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public void OnTriggerEnter2D(Collider2D collision)
|
|
|
|
{
|
2024-12-16 16:19:59 +01:00
|
|
|
playerObject.transform.rotation = playerScript.initialRotation;
|
|
|
|
playerObject.transform.position = playerScript.initialPosition;
|
2025-01-06 16:11:40 +01:00
|
|
|
playerScript.audioSource.Play();
|
2024-12-16 15:10:08 +01:00
|
|
|
}
|
|
|
|
}
|