> For the complete documentation index, see [llms.txt](https://docs.decentraland.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.decentraland.org/creator/content-creator-zh/jiao-cheng-yu-shi-li/published-games/astro-crew.md).

# 星际船员

具有服务器托管游戏状态、持久化进度、炮塔摄像机和屏幕边缘目标标记的合作飞船战斗。

![Astro Crew 预览](https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-e5dd60929e0236b37ce0503a56bb7011797c7ce1%2FastroCrew-preview.webp?alt=media)

一个合作场景，船员共乘一艘飞船。每到一站，他们都要击落来袭的小行星和飞碟、修补船体破损，并提升炮手和工程技能等级。战斗由权威多人游戏服务器运行。

* [在 Decentraland 上游玩](https://decentraland.org/play/?realm=astrocrew.dcl.eth)

## 项目信息

**维护者：** 社区 · DansStuff

[查看上游源代码](https://github.com/DansStuff/AstroCrew)

**许可证：** 此目录中未标明许可证。重用前，请查阅上游代码库并咨询维护者，确认适用条款。

{% hint style="warning" %}
**社区维护的代码——使用前请先审查**

此社区项目由 Decentraland Foundation 和 DAO 的 GitHub 组织之外的人员维护。其源代码和线上部署可能独立发生变化。

此项目被收录于本目录，并不代表它已通过安全审计或保证其安全性。运行或复用前，请审查代码、依赖项和安装脚本。

[报告目录相关问题](https://github.com/decentraland/docs/issues/new)。如怀疑存在漏洞，请遵循上游项目的安全政策。请勿在公开议题中包含漏洞利用细节或凭据。
{% endhint %}

## 主要功能

* **权威多人游戏** 贯穿整场战斗。客户端发送瞄准、维修和过载请求。服务器负责管理船体、破损和生成内容，而同步的 `GameState` 和 `PlayerStats` 只接受来自多人游戏服务器的写入。
* **存储** 每位玩家的炮手和工程技能等级，以及每周任务排行榜。
* **虚拟摄像机** 设置在三座炮塔上，并通过定时过渡进行混合切换。受到撞击时，这些摄像机会震动。操作炮台时，会通过 **InputModifier** 冻结化身，并通过 **TouchScreenControls**.
* **隐藏移动摇杆和准星。** PrimaryPointerInfo **根据指针的世界射线确定每次射击的瞄准方向。** PointerLock **保持释放状态，因此** PointerEvents
* **仍可操作控制台、按住修补破损处，以及使用任务桌。** 重新着色飞船的自发光网格：巡航时为绿色，遭遇战期间为红色，武器过载时则使用另一组颜色。
* **ReactEcs** HUD 显示船体状态、技能等级和回合结束面板。屏幕外的破损图标贴在屏幕边缘，并使用 **UiCanvasInformation**.
* **Billboards**, **TextShape**和 **化身纹理** 显示在每个目标上：一个朝向摄像机的准星、“已锁定目标”标签，以及正在射击该目标的玩家头像。
* **Animator** 循环播放飞碟旋转动画片段。 **AudioSource** 播放提示音和循环音效，并通过激光音效池支持在上一段音效仍在播放时重新播放射击音效。音效片段由 **AssetLoad**.
* 游戏内 **TextShape** 每周排行榜的行。点击某行即可查看对应任务的结果。
* **AvatarModifierArea** 会关闭整个场景中的身份卡提示。

## 探索代码

这些链接指向特定的源代码快照，因此随着上游持续开发，这些说明仍然有用。它们是学习参考资料，并非安全评估。

### 为玩家指示屏幕外的目标

edgePositionForBreach 会将破损方向投影到摄像机的水平轴上，找到矩形边缘，并根据画布宽高比将图标限制在屏幕范围内。BreachIcon 会将该位置与一个脉动的 ReactEcs 标记关联起来。

**项目背景：** 结合场景中的破损位置、活动破损状态和 UI 常量阅读。

**源代码参考：**

* [edgePositionForBreach](https://github.com/DansStuff/AstroCrew/blob/dbe11b05be2a753b27b6d5dd866d0554ff73344f/src/ui/breachIcons.tsx#L27-L76)
* [BreachIcon](https://github.com/DansStuff/AstroCrew/blob/dbe11b05be2a753b27b6d5dd866d0554ff73344f/src/ui/breachIcons.tsx#L78-L107)

### 添加摄像机震动效果，并使其恢复到原始姿态

shakeEntity 会记录基础变换，并根据强度和剩余时长合并重叠的震动。CameraShakeSystem 会应用逐渐减弱的位置和旋转偏移，然后恢复基础姿态并移除该组件。

**项目背景：** 该效果使用项目的振幅常量，并且必须注册为 ECS 系统。

**源代码参考：**

* [shakeEntity](https://github.com/DansStuff/AstroCrew/blob/dbe11b05be2a753b27b6d5dd866d0554ff73344f/src/effects/cameraShake.ts#L13-L47)
* [CameraShakeSystem](https://github.com/DansStuff/AstroCrew/blob/dbe11b05be2a753b27b6d5dd866d0554ff73344f/src/effects/cameraShake.ts#L87-L121)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.decentraland.org/creator/content-creator-zh/jiao-cheng-yu-shi-li/published-games/astro-crew.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
