private void TryAddToIrritableGridList(Grid g) { if (!g.GridObject) { return; } Irrigable i = g.GridObject.GetComponent <Irrigable>(); if (!i) { _irrigatableNeighborList.Remove(i); return; } if (!_irrigatableNeighborList.Contains(i)) { _irrigatableNeighborList.Add(i); } }
private bool TryIrrigateGrid(Irrigable i) { if (i.GridObject.ParentGrid.LevelController.Level > GridObject.ParentGrid.LevelController.Level) { return(false); } if (WaterLevel > i.GridObject.ParentGrid.LevelController.Level) { return(false); } if (i.TryIrrigate(this)) { _irrigatableNeighborList.Remove(i); OnIrrigatedGrid?.Invoke(i.GridObject.ParentGrid); return(true); } return(false); }