Отрезание

This commit is contained in:
dddushesss 2021-12-29 21:11:12 +03:00
parent 296a5384c6
commit 6bb16f8757
5 changed files with 30 additions and 40 deletions

View File

@ -92,8 +92,8 @@ MonoBehaviour:
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 1
m_fontSizeBase: 1
m_fontSize: 0.3
m_fontSizeBase: 0.3
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18

View File

@ -51,10 +51,10 @@ namespace HexFiled
}
_renderer.material.mainTexture = _cellColor[color].Texture;
onHexPainted?.Invoke(this);
_color = color;
Instantiate(_cellColor[color].VFXPrefab, transform);
onHexPainted?.Invoke(this);
}
}

View File

@ -100,14 +100,14 @@ namespace HexFiled
}
}
}
}
// #if UNITY_EDITOR
// TMP_Text label = Object.Instantiate(_cellLabelPrefab, _gridCanvas.transform, false);
// label.rectTransform.anchoredPosition =
// new Vector2(position.x, position.z);
// label.text = cell.coordinates.ToStringOnSeparateLines();
// #endif
#if UNITY_EDITOR
TMP_Text label = Object.Instantiate(_cellLabelPrefab, _gridCanvas.transform, false);
label.rectTransform.anchoredPosition =
new Vector2(position.x, position.z);
label.text = cell.coordinates.ToStringOnSeparateLines();
#endif
}
public void Init()
{

View File

@ -3,33 +3,16 @@ using UnityEngine;
namespace HexFiled
{
struct HexIterator
{
private HexCell _cell;
private HexCell _previous;
private bool _isVisited;
public HexIterator(HexCell cell, bool isVisited, HexCell previous)
{
_cell = cell;
_isVisited = isVisited;
_previous = previous;
}
public HexCell Cell => _cell;
public HexCell Previous => _previous;
public bool Isvisited => _isVisited;
}
public class PaintedController
{
public static Dictionary<UnitColor, HexCell> unitCurrentCell = new Dictionary<UnitColor, HexCell>();
private HexCell _cell;
public void SetHexColors(HexCell cell)
{
_cell = cell;
List<HexCell> cells = new List<HexCell>();
for(int i = 0 ; i < 6 ; i++)
@ -44,17 +27,20 @@ namespace HexFiled
{
foreach(var cellNeighbour in item.Value)
{
if(unitCurrentCell.ContainsKey(cell.Color))
if(unitCurrentCell.ContainsKey(item.Key))
{
var path = HasPath(cellNeighbour, unitCurrentCell[cell.Color]);
var path = HasPath(cellNeighbour, unitCurrentCell[item.Key]);
if(!path.hasPath)
{
path.field.ForEach(x => x.PaintHex(UnitColor.GREY));
}
//Debug.Log("123");
}
}
}
else if (item.Key == UnitColor.GREY)
{
}
}
}
@ -89,7 +75,7 @@ namespace HexFiled
while(stackIteators.Count > 0 )
while(stackIteators.Count >= 0 )
{
if(currentCell == end)
return ( true, closedList);
@ -112,6 +98,10 @@ namespace HexFiled
}
else
{
if (stackIteators.Count == 0)
{
return ( false, closedList);
}
currentCell = stackIteators.Pop();
}
}

View File

@ -50,7 +50,7 @@ public class UnitView : MonoBehaviour
{
captureBar.gameObject.SetActive(true);
_sequence = DOTween.Sequence();
_sequence.Append(captureBar.DOFillAmount(1f, 3f).OnComplete(() =>
_sequence.Append(captureBar.DOFillAmount(1f, 0f).OnComplete(() =>
{
_capureHex.Invoke();
captureBar.DOFillAmount(0f, 0f).SetEase(Ease.Linear);