Skip to content

Instantly share code, notes, and snippets.

@kingthrillgore
Last active March 7, 2023 22:15
Show Gist options
  • Save kingthrillgore/107d6c30a0053ce5b7e99438eda95da0 to your computer and use it in GitHub Desktop.
Save kingthrillgore/107d6c30a0053ce5b7e99438eda95da0 to your computer and use it in GitHub Desktop.
Parent Task class
extends Node
# Enums
enum state { PENDING, UNLOCKED, IN_PROGRESS, COMPLETED, DONE, CANCELED }
# Fields
export var uid : String
export var task_title : String
export var task_description : String
var task_status : int
var is_completed : bool
# System Methods
# Called when the node enters the scene tree for the first time.
func _ready():
pass
# Called every frame. 'delta' is the elapsed time since the previous frame.
# func _process(delta):
# pass
# Custom Methods
func checkStartingCriteria() -> void:
pass
func startTask() -> void:
if task_status !== state.COMPLETED or task_status !== state.DONE:
task_status = state.IN_PROGRESS
func checkIfCompleted() -> bool:
if is_completed:
task_status = state.COMPLETED
return is_completed
func whenCompleted() -> void:
task_status = state.DONE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment