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