75 lines
2.1 KiB
C#
75 lines
2.1 KiB
C#
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;
|
|
public GameObject _CurrentCar;
|
|
|
|
[SerializeField] private CinemachineVirtualCamera _CinemachineVC;
|
|
|
|
[SerializeField] private Starter _Starter;
|
|
|
|
[SerializeField] private Finish _Finish;
|
|
|
|
[SerializeField] private DriftScore _DriftScore;
|
|
|
|
[SerializeField] private RCC_DashboardInputs _RCC_DashboardInputs;
|
|
[SerializeField] private RCC_UIDashboardDisplay _RCC_UIDashboardDisplay;
|
|
|
|
|
|
//[SerializeField] private FollowTarget _FollowTarget;
|
|
|
|
//[SerializeField] private FollowYRotation _FollowYRotation;
|
|
|
|
|
|
|
|
private void Start()
|
|
{
|
|
_Player -= 1;
|
|
|
|
foreach(GameObject car in _Cars)
|
|
{
|
|
if (car.name == StaticDataMap.CarPlayers[_Player])
|
|
{
|
|
_CurrentCar = car;
|
|
break;
|
|
}
|
|
}
|
|
|
|
_CinemachineVC.Follow = _CurrentCar.transform;
|
|
_CinemachineVC.LookAt = _CurrentCar.transform;
|
|
|
|
|
|
_DriftScore.playerRB = _CurrentCar.GetComponent<Rigidbody>();
|
|
//Debug.Log("Äđčôň óęŕçŕí");
|
|
|
|
_CurrentCar.SetActive(true);
|
|
|
|
_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("Ęîíňđîëëĺđű óďđŕâëĺíč˙ óęŕçŕíű");
|
|
|
|
//if (_FollowTarget != null)
|
|
//{
|
|
// _FollowTarget.target = _CurrentCar.transform;
|
|
// _FollowYRotation.target = _CurrentCar.transform;
|
|
//}
|
|
}
|
|
|
|
//private void Start()
|
|
//{
|
|
// _DriftScore.playerRB = _CurrentCar.GetComponent<Rigidbody>();
|
|
//}
|
|
}
|