38 lines
902 B
GDScript
38 lines
902 B
GDScript
extends InspectableEntity
|
|
class_name Objective
|
|
|
|
const RANDOM_MAX_OBJECTIVE_INTERVAL = 1.
|
|
|
|
var completed : bool = false
|
|
var planet : Planet
|
|
@export var reward : ObjectiveReward = null :
|
|
set(r):
|
|
reward = r
|
|
update_reward_info(r)
|
|
|
|
func _ready():
|
|
update_reward_info(reward)
|
|
|
|
func pointer_text():
|
|
return "Contamination Objective"
|
|
|
|
func inspector_info() -> Inspector.Info:
|
|
return Inspector.Info.new(
|
|
pointer_text(),
|
|
"If the zone around is decontaminated, give the following reward.\n\n" + reward.get_description(),
|
|
)
|
|
|
|
func _end_pass_day():
|
|
if planet and not completed:
|
|
if not planet.is_there_contamination(global_position):
|
|
reward.reward(self)
|
|
%AnimationPlayer.play("activate")
|
|
%RewardInfo.visible = false
|
|
completed = true
|
|
|
|
func update_reward_info(r : ObjectiveReward):
|
|
if r:
|
|
%RewardText.text = r.get_text()
|
|
%RewardIcon.texture = r.get_icon()
|
|
%RewardInfo.visible = r != null
|