public override void Evaluate() { if (Element.Width != 1 || Element.Height != 1) { throw new NotSupportedException("Target element must be 1 x 1"); } satellite.MoveTo(SatelliteLeft, SatelliteTop); satellite.Symbol = SatelliteSymbol; shadow.MoveTo(ShadowLeft, ShadowTop); shadow.Symbol = ShadowSymbol; if (animateCharacterGovernor.ShouldFire(Time.CurrentTime.Now)) { currentIndex = currentIndex + 1 < chars.Length ? currentIndex + 1 : 0; } }
public override void Initialize() { if (Element.Width != 1 || Element.Height != 1) { throw new NotSupportedException("Target element must be 1 x 1"); } satellite = SpaceTime.CurrentSpaceTime.Add(new Satellite()); shadow = SpaceTime.CurrentSpaceTime.Add(new Satellite() { IsShadow = true }); this.Lifetime.OnDisposed(satellite.Lifetime.Dispose); this.Lifetime.OnDisposed(shadow.Lifetime.Dispose); Element.SizeOrPositionChanged.SubscribeForLifetime(() => { satellite.MoveTo(SatelliteLeft, SatelliteTop); shadow.MoveTo(ShadowLeft, ShadowTop); }, this.Lifetime); Element.SizeOrPositionChanged.Fire(); }