public override void update(TimeSpan timeSinceLastUpdate) { _velocityTracker.update(Program.Me.CubeGrid.GetPosition(), timeSinceLastUpdate); updatePlanetInfo(); base.update(timeSinceLastUpdate); }
public override void update(TimeSpan timeSinceLastUpdate) { if (!FoundAllBlocks) { _cubeGridPosition = new Vector3D(); _velocityTracker.reset(); } else { _cubeGridPosition = _cockpits[0].CenterOfMass; _velocityTracker.update(_cubeGridPosition, timeSinceLastUpdate); } base.update(timeSinceLastUpdate); }
public override void update(MyContext context) { if (!context.FoundAllBlocks) { context.transition(MyContext.Stopped); return; } bool wasInitialised = _velocityTracker.IsInitialized; _velocityTracker.update(context.Program.Me.CubeGrid.GetPosition(), context.Program.Runtime.TimeSinceLastRun); if (wasInitialised) { Vector3D directionForward = context._cockpits[0].WorldMatrix.GetDirectionVector(Base6Directions.Direction.Forward); context._desiredSpeed = _velocityTracker.Velocity.Dot(directionForward); context._desiredSpeed = Math.Min(100, Math.Max(0, context._desiredSpeed)); context.transition(new CruiseControlState()); } }