Добавлен выбор машин
This commit is contained in:
parent
149bb7fa70
commit
0d0fa355cd
@ -1,5 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.UI;
|
||||
@ -10,9 +10,8 @@ class Finish : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject Effects1;
|
||||
[SerializeField] private GameObject Effects2;
|
||||
[SerializeField] private PlayerInput Player1_Input;
|
||||
[SerializeField] private PlayerInput Player2_Input;
|
||||
|
||||
public List<PlayerInput> playerInput;
|
||||
|
||||
[SerializeField] private GameObject WinMenu;
|
||||
[SerializeField] private Button SelectedButton;
|
||||
[SerializeField] private TextMeshProUGUI WinText;
|
||||
@ -30,6 +29,7 @@ class Finish : MonoBehaviour
|
||||
}
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
//Debug.Log("Èãğîê âîø¸ë " + other.gameObject.tag);
|
||||
if (other.gameObject.tag == "Player 1")
|
||||
{
|
||||
OnePlayerWin();
|
||||
@ -68,8 +68,15 @@ class Finish : MonoBehaviour
|
||||
WinMenu.SetActive(true);
|
||||
SelectedButton.Select();
|
||||
|
||||
Player1_Input.enabled = false;
|
||||
Player2_Input.enabled = false;
|
||||
if (StaticDataMap.NumPlayer == 1)
|
||||
{
|
||||
playerInput[0].DeactivateInput();
|
||||
}
|
||||
else
|
||||
{
|
||||
playerInput[0].DeactivateInput();
|
||||
playerInput[1].DeactivateInput();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -4,7 +4,7 @@ using UnityEngine;
|
||||
|
||||
public class FollowTarget : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Transform target;
|
||||
public Transform target;
|
||||
[SerializeField] private Vector3 offset;
|
||||
|
||||
// Update is called once per frame
|
||||
|
@ -4,7 +4,7 @@ using UnityEngine;
|
||||
|
||||
public class FollowYRotation : MonoBehaviour
|
||||
{
|
||||
[SerializeField] Transform target;
|
||||
public Transform target;
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
@ -1,5 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class Starter : MonoBehaviour
|
||||
@ -7,8 +9,7 @@ public class Starter : MonoBehaviour
|
||||
[SerializeField] private float _starter = 5f;
|
||||
[SerializeField] private Text _timer;
|
||||
|
||||
[SerializeField] private PlayerInput _dontMovePlayer1;
|
||||
[SerializeField] private PlayerInput _dontMovePlayer2;
|
||||
public List<PlayerInput> DontMovePlayer;
|
||||
|
||||
[SerializeField] private Image _borders;
|
||||
|
||||
@ -18,17 +19,14 @@ public class Starter : MonoBehaviour
|
||||
{
|
||||
_timer.text = _starter.ToString();
|
||||
|
||||
_dontMovePlayer1.DeactivateInput();
|
||||
_dontMovePlayer2.DeactivateInput();
|
||||
|
||||
if (StaticDataMap.NumPlayer == 1)
|
||||
{
|
||||
_dontMovePlayer1.DeactivateInput();
|
||||
DontMovePlayer[0].DeactivateInput();
|
||||
}
|
||||
else
|
||||
{
|
||||
_dontMovePlayer1.DeactivateInput();
|
||||
_dontMovePlayer2.DeactivateInput();
|
||||
DontMovePlayer[0].DeactivateInput();
|
||||
DontMovePlayer[1].DeactivateInput();
|
||||
}
|
||||
|
||||
_borders.enabled = true;
|
||||
@ -51,12 +49,12 @@ public class Starter : MonoBehaviour
|
||||
|
||||
if (StaticDataMap.NumPlayer == 1)
|
||||
{
|
||||
_dontMovePlayer1.ActivateInput();
|
||||
DontMovePlayer[0].ActivateInput();
|
||||
}
|
||||
else
|
||||
{
|
||||
_dontMovePlayer1.ActivateInput();
|
||||
_dontMovePlayer2.ActivateInput();
|
||||
DontMovePlayer[0].ActivateInput();
|
||||
DontMovePlayer[1].ActivateInput();
|
||||
}
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@ using UnityEngine;
|
||||
|
||||
public class DriftScore : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Rigidbody playerRB;
|
||||
public Rigidbody playerRB;
|
||||
[SerializeField] private TMP_Text totalScoreText;
|
||||
[SerializeField] private TMP_Text currentScoreText;
|
||||
[SerializeField] private TMP_Text factorText;
|
||||
|
Binary file not shown.
67
Assets/SelectCarGameScript.cs
Normal file
67
Assets/SelectCarGameScript.cs
Normal file
@ -0,0 +1,67 @@
|
||||
using Cinemachine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
public class SelectCarGameScript : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private int _Player;
|
||||
|
||||
[SerializeField] private List<GameObject> _Cars;
|
||||
private GameObject _CurrentCar;
|
||||
|
||||
[SerializeField] private CinemachineVirtualCamera _CinemachineVC;
|
||||
|
||||
[SerializeField] private FollowTarget _FollowTarget;
|
||||
[SerializeField] private FollowYRotation _FollowYRotation;
|
||||
|
||||
[SerializeField] private Starter _Starter;
|
||||
|
||||
[SerializeField] private Finish _Finish;
|
||||
|
||||
[SerializeField] private DriftScore _DriftScore;
|
||||
|
||||
[SerializeField] private RCC_DashboardInputs _RCC_DashboardInputs;
|
||||
[SerializeField] private RCC_UIDashboardDisplay _RCC_UIDashboardDisplay;
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_Player -= 1;
|
||||
|
||||
foreach(GameObject car in _Cars)
|
||||
{
|
||||
if (car.name == StaticDataMap.CarPlayers[_Player])
|
||||
{
|
||||
_CurrentCar = car;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_DriftScore.playerRB = _CurrentCar.GetComponent<Rigidbody>();
|
||||
//Debug.Log("Äđčôň óęŕçŕí");
|
||||
|
||||
_CurrentCar.SetActive(true);
|
||||
|
||||
_CinemachineVC.Follow = _CurrentCar.transform;
|
||||
_CinemachineVC.LookAt = _CurrentCar.transform;
|
||||
//Debug.Log("Ěŕřčíŕ îňńëĺćčâŕĺňń˙");
|
||||
|
||||
_FollowTarget.target = _CurrentCar.transform;
|
||||
_FollowYRotation.target = _CurrentCar.transform;
|
||||
//Debug.Log("Öĺëü ęŕđňű óęŕçŕíŕ");
|
||||
|
||||
_Starter.DontMovePlayer[_Player] = _CurrentCar.GetComponent<PlayerInput>();
|
||||
//Debug.Log("Čăđîę íĺ äâčăŕĺňń˙");
|
||||
|
||||
_Finish.playerInput[_Player] = _CurrentCar.GetComponent<PlayerInput>();
|
||||
|
||||
|
||||
|
||||
_RCC_DashboardInputs.vehicle = _CurrentCar.GetComponent<RCC_CarControllerV3>();
|
||||
_RCC_UIDashboardDisplay.vehicle = _CurrentCar.GetComponent<RCC_CarControllerV3>();
|
||||
//Debug.Log("Ęîíňđîëëĺđű óďđŕâëĺíč˙ óęŕçŕíű");
|
||||
|
||||
}
|
||||
}
|
11
Assets/SelectCarGameScript.cs.meta
Normal file
11
Assets/SelectCarGameScript.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 27010bba752a80d4b834008d8ad96de8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -6,25 +6,27 @@ public class TestScript : MonoBehaviour
|
||||
{
|
||||
if (StaticDataMap.SelectedMap == null)
|
||||
{
|
||||
Debug.Log("êàðòà íå óêàçàíà");
|
||||
//Debug.Log("êàðòà íå óêàçàíà");
|
||||
}
|
||||
if (StaticDataMap.Time == null)
|
||||
{
|
||||
Debug.Log("Âðåìÿ íå óêàçàíî");
|
||||
//Debug.Log("Âðåìÿ íå óêàçàíî");
|
||||
}
|
||||
if (StaticDataMap.NumPlayer == null)
|
||||
{
|
||||
Debug.Log("Èãðîêè íå óêàçàíû");
|
||||
StaticDataMap.NumPlayer = 123;
|
||||
Debug.Log(StaticDataMap.NumPlayer);
|
||||
//Debug.Log("Èãðîêè íå óêàçàíû");
|
||||
StaticDataMap.NumPlayer = 2;
|
||||
//Debug.Log(StaticDataMap.NumPlayer);
|
||||
}
|
||||
if (StaticDataMap.CarPlayers[0] == null)
|
||||
{
|
||||
Debug.Log("Ïåðâûé èãðîê íå óêàçàí");
|
||||
StaticDataMap.CarPlayers[0] = "Chellendger_1969_2";
|
||||
//Debug.Log("Ìàøèíà îòñëåæèâàåòñÿ");
|
||||
}
|
||||
if (StaticDataMap.CarPlayers[1] == null)
|
||||
{
|
||||
Debug.Log("Âòîðîé èãðîê íå óêàçàí");
|
||||
StaticDataMap.CarPlayers[1] = "Chellendger_1969_2";
|
||||
//Debug.Log("Âòîðîé èãðîê íå óêàçàí");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user