private void genPatch(Vector2Int iPos, int index, int size, int dir = 0) { Propagateable cell = grassFactory.Find(iPos); Vector2Int pos = new Vector2Int(0, 0); if (cell == null) { return; } if (cell.pos == null) { return; } if (pos == null) { return; } for (int i = 0; i < size; i++) { pos = cell.pos; grassFactory.DestroyCell(cell.pos); cell = grassFactory.Add(pos, index); cell = cell.neighbours[(dir + Random.Range(0, 3) + 5) % 6]; if (cell == null) { break; } } return; }
public IEnumerator receiveImpuls(Propagateable origin) { if (timesActivated < origin.timesActivated) { if (Action != null) { Action(); } timesActivated = origin.timesActivated; activated = true; yield return(new WaitForSeconds(conveyTime)); activated = false; propagateImpuls(); yield return(new WaitForSeconds(impulsTime - conveyTime)); } }