Changing bridge layer logic to Bridge script instead of BasicCharacter. The Bridge was moved from GameLevel to TerrainManager because its more related to terrain.
This commit is contained in:
23
Interactables/bellow_bridge_area.gd
Normal file
23
Interactables/bellow_bridge_area.gd
Normal file
@@ -0,0 +1,23 @@
|
||||
extends Area2D
|
||||
class_name BellowBridgeArea
|
||||
|
||||
var is_character_bellow_bridge: bool = false
|
||||
var character_body: Node2D = null
|
||||
|
||||
func _on_body_entered(_body: Node2D) -> void:
|
||||
self._set_character_body_bellow_bridge(_body, true)
|
||||
|
||||
func _on_body_exited(_body: Node2D) -> void:
|
||||
self._set_character_body_bellow_bridge(_body, false)
|
||||
|
||||
func _set_character_body_bellow_bridge(_body: Node2D, _state: bool) -> void:
|
||||
if _body is BaseCharacter:
|
||||
self.is_character_bellow_bridge = _state
|
||||
self.character_body = _body
|
||||
print("bellow bridge: " + str(_state))
|
||||
|
||||
func get_character_body_bellow_bridge() -> bool:
|
||||
return self.is_character_bellow_bridge
|
||||
|
||||
func get_body() -> Node2D:
|
||||
return self.character_body
|
||||
Reference in New Issue
Block a user