This repository has been archived on 2024-04-19. You can view files and clone it, but cannot push or open issues or pull requests.
Jessist/Scripts/TransitionScript.gd

38 lines
1.2 KiB
GDScript3
Raw Normal View History

2022-06-18 13:05:48 +02:00
extends ColorRect
enum transitionStates {FADEIN,FADEOUT}
func _ready():
gameController.logCall("TransitionScript","_ready",null)
$AnimationPlayer.stop()
func startTransition(transitionState):
gameController.logCall("TransitionScript","startTransition",transitionState)
if transitionState == transitionStates.FADEIN:
$AnimationPlayer.play("fadeIn")
elif transitionState == transitionStates.FADEOUT:
$AnimationPlayer.play("fadeOut")
else:
gameController.logError("TransitionScript","startTransition","Invalid transitionState provided")
func stopTransition():
gameController.logCall("TransitionScript","stopTransition",null)
$AnimationPlayer.stop()
func getPlayer():
gameController.logCall("TransitionScript","getPlayer",null)
return $AnimationPlayer
func isTransitionRunning():
gameController.logCall("TransitionScript","isTransitionRunning",null)
return $AnimationPlayer.is_playing()
func getTransitionState():
gameController.logCall("TransitionScript","getTransitionState",null)
if $AnimationPlayer.current_animation == "fadeIn":
return transitionStates.FADEIN
elif $AnimationPlayer.current_animation == "fadeOut":
return transitionStates.FADEOUT
else:
return null