effect for rounding
This commit is contained in:
parent
43993fb918
commit
6eb981cf59
@ -64,6 +64,8 @@ namespace HexFiled
|
||||
_renderer.material.mainTexture = HexGrid.Colors[color].Texture;
|
||||
|
||||
_color = color;
|
||||
MusicController.Instance.PlayRandomClip(MusicController.Instance.MusicData.SfxMusic.Captures,
|
||||
gameObject);
|
||||
Instantiate(HexGrid.Colors[color].VFXPrefab, transform);
|
||||
onHexPainted?.Invoke(this);
|
||||
}
|
||||
|
@ -1,7 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Data;
|
||||
using UnityEngine;
|
||||
using DefaultNamespace;
|
||||
using Units;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
namespace HexFiled
|
||||
{
|
||||
@ -75,7 +78,8 @@ namespace HexFiled
|
||||
where !path.hasPath
|
||||
select path)
|
||||
{
|
||||
path.field.ForEach(x => x.PaintHex(UnitColor.GREY));
|
||||
TryPaintHexList(path, UnitColor.GREY);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -86,7 +90,14 @@ namespace HexFiled
|
||||
{
|
||||
if (!path.hasPath)
|
||||
{
|
||||
path.field.ForEach(y => y.PaintHex(color));
|
||||
List<Action<UnitColor>> actions = new List<Action<UnitColor>>();
|
||||
|
||||
path.field.ForEach(x =>
|
||||
{
|
||||
actions.Add(x.PaintHex);
|
||||
});
|
||||
|
||||
TimerHelper.Instance.StartTimer(actions, 0.05f, color);
|
||||
}
|
||||
|
||||
return path.hasPath;
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DefaultNamespace
|
||||
@ -9,26 +10,54 @@ namespace DefaultNamespace
|
||||
private static TimerHelper _instance;
|
||||
|
||||
public static TimerHelper Instance => _instance;
|
||||
public static List<Action> OnCorutineEndedList;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = this;
|
||||
OnCorutineEndedList = new List<Action>();
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void StartTimer(Action action, int time)
|
||||
public void StartTimer(Action action, float time)
|
||||
{
|
||||
StartCoroutine(Timer(action, time));
|
||||
}
|
||||
|
||||
IEnumerator Timer(Action action, int time)
|
||||
public void StartTimer<T>(Action<T> action, float time, T param)
|
||||
{
|
||||
StartCoroutine(Timer(action, time, param));
|
||||
}
|
||||
|
||||
public void StartTimer<T>(List<Action<T>> actions, float time, T param)
|
||||
{
|
||||
StartCoroutine(Timer(actions, time, param));
|
||||
}
|
||||
|
||||
IEnumerator Timer(Action action, float time)
|
||||
{
|
||||
yield return new WaitForSeconds(time);
|
||||
action.Invoke();
|
||||
}
|
||||
|
||||
IEnumerator Timer<T>(Action<T> action, float time, T param)
|
||||
{
|
||||
yield return new WaitForSeconds(time);
|
||||
action.Invoke(param);
|
||||
}
|
||||
|
||||
IEnumerator Timer<T>(List<Action<T>> actions, float time, T param)
|
||||
{
|
||||
foreach (var action in actions)
|
||||
{
|
||||
yield return new WaitForSeconds(time);
|
||||
action.Invoke(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -220,8 +220,7 @@ namespace Units
|
||||
else
|
||||
{
|
||||
CaptureHex();
|
||||
MusicController.Instance.PlayRandomClip(MusicController.Instance.MusicData.SfxMusic.Captures,
|
||||
_cell.gameObject);
|
||||
|
||||
}
|
||||
|
||||
_isHardToCapture = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user