37 lines
1.2 KiB
GDScript
37 lines
1.2 KiB
GDScript
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
|