protected override void Move(float time)
{
if (tornado == null)
{
switch (state)
{
case State.Ground:
#region preform flying move
this.drawAngle = 0;
this.bounds.X += (float)(Math.Sin(flyHeading) * speed * time * timeScaleFactor);
this.bounds.Y -= (float)(Math.Cos(flyHeading) * speed * time * timeScaleFactor);
#endregion
//figure out if we are out of bounds and raise the remove flag
if (!this.bounds.Intersects(level.Bounds))
{
this.requestRemoveFromMegaTile = true;
}
break;
}
}
else
{
switch (state)
{
case State.Flying:
updateErrorDist(tornado.Radius / 8, tornado.Radius / 1.5f); //generates a new error term
updateErrorSpeed(tornado.RotationalSpeed / 10.0f, tornado.RotationalSpeed / 2); //generates a new error speed term
moveAngle = getAngleToPoint(tornado.Position) + (float)Math.PI / (2 * (getDistanceFromTornado() / (tornado.Radius + errorDist)));
#region performmove
this.bounds.X += (float)(Math.Sin(moveAngle) * (tornado.RotationalSpeed + errorSpeed)) * time * timeScaleFactor;
this.bounds.Y -= (float)(Math.Cos(moveAngle) * (tornado.RotationalSpeed + errorSpeed)) * time * timeScaleFactor;
#endregion
#region RubberBand
RubberBandMe(time);
#endregion
break;
}
}
}