Second commit
This commit is contained in:
commit
36840f3ad4
999 files changed
+61364
No files matched your search
@@ -0,0 +1,31 @@
|
||||
using R3;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.D.Cleaning.CleanTools
|
||||
{
|
||||
public abstract class CleanTool
|
||||
{
|
||||
protected float DurabilityUsageStep;
|
||||
protected Texture2D BrushTexture;
|
||||
protected float CleanRadius;
|
||||
|
||||
public abstract CleanToolType ToolType { get; }
|
||||
|
||||
protected CleanTool(float durabilityUsageStep, float cleanRadius, Texture2D brushTexture)
|
||||
{
|
||||
IsDirty.Value = false;
|
||||
|
||||
DurabilityUsageStep = durabilityUsageStep;
|
||||
CleanRadius = cleanRadius;
|
||||
BrushTexture = brushTexture;
|
||||
}
|
||||
|
||||
public ReactiveProperty<bool> IsDirty { get; } = new();
|
||||
public ReactiveProperty<float> CurrentDirtiness { get; }
|
||||
= new(0f);
|
||||
|
||||
public abstract TryapkaUsageInfo Use();
|
||||
|
||||
public abstract void Clean();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cc959003316e4db99a7f190b1b431298
|
||||
timeCreated: 1785939044
|
||||
@@ -0,0 +1,15 @@
|
||||
using Code.Infrastructure.Generators;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.D.Cleaning.CleanTools
|
||||
{
|
||||
[Config("Cleaning/CleanToolConfig", multiple: true)]
|
||||
[CreateAssetMenu(fileName = "CleanToolConfig", menuName = "Config/CleanToolConfig")]
|
||||
public class CleanToolConfig : ScriptableObject
|
||||
{
|
||||
public float DurabilityUsageStep;
|
||||
public Texture2D BrushTexture;
|
||||
public float CleanRadius;
|
||||
public CleanToolType ToolType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 98cb6ddb562747d8b4549287a391a98e
|
||||
timeCreated: 1786032650
|
||||
@@ -0,0 +1,9 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.D.Cleaning.CleanTools
|
||||
{
|
||||
public abstract class CleanToolInteractable : MonoBehaviour
|
||||
{
|
||||
public abstract void Use(CleanTool tool);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1d17365593864a6e9c5cab8971c33c75
|
||||
timeCreated: 1785938942
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Code.D.Cleaning.CleanTools
|
||||
{
|
||||
public enum CleanToolType
|
||||
{
|
||||
Tryapka
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 56a8b3bb2a354e59a3a9a3d6e83c8fe0
|
||||
timeCreated: 1786028280
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.D.Cleaning.CleanTools
|
||||
{
|
||||
public class DirtyToolCleaner : CleanToolInteractable
|
||||
{
|
||||
public override void Use(CleanTool tool)
|
||||
{
|
||||
tool.Clean();
|
||||
Debug.Log("Tool cleaned");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 90e6386fcc8249afad82234df1fcf3d4
|
||||
timeCreated: 1785923693
|
||||
@@ -0,0 +1,11 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.D.Cleaning.CleanTools
|
||||
{
|
||||
public record ToolUsageInfo
|
||||
{
|
||||
public float Dirtiness;
|
||||
public bool IsDirty;
|
||||
public Texture BrushTexture;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0723fb7c41244d8c8b9272d09977dc8f
|
||||
timeCreated: 1785939283
|
||||
@@ -0,0 +1,44 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.D.Cleaning.CleanTools
|
||||
{
|
||||
public class Tryapka : CleanTool
|
||||
{
|
||||
public Tryapka(float durabilityUsageStep, float cleanRadius, Texture2D brushTexture) : base(durabilityUsageStep, cleanRadius, brushTexture)
|
||||
{
|
||||
}
|
||||
|
||||
public override CleanToolType ToolType => CleanToolType.Tryapka;
|
||||
|
||||
public override TryapkaUsageInfo Use()
|
||||
{
|
||||
if (!IsDirty.CurrentValue)
|
||||
{
|
||||
CurrentDirtiness.Value += DurabilityUsageStep;
|
||||
|
||||
if (CurrentDirtiness.Value >= 1) IsDirty.Value = true;
|
||||
}
|
||||
|
||||
return new(CleanRadius, CurrentDirtiness.Value, IsDirty.CurrentValue, BrushTexture);
|
||||
}
|
||||
|
||||
public override void Clean()
|
||||
{
|
||||
CurrentDirtiness.Value = 0;
|
||||
IsDirty.Value = false;
|
||||
}
|
||||
}
|
||||
|
||||
public record TryapkaUsageInfo : ToolUsageInfo
|
||||
{
|
||||
public float Radius;
|
||||
|
||||
public TryapkaUsageInfo(float radius, float dirtiness, bool isDirty, Texture brush)
|
||||
{
|
||||
Radius = radius;
|
||||
Dirtiness = dirtiness;
|
||||
IsDirty = isDirty;
|
||||
BrushTexture = brush;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5da5c20e36c0403691a65f6e0317c129
|
||||
timeCreated: 1785923693
|
||||
Reference in new issue
Block a user