added game states
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
extends Node
|
||||
|
||||
|
||||
signal bullet_selected(object)
|
||||
|
||||
enum GameState { PLAYER1_GUN_LOAD, PLAYER2_GUN_LOAD, GUN_ANIMATION}
|
||||
var current_state = GameState.PLAYER1_GUN_LOAD
|
||||
var bullets: Array
|
||||
|
||||
var player1_revolver: Node3D
|
||||
@@ -8,6 +13,7 @@ var bullet_stack: Node3D
|
||||
|
||||
func _ready() -> void:
|
||||
bullets.resize(21)
|
||||
bullet_selected.connect(on_bullet_selected)
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_released("load"):
|
||||
@@ -24,3 +30,14 @@ func set_bullet_stack(newStack):
|
||||
|
||||
func add_bullet():
|
||||
pass
|
||||
|
||||
|
||||
func on_bullet_selected(bullet_object: Node3D):
|
||||
if current_state == GameState.PLAYER1_GUN_LOAD:
|
||||
current_state = GameState.GUN_ANIMATION
|
||||
player1_revolver.load_bullet(bullet_object)
|
||||
|
||||
|
||||
func end_turn():
|
||||
if current_state == GameState.PLAYER1_GUN_LOAD:
|
||||
current_state = GameState.PLAYER2_GUN_LOAD
|
||||
|
||||
Reference in New Issue
Block a user