Added MusicType Actions
This commit is contained in:
		
							parent
							
								
									11d0ad0adb
								
							
						
					
					
						commit
						2cf1d6b0c3
					
				| 
						 | 
				
			
			@ -4,6 +4,29 @@ func _ready() -> void:
 | 
			
		|||
	print("Loaded Music singleton")
 | 
			
		||||
 | 
			
		||||
var change_slow_actions : Array = []
 | 
			
		||||
var gameSpeed : float = 1;
 | 
			
		||||
var musicType: int = 0;
 | 
			
		||||
 | 
			
		||||
func setSlowMusic():
 | 
			
		||||
	setMusicType( -1 )
 | 
			
		||||
	
 | 
			
		||||
func setFastMusic():
 | 
			
		||||
	setMusicType( 1 )
 | 
			
		||||
	
 | 
			
		||||
func setNormalMusic():
 | 
			
		||||
	setMusicType( 0 )	
 | 
			
		||||
	
 | 
			
		||||
func setMusicType( type:int ):
 | 
			
		||||
	musicType = type;
 | 
			
		||||
	
 | 
			
		||||
	gameSpeed = 0
 | 
			
		||||
	
 | 
			
		||||
	if type == 1:
 | 
			
		||||
		gameSpeed = 2
 | 
			
		||||
	
 | 
			
		||||
	if type == -1:
 | 
			
		||||
		gameSpeed = 0.5
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
func register_change_action(change_action : Node) -> void:
 | 
			
		||||
	print("Registered change action")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,4 @@
 | 
			
		|||
class_name SetFastMusic extends Action
 | 
			
		||||
 | 
			
		||||
func onTrigger():
 | 
			
		||||
	MusicSingleton.setFastMusic()
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,4 @@
 | 
			
		|||
class_name SetNormalMusic extends Action
 | 
			
		||||
 | 
			
		||||
func onTrigger():
 | 
			
		||||
	MusicSingleton.setNormalMusic()
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,4 @@
 | 
			
		|||
class_name SetSlowMusic extends Action
 | 
			
		||||
 | 
			
		||||
func onTrigger():
 | 
			
		||||
	MusicSingleton.setSlowMusic()
 | 
			
		||||
		Loading…
	
		Reference in New Issue