public void AddInfluence(Actor self, IOccupySpace ios) { foreach (var c in ios.OccupiedCells()) { var uv = c.Cell.ToMPos(map); var layer = influence[c.Cell.Layer]; if (!layer.Contains(uv)) { continue; } layer[uv] = new InfluenceNode { Next = layer[uv], SubCell = c.SubCell, Actor = self }; if (cellTriggerInfluence.TryGetValue(c.Cell, out var triggers)) { foreach (var t in triggers) { t.Dirty = true; } } CellUpdated?.Invoke(c.Cell); } }
public void RemoveInfluence(Actor self, IOccupySpace ios) { foreach (var c in ios.OccupiedCells()) { var uv = c.Cell.ToMPos(map); var layer = influence[c.Cell.Layer]; if (!layer.Contains(uv)) { continue; } var temp = layer[uv]; RemoveInfluenceInner(ref temp, self); layer[uv] = temp; if (cellTriggerInfluence.TryGetValue(c.Cell, out var triggers)) { foreach (var t in triggers) { t.Dirty = true; } } CellUpdated?.Invoke(c.Cell); } }
protected virtual void OnCellUpdated(CellDto e) { CellUpdated?.Invoke(this, e); }