This commit is contained in:
Vladislav Likhenko 2024-09-11 12:56:13 +03:00
parent cba6df902a
commit 04289c7711
8 changed files with 43 additions and 8 deletions

View File

@ -7,9 +7,12 @@ public class MinimapStatrScript : MonoBehaviour
[SerializeField] private SelectCarGameScript _SelectCarGameScript; [SerializeField] private SelectCarGameScript _SelectCarGameScript;
private void Start() public void Starter()
{
if (_SelectCarGameScript._CurrentCar != null)
{ {
_followTarget.target = _SelectCarGameScript._CurrentCar.transform; _followTarget.target = _SelectCarGameScript._CurrentCar.transform;
_followYRotation.target = _SelectCarGameScript._CurrentCar.transform; _followYRotation.target = _SelectCarGameScript._CurrentCar.transform;
} }
}
} }

View File

@ -10,6 +10,6 @@ public class FollowTarget : MonoBehaviour
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{ {
transform.position = target.transform.position + offset; if(target != null) transform.position = target.transform.position + offset;
} }
} }

View File

@ -8,6 +8,6 @@ public class FollowYRotation : MonoBehaviour
void Update() void Update()
{ {
transform.eulerAngles = new Vector3(0 ,target.eulerAngles.y, 0); if (target != null) transform.eulerAngles = new Vector3(0 ,target.eulerAngles.y, 0);
} }
} }

View File

@ -13,7 +13,7 @@ public class Starter : MonoBehaviour
[SerializeField] private Image _borders; [SerializeField] private Image _borders;
[SerializeField] private MinimapStatrScript[] _MinimapStatrScript;
private void Start() private void Start()
{ {
@ -63,6 +63,19 @@ public class Starter : MonoBehaviour
DontMovePlayer[1].DeactivateInput(); DontMovePlayer[1].DeactivateInput();
} }
if (_MinimapStatrScript.Length != 0)
{
if (_MinimapStatrScript.Length == 1)
{
_MinimapStatrScript[0].Starter();
}
else if (_MinimapStatrScript.Length == 2)
{
_MinimapStatrScript[0].Starter();
_MinimapStatrScript[1].Starter();
}
}
_borders.enabled = true; _borders.enabled = true;
} }

View File

@ -30,7 +30,7 @@ public class DriftScore : MonoBehaviour
private IEnumerator stopDriftingCoroutine = null; private IEnumerator stopDriftingCoroutine = null;
private void Start() public void Starter()
{ {
driftingObject.SetActive(false); driftingObject.SetActive(false);
} }

View File

@ -46,15 +46,19 @@ public class TimerOnInactiveScript : MonoBehaviour
{ {
ResetTimer(); ResetTimer();
MoveCameraFromRound(); MoveCameraFromRound();
//Debug.Log("gamepad");
} }
if (control is AxisControl axis) if (control is AxisControl axis)
{ {
float value = axis.ReadValue(); float value = axis.ReadValue();
if (value != 0)
{ {
ResetTimer(); ResetTimer();
MoveCameraFromRound(); MoveCameraFromRound();
} }
//Debug.Log($"gamepad {value}");
} }
} }
} }
@ -64,7 +68,9 @@ public class TimerOnInactiveScript : MonoBehaviour
{ {
ResetTimer(); ResetTimer();
MoveCameraFromRound(); MoveCameraFromRound();
} } //Debug.Log("keyboard");
}
}
//-------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------

View File

@ -23,6 +23,12 @@ public class SelectCarGameScript : MonoBehaviour
[SerializeField] private RCC_UIDashboardDisplay _RCC_UIDashboardDisplay; [SerializeField] private RCC_UIDashboardDisplay _RCC_UIDashboardDisplay;
//[SerializeField] private FollowTarget _FollowTarget;
//[SerializeField] private FollowYRotation _FollowYRotation;
private void Start() private void Start()
{ {
_Player -= 1; _Player -= 1;
@ -39,7 +45,9 @@ public class SelectCarGameScript : MonoBehaviour
_CinemachineVC.Follow = _CurrentCar.transform; _CinemachineVC.Follow = _CurrentCar.transform;
_CinemachineVC.LookAt = _CurrentCar.transform; _CinemachineVC.LookAt = _CurrentCar.transform;
_DriftScore.playerRB = _CurrentCar.GetComponent<Rigidbody>(); _DriftScore.playerRB = _CurrentCar.GetComponent<Rigidbody>();
_DriftScore.Starter();
//Debug.Log("Äđčôň óęŕçŕí"); //Debug.Log("Äđčôň óęŕçŕí");
_CurrentCar.SetActive(true); _CurrentCar.SetActive(true);
@ -53,6 +61,11 @@ public class SelectCarGameScript : MonoBehaviour
_RCC_UIDashboardDisplay.vehicle = _CurrentCar.GetComponent<RCC_CarControllerV3>(); _RCC_UIDashboardDisplay.vehicle = _CurrentCar.GetComponent<RCC_CarControllerV3>();
//Debug.Log("Ęîíňđîëëĺđű óďđŕâëĺíč˙ óęŕçŕíű"); //Debug.Log("Ęîíňđîëëĺđű óďđŕâëĺíč˙ óęŕçŕíű");
//if (_FollowTarget != null)
//{
// _FollowTarget.target = _CurrentCar.transform;
// _FollowYRotation.target = _CurrentCar.transform;
//}
} }
//private void Start() //private void Start()