2021-10-14 01:21:10 +02:00
|
|
|
|
Public Class BAEntityRotate
|
|
|
|
|
|
|
|
|
|
Inherits BattleAnimation3D
|
|
|
|
|
|
|
|
|
|
Dim TargetEntity As Entity
|
|
|
|
|
Dim RotationSpeedVector As Vector3
|
|
|
|
|
Dim EndRotation As Vector3
|
|
|
|
|
Dim DoReturn As Boolean = False
|
|
|
|
|
Dim ReturnVector As Vector3
|
|
|
|
|
Dim hasReturned As Boolean = False
|
|
|
|
|
Dim DoRotation As Vector3 = New Vector3(1.0F)
|
2023-06-20 15:55:47 +02:00
|
|
|
|
Dim AmountRotated As Vector3 = New Vector3(0.0F)
|
|
|
|
|
Dim ReadyAxis As Vector3 = New Vector3(0.0F)
|
2021-10-29 18:54:00 +02:00
|
|
|
|
Public RemoveEntityAfter As Boolean = False
|
2021-10-14 01:21:10 +02:00
|
|
|
|
|
2021-10-29 18:54:00 +02:00
|
|
|
|
Public Sub New(ByVal Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal RotationSpeedVector As Vector3, ByVal EndRotation As Vector3, ByVal startDelay As Single, ByVal endDelay As Single)
|
2021-10-14 01:21:10 +02:00
|
|
|
|
MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay)
|
2021-10-29 18:54:00 +02:00
|
|
|
|
Me.RemoveEntityAfter = RemoveEntityAfter
|
2021-10-14 01:21:10 +02:00
|
|
|
|
Me.RotationSpeedVector = RotationSpeedVector
|
|
|
|
|
Me.EndRotation = EndRotation
|
|
|
|
|
Me.TargetEntity = Entity
|
2022-04-22 21:56:25 +02:00
|
|
|
|
Me.ReturnVector = TargetEntity.Rotation
|
2023-09-06 12:13:24 +02:00
|
|
|
|
|
|
|
|
|
Me.AnimationType = AnimationTypes.Rotation
|
2021-10-14 01:21:10 +02:00
|
|
|
|
End Sub
|
|
|
|
|
|
2021-10-29 18:54:00 +02:00
|
|
|
|
Public Sub New(ByVal Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal RotationSpeedVector As Vector3, ByVal EndRotation As Vector3, ByVal startDelay As Single, ByVal endDelay As Single, ByVal DoXRotation As Boolean, ByVal DoYRotation As Boolean, ByVal DoZRotation As Boolean)
|
|
|
|
|
Me.New(Entity, RemoveEntityAfter, RotationSpeedVector, EndRotation, startDelay, endDelay)
|
2021-10-14 01:21:10 +02:00
|
|
|
|
|
|
|
|
|
If DoXRotation = False Then
|
|
|
|
|
DoRotation.X = 0.0F
|
2023-06-20 15:55:47 +02:00
|
|
|
|
ReadyAxis.X = 1.0F
|
2021-10-14 01:21:10 +02:00
|
|
|
|
End If
|
|
|
|
|
If DoYRotation = False Then
|
|
|
|
|
DoRotation.Y = 0.0F
|
2023-06-20 15:55:47 +02:00
|
|
|
|
ReadyAxis.Y = 1.0F
|
2021-10-14 01:21:10 +02:00
|
|
|
|
End If
|
|
|
|
|
If DoZRotation = False Then
|
|
|
|
|
DoRotation.Z = 0.0F
|
2023-06-20 15:55:47 +02:00
|
|
|
|
ReadyAxis.Z = 1.0F
|
2021-10-14 01:21:10 +02:00
|
|
|
|
End If
|
|
|
|
|
End Sub
|
|
|
|
|
|
2021-10-29 18:54:00 +02:00
|
|
|
|
Public Sub New(ByVal Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal RotationSpeedVector As Vector3, ByVal EndRotation As Vector3, ByVal startDelay As Single, ByVal endDelay As Single, ByVal DoXRotation As Boolean, ByVal DoYRotation As Boolean, ByVal DoZRotation As Boolean, ByVal DoReturn As Boolean)
|
|
|
|
|
Me.New(Entity, RemoveEntityAfter, RotationSpeedVector, EndRotation, startDelay, endDelay, DoXRotation, DoYRotation, DoZRotation)
|
2021-10-14 01:21:10 +02:00
|
|
|
|
|
|
|
|
|
Me.DoReturn = DoReturn
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Public Overrides Sub DoActionActive()
|
2023-06-20 15:55:47 +02:00
|
|
|
|
If DoRotation.X = 1.0F Then
|
|
|
|
|
If AmountRotated.X < Math.Abs(EndRotation.X) Then
|
2021-10-14 01:21:10 +02:00
|
|
|
|
If TargetEntity.Rotation.X > Me.EndRotation.X Then
|
|
|
|
|
TargetEntity.Rotation.X += Me.RotationSpeedVector.X
|
|
|
|
|
|
|
|
|
|
If TargetEntity.Rotation.X <= Me.EndRotation.X Then
|
|
|
|
|
TargetEntity.Rotation.X = Me.EndRotation.X
|
|
|
|
|
End If
|
|
|
|
|
ElseIf TargetEntity.Rotation.X < Me.EndRotation.X Then
|
|
|
|
|
TargetEntity.Rotation.X += Me.RotationSpeedVector.X
|
|
|
|
|
|
|
|
|
|
If TargetEntity.Rotation.X >= Me.EndRotation.X Then
|
|
|
|
|
TargetEntity.Rotation.X = Me.EndRotation.X
|
|
|
|
|
End If
|
|
|
|
|
End If
|
2023-06-20 15:55:47 +02:00
|
|
|
|
AmountRotated.X += Math.Abs(Me.RotationSpeedVector.X)
|
|
|
|
|
Else
|
|
|
|
|
ReadyAxis.X = 1.0F
|
2021-10-14 01:21:10 +02:00
|
|
|
|
End If
|
2023-06-20 15:55:47 +02:00
|
|
|
|
End If
|
|
|
|
|
If DoRotation.Y = 1.0F Then
|
|
|
|
|
If AmountRotated.Y < Math.Abs(EndRotation.Y) Then
|
2021-10-14 01:21:10 +02:00
|
|
|
|
If TargetEntity.Rotation.Y > Me.EndRotation.Y Then
|
|
|
|
|
TargetEntity.Rotation.Y += Me.RotationSpeedVector.Y
|
|
|
|
|
|
|
|
|
|
If TargetEntity.Rotation.Y <= Me.EndRotation.Y Then
|
|
|
|
|
TargetEntity.Rotation.Y = Me.EndRotation.Y
|
|
|
|
|
End If
|
|
|
|
|
ElseIf TargetEntity.Rotation.Y < Me.EndRotation.Y Then
|
|
|
|
|
TargetEntity.Rotation.Y += Me.RotationSpeedVector.Y
|
|
|
|
|
|
|
|
|
|
If TargetEntity.Rotation.Y >= Me.EndRotation.Y Then
|
|
|
|
|
TargetEntity.Rotation.Y = Me.EndRotation.Y
|
|
|
|
|
End If
|
|
|
|
|
End If
|
2023-06-20 15:55:47 +02:00
|
|
|
|
AmountRotated.Y += Math.Abs(Me.RotationSpeedVector.Y)
|
|
|
|
|
Else
|
|
|
|
|
ReadyAxis.y = 1.0F
|
2021-10-14 01:21:10 +02:00
|
|
|
|
End If
|
2023-06-20 15:55:47 +02:00
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If DoRotation.Z = 1.0F Then
|
|
|
|
|
If AmountRotated.Z < Math.Abs(EndRotation.Z) Then
|
2021-10-14 01:21:10 +02:00
|
|
|
|
|
|
|
|
|
If TargetEntity.Rotation.Z > Me.EndRotation.Z Then
|
|
|
|
|
TargetEntity.Rotation.Z += Me.RotationSpeedVector.Z
|
|
|
|
|
|
|
|
|
|
If TargetEntity.Rotation.Z <= Me.EndRotation.Z Then
|
|
|
|
|
TargetEntity.Rotation.Z = Me.EndRotation.Z
|
|
|
|
|
End If
|
|
|
|
|
ElseIf TargetEntity.Rotation.Z < Me.EndRotation.Z Then
|
|
|
|
|
TargetEntity.Rotation.Z += Me.RotationSpeedVector.Z
|
|
|
|
|
|
|
|
|
|
If TargetEntity.Rotation.Z >= Me.EndRotation.Z Then
|
|
|
|
|
TargetEntity.Rotation.Z = Me.EndRotation.Z
|
|
|
|
|
End If
|
|
|
|
|
End If
|
2023-06-20 15:55:47 +02:00
|
|
|
|
AmountRotated.Z += Math.Abs(Me.RotationSpeedVector.Z)
|
|
|
|
|
Else
|
|
|
|
|
ReadyAxis.Z = 1.0F
|
2021-10-14 01:21:10 +02:00
|
|
|
|
End If
|
2023-06-20 15:55:47 +02:00
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If ReadyAxis.X = 1.0F AndAlso ReadyAxis.Y = 1.0F AndAlso ReadyAxis.Z = 1.0F Then
|
2021-10-14 01:21:10 +02:00
|
|
|
|
RotationReady()
|
|
|
|
|
End If
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Private Sub RotationReady()
|
2023-06-20 15:55:47 +02:00
|
|
|
|
|
2021-10-14 01:21:10 +02:00
|
|
|
|
If Me.DoReturn = True And Me.hasReturned = False Then
|
|
|
|
|
Me.hasReturned = True
|
|
|
|
|
Me.EndRotation = Me.ReturnVector
|
|
|
|
|
Me.RotationSpeedVector = New Vector3(Me.RotationSpeedVector.X * -1, Me.RotationSpeedVector.Y * -1, Me.RotationSpeedVector.Z * -1)
|
2023-06-20 15:55:47 +02:00
|
|
|
|
If DoRotation.X = 1.0F Then
|
|
|
|
|
ReadyAxis.X = 0.0F
|
2023-08-01 12:24:35 +02:00
|
|
|
|
AmountRotated.X -= AmountRotated.X * 2
|
2021-10-14 01:21:10 +02:00
|
|
|
|
End If
|
2023-06-20 15:55:47 +02:00
|
|
|
|
If DoRotation.Y = 1.0F Then
|
|
|
|
|
ReadyAxis.Y = 0.0F
|
2023-08-01 12:24:35 +02:00
|
|
|
|
AmountRotated.Y -= AmountRotated.Y * 2
|
2021-10-14 01:21:10 +02:00
|
|
|
|
End If
|
2023-06-20 15:55:47 +02:00
|
|
|
|
If DoRotation.Z = 1.0F Then
|
|
|
|
|
ReadyAxis.Z = 0.0F
|
2023-08-01 12:24:35 +02:00
|
|
|
|
AmountRotated.Z -= AmountRotated.Z * 2
|
2021-10-14 01:21:10 +02:00
|
|
|
|
End If
|
2023-06-20 15:55:47 +02:00
|
|
|
|
Else
|
|
|
|
|
Me.Ready = True
|
2021-10-14 01:21:10 +02:00
|
|
|
|
End If
|
2023-06-20 15:55:47 +02:00
|
|
|
|
End Sub
|
2021-10-14 01:21:10 +02:00
|
|
|
|
|
2021-10-29 18:54:00 +02:00
|
|
|
|
Public Overrides Sub DoRemoveEntity()
|
|
|
|
|
If Me.RemoveEntityAfter = True Then
|
|
|
|
|
TargetEntity.CanBeRemoved = True
|
|
|
|
|
End If
|
|
|
|
|
End Sub
|
2021-10-14 01:21:10 +02:00
|
|
|
|
End Class
|