public MovementDolly(UnitView UnitView, Path <Tile> Path, Unit Carrier) { _End = Path.Destination.Center; if (Path.Distance > 0) { _Spline = new CardinalSpline(); foreach (Tile t in Path.Nodes.Where((x, i) => i % 2 == 0 || i == Path.Nodes.Count() - 1)) { _Spline.Points.Add(t.Center); } bool unlimitedMove = Carrier == null ? UnitView.Unit.Configuration.HasUnlimitedMovement() : Carrier.Configuration.HasUnlimitedMovement(); if (unlimitedMove) { _SpeedRecipricol = .0002; } else { float move = Carrier == null ? UnitView.Unit.Configuration.Movement : Carrier.Configuration.Movement; _SpeedRecipricol = .0002 * move / Path.Distance; } } else { _Traveled = 1; } }
void MoveUnit(Unit Unit, MovementEventArgs E, bool Visible) { Tile tile = E.Tile; UnitView view = _UnitViews[Unit]; view.Move(E); view.SetAlpha(Visible ? (byte)255 : LAST_SEEN_ALPHA); var from = _Stacks.FirstOrDefault(i => i.Value.Contains(Unit)); StackView fromStack = from.Value; StackView toStack = _Stacks.FirstOrDefault(i => i.Key == tile).Value; if (toStack != null && toStack == fromStack) { return; } if (toStack == null) { toStack = new StackView(); _Stacks.Add(new KeyValuePair <Tile, StackView>(tile, toStack)); } toStack.Add(view); if (fromStack != null) { fromStack.Remove(Unit); if (fromStack.Units.Count() == 0) { _Stacks.Remove(from); } } }
public void AddUnitView(UnitView UnitView, SightFinder SightFinder) { _UnitViews.Add(UnitView.Unit, UnitView); if (SightFinder != null) { SetUnitVisibility(UnitView.Unit, SightFinder.GetUnitVisibility(UnitView.Unit)); } }
public void AddUnit(Unit Unit) { var unitView = new UnitView(Unit, UnitRenderer, .625f, true); _StackLayer.AddUnitView(unitView, _SightFinder); if (OnUnitAdded != null) { OnUnitAdded(this, new ValuedEventArgs <UnitView>(unitView)); } }
public NewUnitViewEventArgs(UnitView UnitView) { this.UnitView = UnitView; }
public void Add(UnitView UnitView) { _UnitViews.Add(UnitView); Sort(); }
void AddUnit(UnitView UnitView) { UnitView.OnClick += OnUnitClick; UnitView.OnRightClick += OnUnitRightClick; }