* changements des objectifs, donnent juste des graines, sprite moins gros et objectifs plus nombreux * changement de la probabilité de mutation * refactor du code terrain et planet
42 lines
1023 B
GDScript
42 lines
1023 B
GDScript
extends Area2D
|
|
class_name InspectableEntity
|
|
|
|
const MODULATE_INSPECTED_COLOR = Color.GRAY
|
|
|
|
var terrain : Terrain
|
|
var planet : Planet :
|
|
get(): return terrain if terrain is Planet else null
|
|
|
|
@export var default_info_title = ""
|
|
@export var default_info_desc = ""
|
|
|
|
@onready var default_modulate : Color = modulate
|
|
@onready var inspectable_signals_setuped : bool = setup_inspectable_signals()
|
|
|
|
func inspect(is_inspected : bool = true):
|
|
modulate = MODULATE_INSPECTED_COLOR if is_inspected else default_modulate
|
|
|
|
func setup_inspectable_signals() -> bool:
|
|
mouse_entered.connect(_on_mouse_entered)
|
|
mouse_exited.connect(_on_mouse_excited)
|
|
return true
|
|
|
|
func _on_mouse_entered():
|
|
Pointer.inspect(self, inspector_info())
|
|
|
|
func _on_mouse_excited():
|
|
Pointer.stop_inspect(self)
|
|
|
|
func pointer_text():
|
|
return default_info_title
|
|
|
|
func inspector_info() -> Inspector.Info:
|
|
return Inspector.Info.new(
|
|
pointer_text(),
|
|
default_info_desc
|
|
)
|
|
|
|
func _notification(what):
|
|
if (what == NOTIFICATION_PREDELETE):
|
|
Pointer.stop_inspect(self)
|