Fixed Spawned Entities not being removed after the animation is done + Made the switch Pokémon animation look better

This commit is contained in:
JappaWakkaP3D 2021-10-29 18:54:00 +02:00
parent 72599bfd16
commit 3900fe7191
10 changed files with 117 additions and 69 deletions

View File

@ -5,6 +5,7 @@
Public TargetEntity As Entity Public TargetEntity As Entity
Public Destination As Vector3 Public Destination As Vector3
Public MoveSpeed As Single Public MoveSpeed As Single
Public MoveYSpeed As Single
Public InterpolationSpeed As Single Public InterpolationSpeed As Single
Public SpinX As Boolean = False Public SpinX As Boolean = False
Public SpinZ As Boolean = False Public SpinZ As Boolean = False
@ -13,6 +14,7 @@
Public MovementCurve As Integer = 3 Public MovementCurve As Integer = 3
Private EasedIn As Boolean = False Private EasedIn As Boolean = False
Private EasedOut As Boolean = False Private EasedOut As Boolean = False
Public RemoveEntityAfter As Boolean
Public Enum Curves As Integer Public Enum Curves As Integer
EaseIn EaseIn
EaseOut EaseOut
@ -20,11 +22,17 @@
Linear Linear
End Enum End Enum
Public Sub New(ByRef Entity As Entity, ByVal Destination As Vector3, ByVal Speed As Single, ByVal SpinX As Boolean, ByVal SpinZ As Boolean, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal SpinXSpeed As Single = 0.1F, Optional ByVal SpinZSpeed As Single = 0.1F, Optional MovementCurve As Integer = 3) Public Sub New(ByRef Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal Destination As Vector3, ByVal Speed As Single, ByVal SpinX As Boolean, ByVal SpinZ As Boolean, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal SpinXSpeed As Single = 0.1F, Optional ByVal SpinZSpeed As Single = 0.1F, Optional MovementCurve As Integer = 3, Optional MoveYSpeed As Single = 0.0F)
MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay) MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay)
Me.RemoveEntityAfter = RemoveEntityAfter
Me.Destination = Destination Me.Destination = Destination
Me.MoveSpeed = Speed Me.MoveSpeed = Speed
If MoveYSpeed = 0F Then
Me.MoveYSpeed = MoveSpeed
Else
Me.MoveYSpeed = MoveYSpeed
End If
Me.MovementCurve = CType(MovementCurve, Curves) Me.MovementCurve = CType(MovementCurve, Curves)
Me.SpinX = SpinX Me.SpinX = SpinX
@ -121,13 +129,13 @@
End If End If
End If End If
If TargetEntity.Position.Y < Me.Destination.Y Then If TargetEntity.Position.Y < Me.Destination.Y Then
TargetEntity.Position.Y += Me.MoveSpeed TargetEntity.Position.Y += Me.MoveYSpeed
If TargetEntity.Position.Y >= Me.Destination.Y Then If TargetEntity.Position.Y >= Me.Destination.Y Then
TargetEntity.Position.Y = Me.Destination.Y TargetEntity.Position.Y = Me.Destination.Y
End If End If
ElseIf TargetEntity.Position.Y > Me.Destination.Y Then ElseIf TargetEntity.Position.Y > Me.Destination.Y Then
TargetEntity.Position.Y -= Me.MoveSpeed TargetEntity.Position.Y -= Me.MoveYSpeed
If TargetEntity.Position.Y <= Me.Destination.Y Then If TargetEntity.Position.Y <= Me.Destination.Y Then
TargetEntity.Position.Y = Me.Destination.Y TargetEntity.Position.Y = Me.Destination.Y
@ -185,5 +193,10 @@
Me.Ready = True Me.Ready = True
End If End If
End Sub End Sub
Public Overrides Sub DoRemoveEntity()
If Me.RemoveEntityAfter = True Then
TargetEntity.CanBeRemoved = True
End If
End Sub
End Class End Class

View File

@ -6,9 +6,11 @@
Public TransitionSpeed As Single = 0.01F Public TransitionSpeed As Single = 0.01F
Public FadeIn As Boolean = False Public FadeIn As Boolean = False
Public EndState As Single = 0.0F Public EndState As Single = 0.0F
Public RemoveEntityAfter As Boolean
Public Sub New(ByVal entity As Entity, ByVal TransitionSpeed As Single, ByVal FadeIn As Boolean, ByVal EndState As Single, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal StartState As Single = 1.0F) Public Sub New(ByVal entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal TransitionSpeed As Single, ByVal FadeIn As Boolean, ByVal EndState As Single, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal StartState As Single = 1.0F)
MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay) MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay)
Me.RemoveEntityAfter = RemoveEntityAfter
Me.EndState = EndState Me.EndState = EndState
Me.FadeIn = FadeIn Me.FadeIn = FadeIn
Me.TransitionSpeed = TransitionSpeed Me.TransitionSpeed = TransitionSpeed
@ -41,5 +43,9 @@
Me.Ready = True Me.Ready = True
End If End If
End Sub End Sub
Public Overrides Sub DoRemoveEntity()
If Me.RemoveEntityAfter = True Then
TargetEntity.CanBeRemoved = True
End If
End Sub
End Class End Class

View File

@ -9,18 +9,19 @@
Dim ReturnVector As Vector3 Dim ReturnVector As Vector3
Dim hasReturned As Boolean = False Dim hasReturned As Boolean = False
Dim DoRotation As Vector3 = New Vector3(1.0F) Dim DoRotation As Vector3 = New Vector3(1.0F)
Public RemoveEntityAfter As Boolean = False
Public Sub New(ByVal Entity As Entity, ByVal RotationSpeedVector As Vector3, ByVal EndRotation As Vector3, ByVal startDelay As Single, ByVal endDelay As Single) 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)
MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay) MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay)
Me.RemoveEntityAfter = RemoveEntityAfter
Me.RotationSpeedVector = RotationSpeedVector Me.RotationSpeedVector = RotationSpeedVector
Me.EndRotation = EndRotation Me.EndRotation = EndRotation
Me.ReturnVector = Me.Rotation Me.ReturnVector = Me.Rotation
Me.TargetEntity = Entity Me.TargetEntity = Entity
End Sub End Sub
Public Sub New(ByVal Entity As Entity, 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) 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, RotationSpeedVector, EndRotation, startDelay, endDelay) Me.New(Entity, RemoveEntityAfter, RotationSpeedVector, EndRotation, startDelay, endDelay)
If DoXRotation = False Then If DoXRotation = False Then
DoRotation.X = 0.0F DoRotation.X = 0.0F
@ -33,8 +34,8 @@
End If End If
End Sub End Sub
Public Sub New(ByVal Entity As Entity, 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) 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, RotationSpeedVector, EndRotation, startDelay, endDelay, DoXRotation, DoYRotation, DoZRotation) Me.New(Entity, RemoveEntityAfter, RotationSpeedVector, EndRotation, startDelay, endDelay, DoXRotation, DoYRotation, DoZRotation)
Me.DoReturn = DoReturn Me.DoReturn = DoReturn
End Sub End Sub
@ -128,4 +129,9 @@
Return True Return True
End Function End Function
Public Overrides Sub DoRemoveEntity()
If Me.RemoveEntityAfter = True Then
TargetEntity.CanBeRemoved = True
End If
End Sub
End Class End Class

View File

@ -9,10 +9,11 @@
Public Anchors As String '1 = Bottom, 2 = Top, 3 = Left, 4 = Right. Combinations are possible. Public Anchors As String '1 = Bottom, 2 = Top, 3 = Left, 4 = Right. Combinations are possible.
Public Change As New Vector3(1) Public Change As New Vector3(1)
Public RemoveEntityAfter As Boolean
Public Sub New(ByVal Entity As Entity, ByVal Scale As Vector3, ByVal Grow As Boolean, ByVal EndSize As Vector3, ByVal SizeSpeed As Single, ByVal startDelay As Single, ByVal endDelay As Single, ByVal Anchors As String) Public Sub New(ByVal Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal Scale As Vector3, ByVal Grow As Boolean, ByVal EndSize As Vector3, ByVal SizeSpeed As Single, ByVal startDelay As Single, ByVal endDelay As Single, ByVal Anchors As String)
MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, Scale, startDelay, endDelay) MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, Scale, startDelay, endDelay)
Me.RemoveEntityAfter = RemoveEntityAfter
Me.Anchors = Anchors Me.Anchors = Anchors
Me.Grow = Grow Me.Grow = Grow
Me.EndSize = EndSize Me.EndSize = EndSize
@ -104,5 +105,10 @@
Public Sub SetChange(ByVal changeX As Single, ByVal changeY As Single, ByVal changeZ As Single) Public Sub SetChange(ByVal changeX As Single, ByVal changeY As Single, ByVal changeZ As Single)
Me.Change = New Vector3(changeX, changeY, changeZ) Me.Change = New Vector3(changeX, changeY, changeZ)
End Sub End Sub
Public Overrides Sub DoRemoveEntity()
If Me.RemoveEntityAfter = True Then
TargetEntity.CanBeRemoved = True
End If
End Sub
End Class End Class

View File

@ -4,10 +4,11 @@
Public Texture As Texture2D Public Texture As Texture2D
Public TargetEntity As Entity Public TargetEntity As Entity
Public RemoveEntityAfter As Boolean
Public Sub New(ByVal Entity As Entity, Texture As Texture2D, ByVal startDelay As Single, ByVal endDelay As Single) Public Sub New(ByVal Entity As Entity, ByVal RemoveEntityAfter As Boolean, Texture As Texture2D, ByVal startDelay As Single, ByVal endDelay As Single)
MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay) MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay)
Me.RemoveEntityAfter = RemoveEntityAfter
Me.TargetEntity = Entity Me.TargetEntity = Entity
Me.Texture = Texture Me.Texture = Texture
Me.AnimationType = AnimationTypes.Texture Me.AnimationType = AnimationTypes.Texture
@ -18,4 +19,9 @@
Me.Ready = True Me.Ready = True
End Sub End Sub
Public Overrides Sub DoRemoveEntity()
If Me.RemoveEntityAfter = True Then
TargetEntity.CanBeRemoved = True
End If
End Sub
End Class End Class

View File

@ -50,6 +50,7 @@
End If End If
Else Else
CanRemove = True CanRemove = True
DoRemoveEntity()
End If End If
Else Else
If startDelay > 0.0F Then If startDelay > 0.0F Then
@ -61,6 +62,8 @@
Else Else
If SpawnedEntity = True Then If SpawnedEntity = True Then
Ready = True Ready = True
Else
Me.Visible = True
End If End If
DoActionActive() DoActionActive()
End If End If
@ -87,6 +90,9 @@
Public Overridable Sub DoActionActive() Public Overridable Sub DoActionActive()
'Insert code in Inherits class here. 'Insert code in Inherits class here.
End Sub End Sub
Public Overridable Sub DoRemoveEntity()
'Insert code in Inherits class here.
End Sub
Public Overrides Sub Render() Public Overrides Sub Render()
If Me.startDelay <= 0.0F Then If Me.startDelay <= 0.0F Then

View File

@ -6842,7 +6842,6 @@
Dim SmokeSpeed = CSng(Random.Next(1, 3) / 20.0F) Dim SmokeSpeed = CSng(Random.Next(1, 3) / 20.0F)
Dim SmokeEntity As Entity = BallReturn.SpawnEntity(SmokePosition, SmokeTexture, SmokeScale, 1.0F) Dim SmokeEntity As Entity = BallReturn.SpawnEntity(SmokePosition, SmokeTexture, SmokeScale, 1.0F)
BallReturn.AnimationMove(SmokeEntity, True, SmokeDestination.X, SmokeDestination.Y, SmokeDestination.Z, SmokeSpeed, False, False, 0.0F, 0.0F) BallReturn.AnimationMove(SmokeEntity, True, SmokeDestination.X, SmokeDestination.Y, SmokeDestination.Z, SmokeSpeed, False, False, 0.0F, 0.0F)
Threading.Interlocked.Increment(SmokeReturned) Threading.Interlocked.Increment(SmokeReturned)
@ -6900,7 +6899,7 @@
BallThrow.AnimationPlaySound("Battle\Pokeball\Throw", 0, 0) BallThrow.AnimationPlaySound("Battle\Pokeball\Throw", 0, 0)
Dim BallThrowEntity As Entity = BallThrow.SpawnEntity(New Vector3(-2, -0.15, 0), BattleScreen.OwnPokemon.CatchBall.Texture, New Vector3(0.3F), 1.0F) Dim BallThrowEntity As Entity = BallThrow.SpawnEntity(New Vector3(-2, -0.15, 0), BattleScreen.OwnPokemon.CatchBall.Texture, New Vector3(0.3F), 1.0F)
BallThrow.AnimationMove(BallThrowEntity, True, 0, 0.35, 0, 0.1, False, True, 0F, 0F,, 0.3) BallThrow.AnimationMove(BallThrowEntity, True, 0, 0.35, 0, 0.1, False, True, 0F, 0.5F,, 0.3,, 0.025F)
' Ball Opens ' Ball Opens
BallThrow.AnimationPlaySound("Battle\Pokeball\Open", 3, 0) BallThrow.AnimationPlaySound("Battle\Pokeball\Open", 3, 0)
@ -6912,10 +6911,9 @@
Dim SmokeTexture As Texture2D = TextureManager.GetTexture("Textures\Battle\Smoke") Dim SmokeTexture As Texture2D = TextureManager.GetTexture("Textures\Battle\Smoke")
Dim SmokeScale = New Vector3(CSng(Random.Next(2, 6) / 10)) Dim SmokeScale = New Vector3(CSng(Random.Next(2, 6) / 10))
Dim SmokeSpeed = CSng(Random.Next(1, 3) / 10.0F) Dim SmokeSpeed = CSng(Random.Next(1, 3) / 20.0F)
Dim SmokeEntity As Entity = BallThrow.SpawnEntity(Nothing, SmokeTexture, SmokeScale, 1.0F)
Dim SmokeEntity As Entity = BallThrow.SpawnEntity(Nothing, SmokeTexture, SmokeScale, 1.0F, 3)
BallThrow.AnimationMove(SmokeEntity, True, SmokeDestination.X, SmokeDestination.Y, SmokeDestination.Z, SmokeSpeed, False, False, 3.0F, 0.0F) BallThrow.AnimationMove(SmokeEntity, True, SmokeDestination.X, SmokeDestination.Y, SmokeDestination.Z, SmokeSpeed, False, False, 3.0F, 0.0F)
Threading.Interlocked.Increment(SmokeSpawned) Threading.Interlocked.Increment(SmokeSpawned)
@ -6923,12 +6921,12 @@
End If End If
' Pokemon appears ' Pokemon appears
BallThrow.AnimationFade(Nothing, False, 1, True, 1, 4, 0) BallThrow.AnimationFade(Nothing, False, 1, True, 1, 3, 0)
BallThrow.AnimationPlaySound(CStr(BattleScreen.OwnPokemon.Number), 4, 0,, True) BallThrow.AnimationPlaySound(CStr(BattleScreen.OwnPokemon.Number), 4, 0,, True)
If Core.Player.ShowBattleAnimations <> 0 Then If Core.Player.ShowBattleAnimations <> 0 Then
' Pokémon falls down ' Pokémon falls down
BallThrow.AnimationMove(Nothing, False, 0, 0, 0, 0.05F, False, False, 4, 0,,, 3) BallThrow.AnimationMove(Nothing, False, 0, 0, 0, 0.05F, False, False, 5, 0,,, 3)
End If End If
BattleScreen.AddToQuery(InsertIndex, BallThrow) BattleScreen.AddToQuery(InsertIndex, BallThrow)
@ -7219,9 +7217,10 @@
Dim SmokeTexture As Texture2D = TextureManager.GetTexture("Textures\Battle\Smoke") Dim SmokeTexture As Texture2D = TextureManager.GetTexture("Textures\Battle\Smoke")
Dim SmokeScale = New Vector3(CSng(Random.Next(2, 6) / 10)) Dim SmokeScale = New Vector3(CSng(Random.Next(2, 6) / 10))
Dim SmokeSpeed = CSng(Random.Next(1, 3) / 10.0F) Dim SmokeSpeed = CSng(Random.Next(1, 3) / 20.0F)
Dim SmokeEntity = BallReturn.SpawnEntity(SmokePosition, SmokeTexture, SmokeScale, 1) Dim SmokeEntity = BallReturn.SpawnEntity(SmokePosition, SmokeTexture, SmokeScale, 1)
BallReturn.AnimationMove(SmokeEntity, True, SmokeDestination.X, SmokeDestination.Y, SmokeDestination.Z, SmokeSpeed, False, False, 0.0F, 0.0F) BallReturn.AnimationMove(SmokeEntity, True, SmokeDestination.X, SmokeDestination.Y, SmokeDestination.Z, SmokeSpeed, False, False, 0.0F, 0.0F)
Threading.Interlocked.Increment(SmokeReturned) Threading.Interlocked.Increment(SmokeReturned)
Loop While SmokeReturned <= 38 Loop While SmokeReturned <= 38
@ -7285,7 +7284,7 @@
Dim SmokeTexture As Texture2D = TextureManager.GetTexture("Textures\Battle\Smoke") Dim SmokeTexture As Texture2D = TextureManager.GetTexture("Textures\Battle\Smoke")
Dim SmokeScale = New Vector3(CSng(Random.Next(2, 6) / 10)) Dim SmokeScale = New Vector3(CSng(Random.Next(2, 6) / 10))
Dim SmokeSpeed = CSng(Random.Next(1, 3) / 10.0F) Dim SmokeSpeed = CSng(Random.Next(1, 3) / 20.0F)
Dim SmokeEntity = BallReturn.SpawnEntity(SmokePosition, SmokeTexture, SmokeScale, 1) Dim SmokeEntity = BallReturn.SpawnEntity(SmokePosition, SmokeTexture, SmokeScale, 1)
BallReturn.AnimationMove(SmokeEntity, True, SmokeDestination.X, SmokeDestination.Y, SmokeDestination.Z, SmokeSpeed, False, False, 0.0F, 0.0F) BallReturn.AnimationMove(SmokeEntity, True, SmokeDestination.X, SmokeDestination.Y, SmokeDestination.Z, SmokeSpeed, False, False, 0.0F, 0.0F)
Threading.Interlocked.Increment(SmokeReturned) Threading.Interlocked.Increment(SmokeReturned)
@ -7333,7 +7332,7 @@
BallThrow.AnimationPlaySound("Battle\Pokeball\Throw", 0, 0) BallThrow.AnimationPlaySound("Battle\Pokeball\Throw", 0, 0)
Dim BallThrowEntity = BallThrow.SpawnEntity(New Vector3(-2, -0.15, 0), BattleScreen.OwnPokemon.CatchBall.Texture, New Vector3(0.3F), 1.0F) Dim BallThrowEntity = BallThrow.SpawnEntity(New Vector3(-2, -0.15, 0), BattleScreen.OwnPokemon.CatchBall.Texture, New Vector3(0.3F), 1.0F)
BallThrow.AnimationMove(BallThrowEntity, True, 0, 0.35, 0, 0.1, False, True, 0F, 0F,, 0.3) BallThrow.AnimationMove(BallThrowEntity, True, 0, 0.35, 0, 0.1, False, True, 0F, 0.5F,, 0.3,, 0.025F)
' Ball opens ' Ball opens
BallThrow.AnimationPlaySound("Battle\Pokeball\Open", 3, 0) BallThrow.AnimationPlaySound("Battle\Pokeball\Open", 3, 0)
@ -7345,19 +7344,19 @@
Dim SmokeTexture As Texture2D = TextureManager.GetTexture("Textures\Battle\Smoke") Dim SmokeTexture As Texture2D = TextureManager.GetTexture("Textures\Battle\Smoke")
Dim SmokeScale = New Vector3(CSng(Random.Next(2, 6) / 10)) Dim SmokeScale = New Vector3(CSng(Random.Next(2, 6) / 10))
Dim SmokeSpeed = CSng(Random.Next(1, 3) / 10.0F) Dim SmokeSpeed = CSng(Random.Next(1, 3) / 20.0F)
Dim SmokeEntity = BallThrow.SpawnEntity(SmokePosition, SmokeTexture, SmokeScale, 1) Dim SmokeEntity = BallThrow.SpawnEntity(SmokePosition, SmokeTexture, SmokeScale, 1, 3)
BallThrow.AnimationMove(SmokeEntity, True, SmokeDestination.X, SmokeDestination.Y, SmokeDestination.Z, SmokeSpeed, False, False, 3.0F, 0.0F) BallThrow.AnimationMove(SmokeEntity, True, SmokeDestination.X, SmokeDestination.Y, SmokeDestination.Z, SmokeSpeed, False, False, 3.0F, 0.0F)
Threading.Interlocked.Increment(SmokeSpawned) Threading.Interlocked.Increment(SmokeSpawned)
Loop While SmokeSpawned <= 38 Loop While SmokeSpawned <= 38
' Pokemon appears ' Pokemon appears
BallThrow.AnimationFade(Nothing, False, 1, True, 1, 4, 0) BallThrow.AnimationFade(Nothing, False, 1, True, 1, 3, 0)
BallThrow.AnimationPlaySound(CStr(BattleScreen.OppPokemon.Number), 4, 0,, True) BallThrow.AnimationPlaySound(CStr(BattleScreen.OppPokemon.Number), 4, 0,, True)
' Pokémon falls down ' Pokémon falls down
BallThrow.AnimationMove(Nothing, False, 0, 0, 0, 0.05F, False, False, 4, 0,,, 4) BallThrow.AnimationMove(Nothing, False, 0, 0, 0, 0.05F, False, False, 5, 0,,, 4)
BattleScreen.BattleQuery.Add(BallThrow) BattleScreen.BattleQuery.Add(BallThrow)
End If End If

View File

@ -79,6 +79,16 @@
Entity.Update() Entity.Update()
Entity.UpdateEntity() Entity.UpdateEntity()
Next Next
For i = 0 To Me.SpawnedEntities.Count - 1
If i <= SpawnedEntities.Count - 1 Then
Dim entity As Entity = SpawnedEntities(i)
If entity.CanBeRemoved = True Then
i -= 1
RemoveEntity(entity)
End If
End If
Next
End If End If
End Sub End Sub
@ -97,13 +107,12 @@
Else Else
NewPosition = CurrentEntity.Position NewPosition = CurrentEntity.Position
End If End If
Dim SpawnedEntity = New BattleAnimation3D(NewPosition, Texture, Scale, 0, 0, False) Dim SpawnedEntity = New BattleAnimation3D(NewPosition, Texture, Scale, startDelay, endDelay, False)
SpawnedEntity.Opacity = Opacity SpawnedEntity.Opacity = Opacity
SpawnedEntity.Visible = False
SpawnedEntities.Add(SpawnedEntity) SpawnedEntities.Add(SpawnedEntity)
Dim SpawnDelayEntity As BattleAnimation3D = New BattleAnimation3D(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay, True)
AnimationSequence.Add(SpawnDelayEntity)
Return SpawnedEntity Return SpawnedEntity
End Function End Function
Public Sub RemoveEntity(Entity As Entity) Public Sub RemoveEntity(Entity As Entity)
@ -118,17 +127,12 @@
TextureChangeEntity = Entity TextureChangeEntity = Entity
End If End If
Dim baEntityTextureChange As BAEntityTextureChange = New BAEntityTextureChange(TextureChangeEntity, Texture, startDelay, endDelay) Dim baEntityTextureChange As BAEntityTextureChange = New BAEntityTextureChange(TextureChangeEntity, RemoveEntityAfter, Texture, startDelay, endDelay)
AnimationSequence.Add(baEntityTextureChange) AnimationSequence.Add(baEntityTextureChange)
If RemoveEntityAfter = True Then
If baEntityTextureChange.CanRemove = True Then
RemoveEntity(TextureChangeEntity)
End If
End If
End Sub End Sub
Public Sub AnimationMove(ByVal Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal DestinationX As Single, ByVal DestinationY As Single, ByVal DestinationZ As Single, ByVal Speed As Single, ByVal SpinX As Boolean, ByVal SpinZ As Boolean, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal SpinXSpeed As Single = 0.1F, Optional ByVal SpinZSpeed As Single = 0.1F, Optional MovementCurve As Integer = 3) Public Sub AnimationMove(ByVal Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal DestinationX As Single, ByVal DestinationY As Single, ByVal DestinationZ As Single, ByVal Speed As Single, ByVal SpinX As Boolean, ByVal SpinZ As Boolean, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal SpinXSpeed As Single = 0.1F, Optional ByVal SpinZSpeed As Single = 0.1F, Optional MovementCurve As Integer = 3, Optional MoveYSpeed As Single = 0.0F)
Dim MoveEntity As Entity Dim MoveEntity As Entity
Dim ModelEntity As Entity = Nothing Dim ModelEntity As Entity = Nothing
Dim Destination As Vector3 Dim Destination As Vector3
@ -139,7 +143,7 @@
ModelEntity = Me.CurrentModel ModelEntity = Me.CurrentModel
End If End If
Else Else
MoveEntity = Entity MoveEntity = Entity
End If End If
If Not BattleFlipped = Nothing Then If Not BattleFlipped = Nothing Then
@ -154,77 +158,79 @@
Destination = CurrentEntity.Position + New Vector3(DestinationX, DestinationY, DestinationZ) Destination = CurrentEntity.Position + New Vector3(DestinationX, DestinationY, DestinationZ)
End If End If
Dim baEntityMove As BAEntityMove = New BAEntityMove(MoveEntity, Destination, Speed, SpinX, SpinZ, startDelay, endDelay, SpinXSpeed, SpinZSpeed, MovementCurve) Dim baEntityMove As BAEntityMove = New BAEntityMove(MoveEntity, RemoveEntityAfter, Destination, Speed, SpinX, SpinZ, startDelay, endDelay, SpinXSpeed, SpinZSpeed, MovementCurve, MoveYSpeed)
AnimationSequence.Add(baEntityMove) AnimationSequence.Add(baEntityMove)
If ModelEntity IsNot Nothing Then If ModelEntity IsNot Nothing Then
Dim baModelMove As BAEntityMove = New BAEntityMove(CType(CurrentModel, Entity), Destination, Speed, SpinX, SpinZ, startDelay, endDelay, SpinXSpeed, SpinZSpeed, MovementCurve) Dim baModelMove As BAEntityMove = New BAEntityMove(CType(CurrentModel, Entity), False, Destination, Speed, SpinX, SpinZ, startDelay, endDelay, SpinXSpeed, SpinZSpeed, MovementCurve, MoveYSpeed)
AnimationSequence.Add(baModelMove) AnimationSequence.Add(baModelMove)
End If End If
If RemoveEntityAfter = True Then
If baEntityMove.CanRemove = True Then
RemoveEntity(MoveEntity)
End If
End If
End Sub End Sub
Public Sub AnimationFade(ByVal Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal TransitionSpeed As Single, ByVal FadeIn As Boolean, ByVal EndState As Single, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal startState As Single = -1.0F) Public Sub AnimationFade(ByVal Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal TransitionSpeed As Single, ByVal FadeIn As Boolean, ByVal EndState As Single, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal startState As Single = -1.0F)
Dim FadeEntity As Entity Dim FadeEntity As Entity
Dim FadeModel As Entity = Nothing
If Entity Is Nothing Then If Entity Is Nothing Then
FadeEntity = CurrentEntity FadeEntity = CurrentEntity
If Me.CurrentModel IsNot Nothing Then
FadeModel = Me.CurrentModel
End If
Else Else
FadeEntity = Entity FadeEntity = Entity
End If End If
If startState = -1.0F Then startState = FadeEntity.Opacity If startState = -1.0F Then startState = FadeEntity.Opacity
Dim baEntityOpacity As BAEntityOpacity = New BAEntityOpacity(FadeEntity, TransitionSpeed, FadeIn, EndState, startDelay, endDelay, startState) Dim baEntityOpacity As BAEntityOpacity = New BAEntityOpacity(FadeEntity, RemoveEntityAfter, TransitionSpeed, FadeIn, EndState, startDelay, endDelay, startState)
AnimationSequence.Add(baEntityOpacity) AnimationSequence.Add(baEntityOpacity)
If Me.CurrentModel IsNot Nothing Then If FadeModel IsNot Nothing Then
Dim baModelOpacity As BAEntityOpacity = New BAEntityOpacity(CType(CurrentModel, Entity), TransitionSpeed, FadeIn, EndState, startDelay, endDelay, startState) Dim baModelOpacity As BAEntityOpacity = New BAEntityOpacity(CType(FadeModel, Entity), False, TransitionSpeed, FadeIn, EndState, startDelay, endDelay, startState)
AnimationSequence.Add(baModelOpacity) AnimationSequence.Add(baModelOpacity)
End If End If
If RemoveEntityAfter = True Then
If baEntityOpacity.CanRemove = True Then
RemoveEntity(FadeEntity)
End If
End If
End Sub End Sub
Public Sub AnimationRotate(Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal RotationSpeedX As Single, ByVal RotationSpeedY As Single, ByVal RotationSpeedZ As Single, ByVal EndRotationX As Single, ByVal EndRotationY As Single, ByVal EndRotationZ As Single, ByVal startDelay As Single, ByVal endDelay As Single, ByVal DoXRotation As Boolean, ByVal DoYRotation As Boolean, ByVal DoZRotation As Boolean, ByVal DoReturn As Boolean) Public Sub AnimationRotate(Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal RotationSpeedX As Single, ByVal RotationSpeedY As Single, ByVal RotationSpeedZ As Single, ByVal EndRotationX As Single, ByVal EndRotationY As Single, ByVal EndRotationZ As Single, ByVal startDelay As Single, ByVal endDelay As Single, ByVal DoXRotation As Boolean, ByVal DoYRotation As Boolean, ByVal DoZRotation As Boolean, ByVal DoReturn As Boolean)
Dim RotateEntity As Entity Dim RotateEntity As Entity
Dim RotateModel As Entity = Nothing
If Entity Is Nothing Then If Entity Is Nothing Then
RotateEntity = CurrentEntity RotateEntity = CurrentEntity
If Me.CurrentModel IsNot Nothing Then
RotateModel = Me.CurrentModel
End If
Else Else
RotateEntity = Entity RotateEntity = Entity
End If End If
Dim RotationSpeedVector As Vector3 = New Vector3(RotationSpeedX, RotationSpeedY, RotationSpeedZ) Dim RotationSpeedVector As Vector3 = New Vector3(RotationSpeedX, RotationSpeedY, RotationSpeedZ)
Dim EndRotation As Vector3 = New Vector3(EndRotationX, EndRotationY, EndRotationZ) Dim EndRotation As Vector3 = New Vector3(EndRotationX, EndRotationY, EndRotationZ)
Dim baEntityRotate As BAEntityRotate = New BAEntityRotate(RotateEntity, RotationSpeedVector, EndRotation, startDelay, endDelay, DoXRotation, DoYRotation, DoZRotation, DoReturn) Dim baEntityRotate As BAEntityRotate = New BAEntityRotate(RotateEntity, RemoveEntityAfter, RotationSpeedVector, EndRotation, startDelay, endDelay, DoXRotation, DoYRotation, DoZRotation, DoReturn)
AnimationSequence.Add(baEntityRotate) AnimationSequence.Add(baEntityRotate)
If RemoveEntityAfter = True Then
If baEntityRotate.CanRemove = True Then If RotateModel IsNot Nothing Then
RemoveEntity(RotateEntity) Dim baModelOpacity As BAEntityRotate = New BAEntityRotate(CType(RotateModel, Entity), False, RotationSpeedVector, EndRotation, startDelay, endDelay, DoXRotation, DoYRotation, DoZRotation, DoReturn)
End If AnimationSequence.Add(baModelOpacity)
End If End If
End Sub End Sub
Public Sub AnimationScale(ByVal Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal Grow As Boolean, ByVal EndSizeX As Single, ByVal EndSizeY As Single, ByVal EndSizeZ As Single, ByVal SizeSpeed As Single, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal Anchors As String = "1") Public Sub AnimationScale(ByVal Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal Grow As Boolean, ByVal EndSizeX As Single, ByVal EndSizeY As Single, ByVal EndSizeZ As Single, ByVal SizeSpeed As Single, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal Anchors As String = "1")
Dim ScaleEntity As Entity Dim ScaleEntity As Entity
Dim ScaleModel As Entity = Nothing
If Entity Is Nothing Then If Entity Is Nothing Then
ScaleEntity = CurrentEntity ScaleEntity = CurrentEntity
If Me.CurrentModel IsNot Nothing Then
ScaleModel = Me.CurrentModel
End If
Else Else
ScaleEntity = Entity ScaleEntity = Entity
End If End If
Dim Scale As Vector3 = ScaleEntity.Scale Dim Scale As Vector3 = ScaleEntity.Scale
Dim EndSize As Vector3 = New Vector3(EndSizeX, EndSizeY, EndSizeZ) Dim EndSize As Vector3 = New Vector3(EndSizeX, EndSizeY, EndSizeZ)
Dim baBillSize As BAEntityScale = New BAEntityScale(ScaleEntity, Scale, Grow, EndSize, SizeSpeed, startDelay, endDelay, Anchors) Dim baEntityScale As BAEntityScale = New BAEntityScale(ScaleEntity, RemoveEntityAfter, Scale, Grow, EndSize, SizeSpeed, startDelay, endDelay, Anchors)
AnimationSequence.Add(baBillSize) AnimationSequence.Add(baEntityScale)
If RemoveEntityAfter = True Then
If baBillSize.CanRemove = True Then If ScaleModel IsNot Nothing Then
RemoveEntity(ScaleEntity) Dim baModelScale As BAEntityScale = New BAEntityScale(CType(ScaleModel, Entity), False, Scale, Grow, EndSize, SizeSpeed, startDelay, endDelay, Anchors)
End If
End If End If
End Sub End Sub

View File

@ -82,10 +82,10 @@
Dim MoveAnimation = New AnimationQueryObject(CurrentEntity, BattleFlip) Dim MoveAnimation = New AnimationQueryObject(CurrentEntity, BattleFlip)
Dim FireballEntity = MoveAnimation.SpawnEntity(New Vector3(-2.0, 0.0, 0.0), TextureManager.GetTexture("Textures\Battle\Fire\FireBall"), New Vector3(0.5F), 1.0F) Dim FireballEntity = MoveAnimation.SpawnEntity(New Vector3(-2.0, 0.0, 0.0), TextureManager.GetTexture("Textures\Battle\Fire\FireBall"), New Vector3(0.5F), 1.0F)
MoveAnimation.AnimationMove(FireballEntity, True, 2.0, 0.0, 0.0, 0.05, False, True, 0.0, 0.0,, -0.5, 0) MoveAnimation.AnimationMove(FireballEntity, True, 0.0, 0.0, 0.0, 0.05, False, True, 0.0, 0.0,, -0.5, 0)
For i = 0 To 12 For i = 0 To 12
Dim SmokeEntity = MoveAnimation.SpawnEntity(New Vector3(CSng(-2.0 + i * 0.2), 0.0, 0.0), TextureManager.GetTexture("Textures\Battle\Fire\Smoke"), New Vector3(0.2), 1, CSng(i * 0.2)) Dim SmokeEntity = MoveAnimation.SpawnEntity(New Vector3(CSng(-3.0 + i * 0.2), 0.0, 0.0), TextureManager.GetTexture("Textures\Battle\Fire\Smoke"), New Vector3(0.2), 1, CSng(i * 0.2))
MoveAnimation.AnimationFade(SmokeEntity, True, 0.02, False, 0.0, CSng(i * 0.2), 0.0) MoveAnimation.AnimationFade(SmokeEntity, True, 0.02, False, 0.0, CSng(i * 0.2), 0.0)
i += 1 i += 1

View File

@ -80,7 +80,7 @@
Dim StingerEntity As Entity = MoveAnimation.SpawnEntity(New Vector3(-2.0, 0, 0.0), TextureManager.GetTexture("Textures\Battle\Poison\Stinger"), New Vector3(0.5F), 1) Dim StingerEntity As Entity = MoveAnimation.SpawnEntity(New Vector3(-2.0, 0, 0.0), TextureManager.GetTexture("Textures\Battle\Poison\Stinger"), New Vector3(0.5F), 1)
MoveAnimation.AnimationMove(StingerEntity, True, 2.0, 0.0, 0.0, 0.05, False, False, 0.0, 0.0,,, 0) MoveAnimation.AnimationMove(StingerEntity, True, 0.0, 0.0, 0.0, 0.05, False, False, 0.0, 0.0,,, 0)
MoveAnimation.AnimationPlaySound("Battle\Attacks\Poison\PoisonSting_Hit", 1, 0) MoveAnimation.AnimationPlaySound("Battle\Attacks\Poison\PoisonSting_Hit", 1, 0)