Zakhar #4
@ -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
|
||||
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -100,16 +100,16 @@ 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()
|
||||
public void Init()
|
||||
{
|
||||
_cells = new HexCell[_height * _width];
|
||||
|
||||
|
@ -3,58 +3,44 @@ 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++)
|
||||
{
|
||||
cells.Add(cell.GetNeighbor((HexDirection)i ));
|
||||
cells.Add(cell.GetNeighbor((HexDirection)i));
|
||||
}
|
||||
|
||||
var hexByColorDict = DifferentHexByColor(cells);
|
||||
foreach (var item in hexByColorDict)
|
||||
{
|
||||
if(item.Value.Count > 0 && item.Key != UnitColor.GREY && item.Key != cell.Color)
|
||||
if(item.Value.Count > 0 && item.Key != UnitColor.GREY && item.Key != cell.Color )
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user