WIP discovery 3D screen
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
extends Interactable3D
|
||||
class_name MutationElement
|
||||
|
||||
@export var mutation: PlantMutation: set = set_mutation
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if mutation:
|
||||
var viewport := get_viewport() as SubViewport
|
||||
var viewport_parent = viewport.get_parent()
|
||||
var new_pos := global_position
|
||||
var viewport_size := viewport.size
|
||||
new_pos = viewport_parent.global_position
|
||||
|
||||
var position_2D = get_parent().global_position
|
||||
new_pos.z += position_2D.x / viewport_size.x
|
||||
new_pos.y -= position_2D.y / viewport_size.y
|
||||
global_position = new_pos
|
||||
|
||||
func set_mutation(m: PlantMutation) -> void:
|
||||
mutation = m
|
||||
interactable = false
|
||||
inspectable = true
|
||||
|
||||
func card_info() -> CardInfo:
|
||||
if mutation:
|
||||
return mutation.card_info()
|
||||
return null
|
||||
@@ -0,0 +1 @@
|
||||
uid://cf0b6gm06fvy1
|
||||
Reference in New Issue
Block a user