Extract Count into Helper class
This commit is contained in:
parent
0b4796e6fa
commit
391af7efb2
3 changed files with 24 additions and 17 deletions
21
Assets/Scripts/src/Helpers/Count.cs
Normal file
21
Assets/Scripts/src/Helpers/Count.cs
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace src.Helpers
|
||||||
|
{
|
||||||
|
public class Count
|
||||||
|
{
|
||||||
|
private readonly int _min;
|
||||||
|
private readonly int _max;
|
||||||
|
|
||||||
|
public Count(int min, int max)
|
||||||
|
{
|
||||||
|
_min = min;
|
||||||
|
_max = max;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int RandomIntRange()
|
||||||
|
{
|
||||||
|
return Mathf.FloorToInt(Random.Range(_min, _max));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Assets/Scripts/src/Helpers/Count.cs.meta
Normal file
3
Assets/Scripts/src/Helpers/Count.cs.meta
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a2787d1c344641e3a5509f691156eab7
|
||||||
|
timeCreated: 1564331210
|
|
@ -10,23 +10,6 @@ namespace src.Managers
|
||||||
{
|
{
|
||||||
public class LevelManager : GameplayComponent
|
public class LevelManager : GameplayComponent
|
||||||
{
|
{
|
||||||
public class Count
|
|
||||||
{
|
|
||||||
private readonly int _min;
|
|
||||||
private readonly int _max;
|
|
||||||
|
|
||||||
public Count(int min, int max)
|
|
||||||
{
|
|
||||||
_min = min;
|
|
||||||
_max = max;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int RandomIntRange()
|
|
||||||
{
|
|
||||||
return Mathf.FloorToInt(Random.Range(_min, _max));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Count DestructibleWallCount
|
public Count DestructibleWallCount
|
||||||
{
|
{
|
||||||
get => _destructibleWallCount;
|
get => _destructibleWallCount;
|
||||||
|
|
Loading…
Reference in a new issue