Win of verlies van het kat spel.
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class CatWinOrLose : MonoBehaviour
{
private Vector3 startPosition;
private Quaternion startRotation;
[SerializeField]
private GameObject winLight;
[SerializeField]
private GameObject ToDoListItem;
[SerializeField]
MoveCharachterScript moveCharachterScript;
[SerializeField]
private AudioSource audioSource;
void Start()
{
startPosition = transform.position;
startRotation = transform.rotation;
}
private void OnTriggerEnter(Collider tile)
{
if (tile.tag == "Endpoint")
{
Debug.Log("You Win!");
audioSource.Stop();
winLight.SetActive(true);
ToDoListItem.SetActive(true);
}
else if (tile.tag != "Tile" && tile.tag != "Endpoint")
{
transform.position = startPosition;
transform.rotation = startRotation;
moveCharachterScript.ResetPlayer();
moveCharachterScript.StopAllCoroutines();
moveCharachterScript.canPlay = true;
moveCharachterScript.isMoving = false;
}
}
}