private IEnumerator CommandInvoker() { while (true) { yield return(new WaitUntil(() => isCommandReceive)); switch (command) { case Commands.SpawnUnit: SpawnTower.SpawnUnit((Tower.TypeUnits)buffer[1], true); break; case Commands.SetPos: int idHexagon = BitConverter.ToInt32(FromBuffer(1, 4), 0); int idUnit = BitConverter.ToInt32(FromBuffer(5, 4), 0); Hexagon hexagon = HexagonField.GetChild(idHexagon).GetComponent <Hexagon>(); foreach (var unit in cacheUnit) { if (unit.IdUnit == idUnit) { hexagon.MoveHere(unit); break; } } break; } isCommandReceive = false; yield return(new WaitForEndOfFrame()); } }
protected override void Part1(string[][] fields) { _dict = new HexagonField(); foreach (var field in fields) { foreach (var chars in field) { _dict.Move(chars); } _dict.Flip(); _dict.ResetPosition(); } Print("Resulting count", _dict.Count(), true); }
void Start() { hexHandler = gameObject.transform.parent.parent.gameObject.GetComponent <HexagonField> (); }