public void AddInfluence(Actor self, IOccupySpace ios) { foreach (var c in ios.OccupiedCells()) { var uv = c.Cell.ToMPos(map); if (!influence.Contains(uv)) { continue; } var layer = c.Cell.Layer == 0 ? influence : customInfluence[c.Cell.Layer]; layer[uv] = new InfluenceNode { Next = layer[uv], SubCell = c.SubCell, Actor = self }; List <CellTrigger> triggers; if (cellTriggerInfluence.TryGetValue(c.Cell, out triggers)) { foreach (var t in triggers) { t.Dirty = true; } } if (CellUpdated != null) { CellUpdated(c.Cell); } } }
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); } }
public void RemoveInfluence(Actor self, IOccupySpace ios) { foreach (var c in ios.OccupiedCells()) { RemoveInfluenceInner(ref influence[c.First.X, c.First.Y], self); } }
public void RemoveInfluence(Actor self, IOccupySpace ios) { foreach (var c in ios.OccupiedCells()) { var uv = c.Cell.ToMPos(map); if (!influence.Contains(uv)) { continue; } var layer = c.Cell.Layer == 0 ? influence : customInfluence[c.Cell.Layer]; var temp = layer[uv]; RemoveInfluenceInner(ref temp, self); layer[uv] = temp; List <CellTrigger> triggers; if (cellTriggerInfluence.TryGetValue(c.Cell, out triggers)) { foreach (var t in triggers) { t.Dirty = true; } } if (CellUpdated != null) { CellUpdated(c.Cell); } } }
public void AddToMaps(Actor self, IOccupySpace ios) { ActorMap.AddInfluence(self, ios); ActorMap.AddPosition(self, ios); ScreenMap.AddOrUpdate(self); //if(!self.Bounds.Size.IsEmpty) //ScreenMap.Add(self); }
public void Update(Actor self, IOccupySpace unit) { Remove(self, unit); if (!self.IsDead()) { Add(self, unit); } }
public void RemoveFromMaps(Actor self, IOccupySpace ios) { ActorMap.RemoveInfluence(self, ios); ActorMap.RemovePosition(self, ios); ScreenMap.Remove(self); //if(!self.Bounds.Size.IsEmpty) //ScreenMap.Remove(self); }
public void RemoveInfluence(Actor self, IOccupySpace ios) { foreach (var c in ios.OccupiedCells()) { var temp = influence[c.First]; RemoveInfluenceInner(ref temp, self); influence[c.First] = temp; } }
public void UpdateMaps(Actor self, IOccupySpace ios) { if (!self.IsInWorld) { return; } ScreenMap.AddOrUpdate(self); ActorMap.UpdatePosition(self, ios); }
public void AddInfluence(Actor self, IOccupySpace ios) { foreach (var c in ios.OccupiedCells()) { influence[c.First.X, c.First.Y] = new InfluenceNode { Next = influence[c.First.X, c.First.Y], SubCell = c.Second, Actor = self } } ; }
public void Remove(Actor self, IOccupySpace unit) { if (unit != null) { foreach (var c in unit.OccupiedCells()) { RemoveInner(ref influence[c.First.X, c.First.Y], self); } } }
public void UpdateOccupiedCells(IOccupySpace ios) { if (CellUpdated == null) { return; } foreach (var c in ios.OccupiedCells()) { CellUpdated(c.Cell); } }
/// <summary> /// 更新地图 /// </summary> /// <param name="self"></param> /// <param name="ios"></param> public void UpdateMaps(Actor self, IOccupySpace ios) { if (!self.IsInWorld) { return; } //if (!self.Bounds.Size.IsEmpty) //ScreenMap.Update(self); ScreenMap.AddOrUpdate(self); ActorMap.UpdatePosition(self, ios); }
public void Add(Actor self, IOccupySpace unit) { if (unit != null) { foreach (var c in unit.OccupiedCells()) { influence[c.First.X, c.First.Y] = new InfluenceNode { next = influence[c.First.X, c.First.Y], subCell = c.Second, actor = self } } } ; }
public static int2 NearestCellTo(this IOccupySpace ios, int2 other) { var nearest = ios.TopLeft; var nearestDistance = int.MaxValue; foreach (var cell in ios.OccupiedCells()) { var dist = (other - cell.First).LengthSquared; if (dist < nearestDistance) { nearest = cell.First; nearestDistance = dist; } } return(nearest); }
public void AddInfluence(Actor self, IOccupySpace ios) { foreach (var c in ios.OccupiedCells()) { if (!map.Contains(c.First)) { continue; } influence[c.First] = new InfluenceNode { Next = influence[c.First], SubCell = c.Second, Actor = self }; List <CellTrigger> triggers; if (cellTriggerInfluence.TryGetValue(c.First, out triggers)) { foreach (var t in triggers) { t.Dirty = true; } } } }
/// <summary> /// /// </summary> /// <param name="self"></param> /// <param name="ios"></param> public void RemoveInfluence(Actor self, IOccupySpace ios) { foreach (var c in ios.OccupiedCells()) { var uv = c.First.ToMPos(map); if (!influence.Contains(uv)) { continue; } var temp = influence[uv]; RemoveInfluenceInner(ref temp, self); influence[uv] = temp; List <CellTrigger> triggers; if (cellTriggerInfluence.TryGetValue(c.First, out triggers)) { foreach (var t in triggers) { t.Dirty = true; } } } }
public void Add( Actor self, IOccupySpace unit ) { foreach( var c in unit.OccupiedCells() ) influence[ c.X, c.Y ] = new InfluenceNode { next = influence[ c.X, c.Y ], actor = self }; }
public void AddToMaps(Actor self, IOccupySpace ios) { ActorMap.AddInfluence(self, ios); ActorMap.AddPosition(self, ios); ScreenMap.AddOrUpdate(self); }
public void UpdatePosition(Actor a, IOccupySpace ios) { RemovePosition(a, ios); addActorPosition.Add(a); }
public void RemovePosition(Actor a, IOccupySpace ios) { removeActorPosition.Add(a); }
public void RemoveInfluence(Actor self, IOccupySpace ios) { foreach (var c in ios.OccupiedCells()) { if (!map.Contains(c.First)) continue; var temp = influence[c.First]; RemoveInfluenceInner(ref temp, self); influence[c.First] = temp; List<CellTrigger> triggers; if (cellTriggerInfluence.TryGetValue(c.First, out triggers)) foreach (var t in triggers) t.Dirty = true; } }
public void AddPosition(Actor a, IOccupySpace ios) { UpdatePosition(a, ios); }
public void AddPosition(Actor a, IOccupySpace ios) { addActorPosition.Add(a); }
public void UpdatePosition(Actor a, IOccupySpace ios) { RemovePosition(a, ios); AddPosition(a, ios); }
public void Remove( Actor self, IOccupySpace unit ) { if (unit != null) foreach (var c in unit.OccupiedCells()) influence[c.X, c.Y].Remove(self); }
void INotifyCreated.Created(Actor self) { conditionManager = self.TraitOrDefault <ConditionManager>(); positionable = self.TraitOrDefault <IPositionable>(); ios = self.TraitOrDefault <IOccupySpace>(); }
public void RemoveInfluence(Actor self, IOccupySpace ios) { foreach (var c in ios.OccupiedCells()) RemoveInfluenceInner(ref influence[c.First.X, c.First.Y], self); }
public void Add( Actor self, IOccupySpace unit ) { foreach( var c in unit.OccupiedCells() ) influence[c.X, c.Y].Add(self); }
public void RemoveFromMaps(Actor self, IOccupySpace ios) { ActorMap.RemoveInfluence(self, ios); ActorMap.RemovePosition(self, ios); ScreenMap.Remove(self); }
public void Remove( Actor self, IOccupySpace unit ) { if (unit != null) foreach (var c in unit.OccupiedCells()) RemoveInner( ref influence[ c.First.X, c.First.Y ], self ); }
public void Update(Actor self, IOccupySpace unit) { Remove(self, unit); if (!self.IsDead()) Add(self, unit); }
public void Add( Actor self, IOccupySpace unit ) { if (unit != null) foreach( var c in unit.OccupiedCells() ) influence[ c.First.X, c.First.Y ] = new InfluenceNode { next = influence[ c.First.X, c.First.Y ], subCell = c.Second, actor = self }; }
public void AddInfluence(Actor self, IOccupySpace ios) { foreach (var c in ios.OccupiedCells()) { if (!map.Contains(c.First)) continue; influence[c.First] = new InfluenceNode { Next = influence[c.First], SubCell = c.Second, Actor = self }; List<CellTrigger> triggers; if (cellTriggerInfluence.TryGetValue(c.First, out triggers)) foreach (var t in triggers) t.Dirty = true; } }
public void AddInfluence(Actor self, IOccupySpace ios) { foreach (var c in ios.OccupiedCells()) influence[c.First] = new InfluenceNode { Next = influence[c.First], SubCell = c.Second, Actor = self }; }