Развитие гоночек
This commit is contained in:
1 parent
ec60c47652
commit
b54083521f
532 files changed
+16091
-28231
No files matched your search
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Code.Example.Race.Racer;
|
||||
using Code.Example.Race.Track;
|
||||
using Code.Infrastructure.EventBus;
|
||||
using Code.Infrastructure.UI;
|
||||
using Reflex.Attributes;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
namespace Code.Example.Race.UI
|
||||
{
|
||||
public class PlayerScoreCounter : UIPanel, IScoreChangedHandle
|
||||
{
|
||||
[SerializeField] private TMP_Text playerScore;
|
||||
private EventBus _eventBus;
|
||||
|
||||
[Inject]
|
||||
private void Construct(EventBus eventBus)
|
||||
{
|
||||
_eventBus = eventBus;
|
||||
_eventBus.Subscribe(this);
|
||||
}
|
||||
public override void Open(Action callback = null)
|
||||
{
|
||||
playerScore.gameObject.SetActive(true);
|
||||
// image.DOColor(shownColor, 1f).onComplete = () => callback?.Invoke();
|
||||
}
|
||||
|
||||
public override void Close(Action callback = null)
|
||||
{
|
||||
playerScore.gameObject.SetActive(true);
|
||||
// image.DOColor(hiddenColor, 1f).onComplete += () => callback?.Invoke();
|
||||
}
|
||||
|
||||
public void OnRacerPassedCheckpoint(Racer.AI.Racer racer)
|
||||
{
|
||||
}
|
||||
|
||||
public void ScoreChanged(int racer, int additionalScore, List<KeyValuePair<int,int>> scores)
|
||||
{
|
||||
// if (racer.Data.type == RacerType.Player)
|
||||
string output = "";
|
||||
foreach (var score in scores) output += $@"{score.Key}: {score.Value}\n";
|
||||
playerScore.text = output;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user