[Minimal] Handler and Manager script update

This commit is contained in:
Alan Alexander Cerna 2021-10-28 12:56:52 +03:00
parent 2589c313a4
commit 865accacca
5 changed files with 27 additions and 20 deletions

View File

@ -1,4 +1,5 @@
extends Node extends Node
func _ready(): func update(userStateInstance):
userStateInstance.rotateBy(-1)
pass pass

View File

@ -15,15 +15,23 @@ var physicsManagerInstance = preload("res://source/assets/scripts/controllers/ma
# Local class variables # Local class variables
var vectoralDirectionPreset var vectoralDirectionPreset
var userInput
var userState
var VDIR
func _ready(): func _ready():
vectoralDirectionPreset = vectoralDirectionPresetInstance.getState() vectoralDirectionPreset = vectoralDirectionPresetInstance.getState(userStateInstance.update())
func _process(delta): func _process(delta):
# Update data-handler returned states # Update data-handler returned states
var userInput = userInputInstance.update() userInput = userInputInstance.update()
var userState = userStateInstance.update() userState = userStateInstance.update()
# Send the returned states through processors # Send the returned states through processors
var VDIR = VDIRprocessorInstance.process(userState, vectoralDirectionPreset) VDIR = VDIRprocessorInstance.process(userState, vectoralDirectionPreset)
# Give the resulting data to game controllers # Give the resulting data to game controllers
physicsManagerInstance.update(userStateInstance)
physics_process(delta)
pass pass
func physics_process(delta):
rotation_degrees = userState["rotation"]

View File

@ -1,9 +1,9 @@
extends Node2D extends Node2D
func _ready(): func statePassback():
pass return {"node_global_position": transform.origin, "rotation": null}
func set_scale(scale): func set_scale(scale) -> void:
$player_body/player_sprite_na.scale = Vector2(scale, scale) $player_body/player_sprite_na.scale = Vector2(scale, scale)
$player_body/player_sprite.scale = Vector2(scale, scale) $player_body/player_sprite.scale = Vector2(scale, scale)
$player_body/player_collider.scale = Vector2(scale, scale) $player_body/player_collider.scale = Vector2(scale, scale)

View File

@ -2,14 +2,15 @@ extends Node
var userState = {} var userState = {}
func _init() -> void: var rotationalTracker = 0
userState = {
"state": false func rotateBy(amount):
} rotationalTracker += amount
pass if rotationalTracker == 361: rotationalTracker = 1
elif rotationalTracker == -361: rotationalTracker = -1
func update(): func update():
userState = { userState = preload("res://source/assets/scripts/handlers/character/player/player_node_handler.gd").new().statePassback()
"state": true # IF necessary process and update and correct userState
} userState["rotation"] = rotationalTracker
return userState return userState

View File

@ -2,7 +2,7 @@ extends Node
var vectoralState = {} var vectoralState = {}
func _ready() -> void: func getState(userState):
vectoralState = { vectoralState = {
"0": { # Source (Client) positional rotation vectors "0": { # Source (Client) positional rotation vectors
"0": { # Primary source positional vector "0": { # Primary source positional vector
@ -56,7 +56,4 @@ func _ready() -> void:
} }
} }
} }
pass
func getState():
return vectoralState return vectoralState