public Force(SpeedTracker tracker, float accelleration, float angle, TimeSpan?duration = null) : base(tracker.MyThing) { this.Accelleration = accelleration; this.Angle = angle; this.tracker = tracker; this.Duration = duration.HasValue ? duration.Value : TimeSpan.Zero; }
public Force(SpeedTracker tracker, float accelleration, float angle, TimeSpan?duration = null) : base(tracker.Element) { this.Accelleration = accelleration; this.Angle = angle; this.tracker = tracker ?? throw new ArgumentNullException(); this.Duration = duration.HasValue ? duration.Value : TimeSpan.Zero; }
public Force(SpeedTracker tracker, float accelleration, float angle, TimeSpan?duration = null) : base(tracker.Element) { this.Accelleration = accelleration; this.Angle = angle; this.tracker = tracker ?? throw new ArgumentNullException(); this.Duration = duration.HasValue ? duration.Value : TimeSpan.Zero; if (Duration < TimeSpan.Zero) { this.IsPermanentForce = true; } else { this.EndTime = Time.CurrentTime.Now + Duration; } if (Duration == TimeSpan.Zero) { float dx, dy; CalculateSpeedDeltas(Accelleration, out dx, out dy); tracker.SpeedX += dx; tracker.SpeedY += dy; this.Lifetime.Dispose(); } }
public Seeker(Thing seeker, Thing seekee, SpeedTracker seekerSpeed, float accelleration) : base(seeker) { this.Seekee = seekee; this.SeekerSpeed = seekerSpeed; this.accelleration = accelleration; Governor.Rate = TimeSpan.FromSeconds(.1); Seekee.Removed.SubscribeForLifetime(() => { Scene.Remove(this); }, this.LifetimeManager); }
public Seeker(SpacialElement seeker, SpacialElement seekee, SpeedTracker seekerSpeed, float accelleration) : base(seeker) { this.Seekee = seekee; this.SeekerSpeed = seekerSpeed; this.accelleration = accelleration; IsSeeking = true; Governor.Rate = TimeSpan.FromSeconds(.1); Seekee.Lifetime.OnDisposed(() => { this.Lifetime.Dispose(); }); }
public Roamer(SpacialElement roamer, SpeedTracker roamerSpeed, float accelleration) : base(roamer) { this.RoamerSpeed = roamerSpeed; this.accelleration = accelleration; Governor.Rate = TimeSpan.FromSeconds(.1); if (IsRoaming) { currentForce = new Force(RoamerSpeed, accelleration, NextAngle()); } }
public Roamer(SpacialElement roamer, SpeedTracker roamerSpeed, float accelleration) : base(roamer) { this.RoamerSpeed = roamerSpeed; this.accelleration = accelleration; Governor.Rate = TimeSpan.FromSeconds(.1); }
public Floater(SpacialElement t, SpeedTracker tracker, float maxFloat = 1) : base(t) { this.MaxFloat = maxFloat; this.Governor.Rate = TimeSpan.FromSeconds(.03); this.tracker = tracker; }
private void CalculateSpeedDeltas(float dSpeed, out float dx, out float dy) { SpeedTracker.FindEdgesGivenHyp(dSpeed, Angle, out dx, out dy); }
public Gravity(SpeedTracker tr) : base(tr, 32, 90, TimeSpan.FromSeconds(-1)) { }