- 为铁球、陶瓷球和木球制作风格化材质,归档 CC0 原始参考 - 更新方形球洞和实心滑槽,统一 90° 弯槽并兼容旧存档 - 用顺流泡沫表示水流方向,为冰块制作三种交错的裂纹 - 同步 Blender 源资产、Godot 加载、工坊和试玩预览
20 lines
958 B
GDScript
20 lines
958 B
GDScript
extends RefCounted
|
|
|
|
static func read_lesson(index: int) -> Dictionary:
|
|
return JSON.parse_string(FileAccess.get_file_as_string("res://playtest/tutorial/data/%02d.json" % (index+1)))
|
|
|
|
static func initial_level(lesson: Dictionary, lib) -> Dictionary:
|
|
var data: Dictionary = lesson.initial.duplicate(true)
|
|
var launcher:Dictionary={}
|
|
for entity in data.entities:
|
|
if entity.id==lesson.spawn.entityId:launcher=entity;break
|
|
assert(not launcher.is_empty(),"Missing launch block")
|
|
var basis:=Basis(Vector3.UP,-int(launcher.quarter)*PI/2)
|
|
var top:float=lib.catalog[launcher.kind].boundsBlender.max[2]
|
|
var pos:Vector3=lib.vector(launcher.position)+basis*Vector3(float(lesson.spawn.get("localX",0)),top+lib.ball_radius()+.02,0)
|
|
data.balls = [{"id":"student_ball","ballTypeId":"iron_ball","position":[pos.x,pos.y,pos.z]}]
|
|
return data
|
|
|
|
static func solution(lesson: Dictionary) -> Array:
|
|
return JSON.parse_string(FileAccess.get_file_as_string(lesson.solution))
|