diff --git a/api/src/main/kotlin/com.willfp.modelenginebridge/BridgedAnimationHandler.kt b/api/src/main/kotlin/com.willfp.modelenginebridge/BridgedAnimationHandler.kt index 895c5ae..006272a 100644 --- a/api/src/main/kotlin/com.willfp.modelenginebridge/BridgedAnimationHandler.kt +++ b/api/src/main/kotlin/com.willfp.modelenginebridge/BridgedAnimationHandler.kt @@ -3,7 +3,17 @@ package com.willfp.modelenginebridge interface BridgedAnimationHandler { val model: BridgedActiveModel - fun getAnimation(name: String): BridgedAnimation? + fun playAnimation(animation: String, lerpIn: Double, lerpOut: Double, speed: Double, force: Boolean): Boolean - fun playAnimation(animation: BridgedAnimation, force: Boolean) + fun playAnimation(animation: BridgedAnimation, force: Boolean): Boolean + + fun isPlayingAnimation(animation: String): Boolean + + fun stopAnimation(animation: String) + + fun forceStopAnimation(animation: String) + + fun forceStopAllAnimations() + + fun getAnimation(animation: String): BridgedAnimation? } diff --git a/v3/src/main/kotlin/com/willfp/modelenginebridge/v3/impl/AnimationHandlerImpl.kt b/v3/src/main/kotlin/com/willfp/modelenginebridge/v3/impl/AnimationHandlerImpl.kt index 0af543e..cc56d0c 100644 --- a/v3/src/main/kotlin/com/willfp/modelenginebridge/v3/impl/AnimationHandlerImpl.kt +++ b/v3/src/main/kotlin/com/willfp/modelenginebridge/v3/impl/AnimationHandlerImpl.kt @@ -9,14 +9,40 @@ class AnimationHandlerImpl( val handle: AnimationHandler, override val model: BridgedActiveModel ): BridgedAnimationHandler { - override fun getAnimation(name: String): BridgedAnimation? { - val animation = handle.getAnimation(name) ?: return null - return AnimationImpl(animation) + override fun playAnimation( + animation: String, + lerpIn: Double, + lerpOut: Double, + speed: Double, + force: Boolean + ): Boolean { + return handle.playAnimation(animation, lerpIn, lerpOut, speed, force) } - override fun playAnimation(animation: BridgedAnimation, force: Boolean) { + override fun playAnimation(animation: BridgedAnimation, force: Boolean): Boolean { animation as AnimationImpl - handle.playAnimation(animation.handle, force) + return handle.playAnimation(animation.handle, force) + } + + override fun isPlayingAnimation(animation: String): Boolean { + return handle.isPlayingAnimation(animation) + } + + override fun stopAnimation(animation: String) { + handle.stopAnimation(animation) + } + + override fun forceStopAnimation(animation: String) { + handle.forceStopAnimation(animation) + } + + override fun forceStopAllAnimations() { + handle.forceStopAllAnimations() + } + + override fun getAnimation(name: String): BridgedAnimation? { + val animation = handle.getAnimation(name) ?: return null + return AnimationImpl(animation) } } diff --git a/v4/src/main/kotlin/com/willfp/modelenginebridge/v4/impl/AnimationHandlerImpl.kt b/v4/src/main/kotlin/com/willfp/modelenginebridge/v4/impl/AnimationHandlerImpl.kt index 7df3a81..37b558b 100644 --- a/v4/src/main/kotlin/com/willfp/modelenginebridge/v4/impl/AnimationHandlerImpl.kt +++ b/v4/src/main/kotlin/com/willfp/modelenginebridge/v4/impl/AnimationHandlerImpl.kt @@ -9,14 +9,39 @@ class AnimationHandlerImpl( val handle: AnimationHandler, override val model: BridgedActiveModel ): BridgedAnimationHandler { - override fun getAnimation(name: String): BridgedAnimation? { - val animation = handle.getAnimation(name) ?: return null - return AnimationImpl(animation) + override fun playAnimation( + animation: String, + lerpIn: Double, + lerpOut: Double, + speed: Double, + force: Boolean + ): Boolean { + return handle.playAnimation(animation, lerpIn, lerpOut, speed, force) != null } - override fun playAnimation(animation: BridgedAnimation, force: Boolean) { + override fun playAnimation(animation: BridgedAnimation, force: Boolean): Boolean { animation as AnimationImpl - - handle.playAnimation(animation.handle, force) + + return handle.playAnimation(animation.handle, force) + } + + override fun isPlayingAnimation(animation: String): Boolean { + return handle.isPlayingAnimation(animation) + } + + override fun stopAnimation(animation: String) { + return handle.stopAnimation(animation) + } + + override fun forceStopAnimation(animation: String) { + handle.forceStopAnimation(animation) + } + override fun forceStopAllAnimations() { + handle.forceStopAllAnimations() + } + + override fun getAnimation(name: String): BridgedAnimation? { + val animation = handle.getAnimation(name) ?: return null + return AnimationImpl(animation) } }