.
This commit is contained in:
parent
9b7bace36d
commit
4e50fedb50
@ -11,5 +11,7 @@ func _unhandled_input(event: InputEvent) -> void:
|
|||||||
if event.is_pressed():
|
if event.is_pressed():
|
||||||
if event.button_index == MOUSE_BUTTON_WHEEL_UP:
|
if event.button_index == MOUSE_BUTTON_WHEEL_UP:
|
||||||
self.fov -= 1 * (5 if Input.is_key_pressed(KEY_SHIFT) else 1)
|
self.fov -= 1 * (5 if Input.is_key_pressed(KEY_SHIFT) else 1)
|
||||||
|
self.size -= 1 * (0.2 if Input.is_key_pressed(KEY_SHIFT) else 0.05)
|
||||||
if event.button_index == MOUSE_BUTTON_WHEEL_DOWN:
|
if event.button_index == MOUSE_BUTTON_WHEEL_DOWN:
|
||||||
self.fov += 1 * (5 if Input.is_key_pressed(KEY_SHIFT) else 1)
|
self.fov += 1 * (5 if Input.is_key_pressed(KEY_SHIFT) else 1)
|
||||||
|
self.size += 1 * (0.2 if Input.is_key_pressed(KEY_SHIFT) else 0.05)
|
||||||
|
|||||||
@ -3,12 +3,11 @@ extends Node
|
|||||||
var CURRENT_LEVEL: Node3D = null
|
var CURRENT_LEVEL: Node3D = null
|
||||||
var CURRENT_PLAYER: CharacterBody3D = null
|
var CURRENT_PLAYER: CharacterBody3D = null
|
||||||
var combined_signal : Observable
|
var combined_signal : Observable
|
||||||
var prop = ReactiveProperty.new(42)
|
|
||||||
|
|
||||||
signal TestSignal
|
signal TestSignal
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
var lvl: Resource = load("res://assets/levels/level1.tscn")
|
var lvl: Resource = load("res://assets/levels/maps/debug1.tscn")
|
||||||
var player: Resource = load("res://assets/characters/player.tscn")
|
var player: Resource = load("res://assets/characters/player.tscn")
|
||||||
CURRENT_LEVEL = lvl.instantiate()
|
CURRENT_LEVEL = lvl.instantiate()
|
||||||
CURRENT_PLAYER = player.instantiate()
|
CURRENT_PLAYER = player.instantiate()
|
||||||
@ -16,16 +15,14 @@ func _ready() -> void:
|
|||||||
add_child(CURRENT_LEVEL)
|
add_child(CURRENT_LEVEL)
|
||||||
CURRENT_LEVEL.add_child(CURRENT_PLAYER)
|
CURRENT_LEVEL.add_child(CURRENT_PLAYER)
|
||||||
combined_signal = GDRx.from_signal(Messagebus.CHANGE_SCENE)\
|
combined_signal = GDRx.from_signal(Messagebus.CHANGE_SCENE)\
|
||||||
.first()\
|
.debounce(0.2)
|
||||||
.debounce(1)
|
|
||||||
combined_signal.subscribe(transition_to).dispose_with(self)
|
combined_signal.subscribe(transition_to).dispose_with(self)
|
||||||
#prop.subscribe(func(i): print(">> ", i))
|
|
||||||
|
|
||||||
func transition_to(scene: PackedScene):
|
func transition_to(scene: String):
|
||||||
print(">>>>>>>"+str(scene))
|
print(">>>>>>>"+str(scene))
|
||||||
CURRENT_LEVEL.remove_child(CURRENT_PLAYER)
|
CURRENT_LEVEL.remove_child(CURRENT_PLAYER)
|
||||||
remove_child(CURRENT_LEVEL)
|
remove_child(CURRENT_LEVEL)
|
||||||
var lvl = load(scene.resource_path)
|
var lvl = load("res://assets/levels/maps/"+scene+".tscn")
|
||||||
var new_level = lvl.instantiate()
|
var new_level = lvl.instantiate()
|
||||||
new_level.add_child(CURRENT_PLAYER)
|
new_level.add_child(CURRENT_PLAYER)
|
||||||
CURRENT_PLAYER.transform.origin = Vector3(0, 1, 0)
|
CURRENT_PLAYER.transform.origin = Vector3(0, 1, 0)
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
signal CHANGE_SCENE(scene)
|
signal CHANGE_SCENE(scene: String)
|
||||||
|
signal DEBUG_XYZ(origin: Vector3)
|
||||||
|
signal DEBUG_MAP(name: String)
|
||||||
|
|||||||
@ -3,7 +3,7 @@ extends MeshInstance3D
|
|||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
if material_override != null:
|
if material_override != null:
|
||||||
material_override.albedo_texture = $SubViewport.get_texture()
|
material_override.albedo_texture = $SubViewport.get_texture()
|
||||||
|
|
||||||
#func _process(delta):
|
#func _process(delta):
|
||||||
#self.look_at(camera.global_position, Vector3.UP, true)
|
#self.look_at(camera.global_position, Vector3.UP, true)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user