replace Referencer global with individual static instances
This commit is contained in:
@@ -16,7 +16,7 @@ func _ready() -> void:
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if not Referencer.players or not Referencer.main_camera:
|
||||
if not Player.instances or not MainCamera.instance:
|
||||
var mouse_pos := get_viewport().get_mouse_position()
|
||||
_single_cursor.position = mouse_pos - _single_cursor.size / 2
|
||||
_single_cursor.visible = true
|
||||
@@ -29,7 +29,7 @@ func _physics_process(delta: float) -> void:
|
||||
|
||||
|
||||
func _handle_cursors(delta: float) -> void:
|
||||
for player_index in range(Referencer.players_count):
|
||||
for player_index in range(Player.instances.size()):
|
||||
_handle_cursor(player_index, delta)
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ func _init_player_cursor(id: int) -> void:
|
||||
|
||||
|
||||
func _handle_cursor(player_index: int, delta: float) -> void:
|
||||
var player := Referencer.players[player_index]
|
||||
var player := Player.instances[player_index]
|
||||
var id := player.get_instance_id()
|
||||
|
||||
if not _cursors.has(id):
|
||||
@@ -52,7 +52,7 @@ func _handle_cursor(player_index: int, delta: float) -> void:
|
||||
return
|
||||
|
||||
var cursor_pos_world := player.attack.global_position + player.aiming.aim_offset
|
||||
var cursor_pos_screen := Referencer.main_camera.unproject_position(cursor_pos_world)
|
||||
var cursor_pos_screen := MainCamera.instance.unproject_position(cursor_pos_world)
|
||||
|
||||
var clamp_corner_min := Vector2.ZERO
|
||||
var clamp_corner_max := get_viewport().get_visible_rect().size
|
||||
@@ -74,13 +74,13 @@ func _handle_cursor(player_index: int, delta: float) -> void:
|
||||
)
|
||||
|
||||
var aim_offset_normalized := player.aiming.aim_offset.normalized()
|
||||
var bat_rotation_point_screen := Referencer.main_camera.unproject_position(
|
||||
var bat_rotation_point_screen := MainCamera.instance.unproject_position(
|
||||
(
|
||||
cursor_pos_world
|
||||
+ aim_offset_normalized.rotated(Vector3.UP, cursor.side as float)
|
||||
)
|
||||
)
|
||||
var arrow_rotation_point_screen := Referencer.main_camera.unproject_position(
|
||||
var arrow_rotation_point_screen := MainCamera.instance.unproject_position(
|
||||
cursor_pos_world + aim_offset_normalized
|
||||
)
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
extends Node
|
||||
|
||||
var main_camera: MainCamera
|
||||
var players: Array[Player]
|
||||
var players_count: int = 0
|
||||
@@ -1 +0,0 @@
|
||||
uid://xe3jh3bo5skb
|
||||
Reference in New Issue
Block a user