Dizel 8358a1dcd6 Скрипт машин, префабы
Создал скрипт вращения колёс машин, может ещё что в него добавлю, создал префабы окружения и машин
2024-12-17 16:00:59 +03:00

50 lines
1.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using TMPro;
using UnityEngine;
/// <summary>
/// менеджер очков и всего, что с этим связанно
/// </summary>
public class ScoreManagerScript : MonoBehaviour
{
// to do
// добавить коментарии ко всему
private TileManagerScript _tileManagerScript;
private int _CurrentScore = 0;
[SerializeField]
private TextMeshPro _ScoreText;
private void Awake()
{
_tileManagerScript = GameObject.FindGameObjectWithTag("Tile Manager").GetComponent<TileManagerScript>();
if (_tileManagerScript != null)
{
_tileManagerScript.scoreManager = this;
}
}
private void Start()
{
}
public void Increase()
{
_CurrentScore += 1;
UppdateScore(_ScoreText);
}
private void UppdateScore(TextMeshPro text)
{
text.text = $"Счёт - {_CurrentScore}";
}
public void UpdatePos()
{
Vector3 newVector = new Vector3(_ScoreText.gameObject.transform.position.x, _ScoreText.gameObject.transform.position.y, _ScoreText.gameObject.transform.position.z + _tileManagerScript.DistanceTiles);
_ScoreText.gameObject.transform.position = newVector;
}
}