Second commit
This commit is contained in:
commit
36840f3ad4
999 files changed
+61364
No files matched your search
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Code.D.Cleaning.CleanTools;
|
||||
using R3;
|
||||
using Reflex.Attributes;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Code.D.Cleaning.UI
|
||||
{
|
||||
public class TryapkaWidget : CleanToolWidget
|
||||
{
|
||||
[SerializeField] private Image toolImage;
|
||||
[SerializeField] private Color cleanToolColor;
|
||||
[SerializeField] private Color dirtyToolColor;
|
||||
|
||||
private IDisposable _disposable;
|
||||
|
||||
[Inject]
|
||||
private void Construct(List<CleanTool> cleanTools)
|
||||
{
|
||||
Debug.Log("InjectingWidget");
|
||||
|
||||
var tool = cleanTools.SingleOrDefault(x => x.ToolType == CleanToolType.Tryapka);
|
||||
|
||||
if (tool == null) return;
|
||||
|
||||
_disposable = tool.CurrentDirtiness
|
||||
.Subscribe(SetToolDirtiness);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
_disposable?.Dispose();
|
||||
}
|
||||
|
||||
public override void SetToolDirtiness(float dirtiness)
|
||||
{
|
||||
toolImage.color = Color.Lerp(cleanToolColor, dirtyToolColor, dirtiness);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user