forked from GDQuest/learn-gdscript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLesson.gd
36 lines (26 loc) · 844 Bytes
/
Lesson.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Base resource for a lesson. Stores the lesson's content as an array of content
# blocks and a list of practices to complete the lesson.
class_name Lesson
extends Resource
export var title := ""
# Array of content blocks to display sequentially in the lesson. The blocks in
# question can be plain text and image ContentBlock, but also other resources
# like quizzes.
export var content_blocks: Array
# Array[Practice]
export var practices: Array
func _init() -> void:
content_blocks = []
practices = []
func get_quizzes() -> Array:
var quizzes := []
for content_item in content_blocks:
if content_item is Quiz:
quizzes.append(content_item)
return quizzes
func get_quizzes_count() -> int:
var total_quizzes := 0
for content_item in content_blocks:
if content_item is Quiz:
total_quizzes += 1
return total_quizzes