scene
Boo引擎的场景系统,负责管理游戏中的所有节点和组件,提供层次化的结构来组织游戏对象,支持2D和3D场景的管理。
от carlosyzy★ 38 звёзд на GitHub
Установить scene в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Scene 系统
Scene 系统是 Boo 引擎的核心功能之一,负责管理游戏中的所有节点和组件,提供了一个层次化的结构来组织游戏对象。场景系统支持 2D 和 3D 场景的管理,为游戏开发提供了灵活的场景组织方式。
核心功能
场景管理
- 场景创建:创建新的场景实例
- 根节点管理:管理 2D 和 3D 根节点
- 场景生命周期:处理场景的启动、更新和销毁
- 场景切换:通过
game->openScene()切换场景
节点系统
- 节点层次结构:支持节点的父子关系,形成树状结构
- 变换系统:支持位置、旋转、缩放等变换操作
- 激活状态管理:控制节点的激活状态和层级激活状态
- 组件管理:为节点添加和管理组件
2D 节点特性
- 锚点系统:支持 2D 节点的锚点设置
- 大小设置:设置 2D 节点的大小
- UI 渲染:集成 UI 渲染功能
3D 节点特性
- 3D 变换:支持 3D 空间中的变换操作
- 3D 场景管理:管理 3D 场景中的对象
主要接口
场景类 (Scene)
// 构造函数
Scene(const std::string name, const std::string uuid = "");
// 根节点获取(引擎自动创建,无需手动调用 createRoot2D/3D)
Node3D *getRoot3D();
Node2D *getRoot2D();
// 生命周期方法
void update(float deltaTime) override;
void lateUpdate(float deltaTime) override;
void clearNodeFrameFlag() override;
void destroy() override;
// 变换方法(重写自 Node)
void setPosition(float x, float y, float z) override;
void setWorldPosition(float x, float y, float z) override;
void setScale(float x, float y, float z) override;
void setWorldScale(float x, float y, float z) override;
void setEulerAngles(float x, float y, float z) override;
void setRotation(float x, float y, float z, float w) override;
void setWorldRotation(float x, float y, float z, float w) override;
void setActive(bool active) override;
// 组件管理
Component *addComponent(std::string name, std::string uuid = "") override;
节点基类 (Node)
// 构造函数
Node(const std::string name, const std::string uuid = "");
// 基本属性
const ENodeLayer getLayer() const;
const std::string& getUuid() const;
void setUuid(const std::string &uuid);
void setName(const std::string &name);
const std::string& getName() const;
int getGroupId() const;
void setGroupId(int groupID);
// 变换操作
virtual void setPosition(float x, float y, float z);
const Vec3 &getPosition();
virtual void setWorldPosition(float x, float y, float z);
const Vec3 &getWorldPosition();
virtual void setRotation(float x, float y, float z, float w);
const Quat &getRotation();
virtual void setWorldRotation(float x, float y, float z, float w);
const Quat &getWorldRotation();
virtual void setScale(float x, float y, float z);
const Vec3 &getScale();
virtual void setWorldScale(float x, float y, float z);
const Vec3 &getWorldScale();
virtual void setEulerAngles(float x, float y, float z);
const Vec3 &getEulerAngles();
const Mat4 &getLocalMatrix();
const Mat4 &getWorldMatrix();
// 变换状态
const bool hasFrameTransformFlag() const;
void setMatrix(const std::array<float, 16>& matrix);
virtual void clearNodeFrameFlag();
// 节点层次结构
void addChild(Node *node);
void removeChild(Node *node);
void removeFromParent();
const std::vector<Node *> &getChildren();
Node *getChildByName(std::string name);
void setParent(Node *parent);
Node *getParent();
void destroyAllChildren();
// 激活状态
virtual void setActive(bool active);
bool getActive() const;
const bool getActiveInHierarchy() const;
// 组件管理
virtual Component *addComponent(std::string name, std::string uuid = "");
Component *getComponent(std::string name);
std::vector<Component *> getComponents();
// 生命周期方法
virtual void update(float deltaTime);
virtual void lateUpdate(float deltaTime);
virtual void destroy();
2D 节点类 (Node2D)
// 构造函数
Node2D(const std::string name, const std::string uuid = "");
// 2D 特有属性
void setAnchor(float x, float y);
void setSize(float width, float height);
const Vec2 &getAnchor();
const Size &getSize();
const Mat4 &getUIWorldMatrix();
// 变换方法(重写自 Node)
void setPosition(float x, float y, float z) override;
void setWorldPosition(float x, float y, float z) override;
void setScale(float x, float y, float z) override;
void setWorldScale(float x, float y, float z) override;
void setEulerAngles(float x, float y, float z) override;
void setRotation(float x, float y, float z, float w) override;
void setWorldRotation(float x, float y, float z, float w) override;
// 激活状态
void setActive(bool active) override;
// 组件管理
Component *addComponent(std::string name, std::string uuid = "") override;
UIRenderer *getUIRenderer();
// 碰撞检测
bool inHitMask(float x, float y);
bool inHitOnNode(float x, float y);
// 生命周期方法
void update(float deltaTime) override;
void lateUpdate(float deltaTime) override;
void clearNodeFrameFlag() override;
void destroy() override;
3D 节点类 (Node3D)
// 构造函数
Node3D(const std::string name, const std::string uuid = "");
// 获取世界矩阵逆转置(用于法线变换)
const Mat4& getWorldMatrixIT();
// 获取网格渲染器
MeshRenderer* getMeshRenderer();
使用示例
创建并打开场景
// 创建场景
Boo::Scene* scene = new Boo::Scene("MainScene");
// 打开场景(重要:new Scene 后必须紧接着调用此方法)
Boo::game->openScene(scene);
// 注意:根节点由引擎自动创建,不要手动调用 createRoot2D/createRoot3D
创建 2D 节点
// 获取当前场景
Boo::Scene* scene = Boo::game->getScene();
// 获取 2D 根节点
Boo::Node2D* root2D = scene->getRoot2D();
// 创建 2D 节点
Boo::Node2D* uiNode = new Boo::Node2D("UINode");
uiNode->setPosition(100, 100, 0);
uiNode->setSize(200, 100);
uiNode->setAnchor(0.5f, 0.5f);
// 添加到根节点
root
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- Resources/API.md
- Resources/EXAMPLE.md
- Resources/FORMS.md
FAQ
Что делает скилл scene?
Boo引擎的场景系统,负责管理游戏中的所有节点和组件,提供层次化的结构来组织游戏对象,支持2D和3D场景的管理。
Как установить скилл scene?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл scene запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…