public override void Reset() { currentMovementAction = CurrentMovementAction.StartWait; amountOfMovementsPerformed = 0; base.Reset(); }
public override void Reset() { currentMovementAction = CurrentMovementAction.StartWait; StartWaitRange = 60 * RetractWaitTime; GoingRange = StartWaitRange + 60 * ExtendTime; EndWaitRange = GoingRange + 60 * ExtendWaitTime; GoingBackRange = EndWaitRange + 60 * RetractTime; base.Reset(); }
public override Matrix PlatLocalTranslation() { float translationMultiplier = 0; switch (currentMovementAction) { case CurrentMovementAction.StartWait: if (LocalFrameCounter >= StartWaitRange) { currentMovementAction = CurrentMovementAction.Going; } break; case CurrentMovementAction.Going: translationMultiplier = (LocalFrameCounter - StartWaitRange) / (60 * ExtendTime); if (LocalFrameCounter >= GoingRange) { currentMovementAction = CurrentMovementAction.EndWait; } break; case CurrentMovementAction.EndWait: translationMultiplier = 1; if (LocalFrameCounter >= EndWaitRange) { currentMovementAction = CurrentMovementAction.GoingBack; } break; case CurrentMovementAction.GoingBack: translationMultiplier = 1 - ((LocalFrameCounter - EndWaitRange) / (60 * RetractTime)); if (LocalFrameCounter >= GoingBackRange) { currentMovementAction = CurrentMovementAction.StartWait; LocalFrameCounter = 0; } break; default: Reset(); break; } return(Matrix.Translation( RetractPositionX + ExtendDeltaPositionX * translationMultiplier, RetractPositionY + ExtendDeltaPositionY * translationMultiplier, RetractPositionZ + ExtendDeltaPositionZ * translationMultiplier)); }
public override Matrix PlatLocalRotation() { Matrix localWorld = Matrix.Identity; if (MovementType > 0) { AssetSingle rotationMultiplier = 0; if (((int)MovementLoopMode & 1) == 0) { switch (currentMovementAction) { case CurrentMovementAction.StartWait: rotationMultiplier = amountOfMovementsPerformed; if (LocalFrameCounter >= StartWaitRange) { currentMovementAction = CurrentMovementAction.Going; } break; case CurrentMovementAction.Going: rotationMultiplier = amountOfMovementsPerformed + Math.Min(1f, (LocalFrameCounter - StartWaitRange) / (60 * RotateTime)); if (LocalFrameCounter >= GoingRange) { if (((int)MovementLoopMode & 2) == 0) { amountOfMovementsPerformed++; } else { amountOfMovementsPerformed = 0; } currentMovementAction = CurrentMovementAction.StartWait; LocalFrameCounter = 0; } break; default: Reset(); break; } } else { switch (currentMovementAction) { case CurrentMovementAction.StartWait: if (LocalFrameCounter >= StartWaitRange) { currentMovementAction = CurrentMovementAction.Going; } break; case CurrentMovementAction.Going: rotationMultiplier = Math.Min(1, (LocalFrameCounter - StartWaitRange) / (60 * RotateTime)); if (LocalFrameCounter >= GoingRange) { currentMovementAction = CurrentMovementAction.EndWait; } break; case CurrentMovementAction.EndWait: rotationMultiplier = 1; if (LocalFrameCounter >= EndWaitRange) { currentMovementAction = CurrentMovementAction.GoingBack; } break; case CurrentMovementAction.GoingBack: rotationMultiplier = 1 - Math.Min(1, (LocalFrameCounter - EndWaitRange) / (60 * RotateTime)); if (LocalFrameCounter >= GoingBackRange) { currentMovementAction = CurrentMovementAction.StartWait; LocalFrameCounter = 0; } break; default: Reset(); break; } } switch (RotateAxis) { case Axis.X: localWorld = Matrix.RotationX(rotationMultiplier * MathUtil.DegreesToRadians(RotateDistance)); break; case Axis.Y: localWorld = Matrix.RotationY(rotationMultiplier * MathUtil.DegreesToRadians(RotateDistance)); break; case Axis.Z: localWorld = Matrix.RotationZ(rotationMultiplier * MathUtil.DegreesToRadians(RotateDistance)); break; } } return(localWorld); }
public override Matrix PlatLocalTranslation() { Matrix localWorld = Matrix.Identity; if (MovementType != EMovementType.Rotate) { float translationMultiplier = 0; if (((int)MovementLoopMode & 1) == 0) { switch (currentMovementAction) { case CurrentMovementAction.StartWait: translationMultiplier = amountOfMovementsPerformed; if (LocalFrameCounter >= StartWaitRange) { currentMovementAction = CurrentMovementAction.Going; } break; case CurrentMovementAction.Going: translationMultiplier = amountOfMovementsPerformed + Math.Min(1f, (LocalFrameCounter - StartWaitRange) / (60 * SlideTime)); if (LocalFrameCounter >= GoingRange) { if (((int)MovementLoopMode & 2) == 0) { amountOfMovementsPerformed++; } else { amountOfMovementsPerformed = 0; } currentMovementAction = CurrentMovementAction.StartWait; LocalFrameCounter = 0; } break; default: Reset(); break; } } else { switch (currentMovementAction) { case CurrentMovementAction.StartWait: if (LocalFrameCounter >= StartWaitRange) { currentMovementAction = CurrentMovementAction.Going; } break; case CurrentMovementAction.Going: translationMultiplier = Math.Min(1, (LocalFrameCounter - StartWaitRange) / (60 * SlideTime)); if (LocalFrameCounter >= GoingRange) { currentMovementAction = CurrentMovementAction.EndWait; } break; case CurrentMovementAction.EndWait: translationMultiplier = 1; if (LocalFrameCounter >= EndWaitRange) { currentMovementAction = CurrentMovementAction.GoingBack; } break; case CurrentMovementAction.GoingBack: translationMultiplier = 1 - Math.Min(1, (LocalFrameCounter - EndWaitRange) / (60 * SlideTime)); if (LocalFrameCounter >= GoingBackRange) { currentMovementAction = CurrentMovementAction.StartWait; LocalFrameCounter = 0; } break; default: Reset(); break; } } switch (SlideAxis) { case Axis.X: localWorld *= Matrix.Translation(translationMultiplier * SlideDistance, 0, 0); break; case Axis.Y: localWorld *= Matrix.Translation(0, translationMultiplier * SlideDistance, 0); break; case Axis.Z: localWorld *= Matrix.Translation(0, 0, translationMultiplier * SlideDistance); break; } } return(localWorld); }