Актуальная версия
This commit is contained in:
@ -1,23 +1,68 @@
|
||||
using TMPro;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
|
||||
|
||||
class Finish : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject Effects;
|
||||
[SerializeField] private GameObject Effects1;
|
||||
[SerializeField] private GameObject Effects2;
|
||||
[SerializeField] private GameObject WinMenu;
|
||||
[SerializeField] private PlayerInput Player1_Input;
|
||||
[SerializeField] private PlayerInput Player2_Input;
|
||||
[SerializeField] private TextMeshProUGUI WinText;
|
||||
[SerializeField] private GameObject StripeActive;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Effects.SetActive(false);
|
||||
Effects1.SetActive(false);
|
||||
Effects2.SetActive(false);
|
||||
WinMenu.SetActive(false);
|
||||
}
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (other.gameObject.tag == "Player 1" || other.gameObject.tag == "Player 2")
|
||||
if (other.gameObject.tag == "Player 1")
|
||||
{
|
||||
Debug.Log("<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!");
|
||||
Effects.SetActive(true);
|
||||
|
||||
OnePlayerWin();
|
||||
}
|
||||
|
||||
else if (other.gameObject.tag == "Player 2")
|
||||
{
|
||||
SecondPlayerWin();
|
||||
}
|
||||
|
||||
if (other.gameObject.tag == "Player 1" || other.gameObject.tag == "Player 2")
|
||||
{
|
||||
ActiveObject();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void OnePlayerWin()
|
||||
{
|
||||
WinText.text = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
||||
StripeActive.SetActive(false);
|
||||
}
|
||||
|
||||
private void SecondPlayerWin()
|
||||
{
|
||||
WinText.text = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
||||
StripeActive.SetActive(false);
|
||||
}
|
||||
|
||||
private void ActiveObject()
|
||||
{
|
||||
Effects1.SetActive(true);
|
||||
Effects2.SetActive(true);
|
||||
WinMenu.SetActive(true);
|
||||
Player1_Input.enabled = false;
|
||||
Player2_Input.enabled = false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user