меню паузы, механика записок и лифта
This commit is contained in:
1 parent
cbda26dfc0
commit
cdd1055fd8
55 files changed
+3848
-1075
No files matched your search
@@ -0,0 +1,85 @@
|
||||
---
|
||||
name: editor-session-quit
|
||||
description: Save and quit an editor that a CLI session started (`unity-mcp-cli exec`, `open --headless`). Needs the session lease nonce; an editor the user opened is never closed. Used by `unity-mcp-cli close`.
|
||||
metadata:
|
||||
generated-by: mcp-plugin-dotnet
|
||||
---
|
||||
|
||||
# Editor Session / Quit
|
||||
|
||||
Save and quit an editor that a CLI session started.
|
||||
|
||||
## Inputs
|
||||
|
||||
- `nonce` — the `nonce` of the project's session lease (`.ai-game-dev/session.json`), which the CLI also passed to the editor as `AIGD_SESSION_NONCE`.
|
||||
|
||||
## Behavior
|
||||
|
||||
Refuses unless this editor was started by a CLI session (`AIGD_SESSION_OWNER=cli`) with the same nonce. Otherwise answers right away, then saves changed scenes that have a file and changed assets and exits — as the idle shutdown does. Unlike the OS polite-quit signal it also reaches a headless (`-batchmode`) editor. Prefer `unity-mcp-cli close --owned-only` over calling it directly.
|
||||
|
||||
## How to Call
|
||||
|
||||
```bash
|
||||
unity-mcp-cli run-system-tool editor-session-quit --input '{
|
||||
"nonce": "string_value"
|
||||
}'
|
||||
```
|
||||
|
||||
> For complex input (multi-line strings, code), save the JSON to a file and use:
|
||||
> ```bash
|
||||
> unity-mcp-cli run-system-tool editor-session-quit --input-file args.json
|
||||
> ```
|
||||
>
|
||||
> Or pipe via stdin (recommended):
|
||||
> ```bash
|
||||
> unity-mcp-cli run-system-tool editor-session-quit --input-file - <<'EOF'
|
||||
> {"param": "value"}
|
||||
> EOF
|
||||
> ```
|
||||
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
If `unity-mcp-cli` is not found, either install it globally (`npm install -g unity-mcp-cli`) or use `npx unity-mcp-cli` instead.
|
||||
Read the /unity-initial-setup skill for detailed installation instructions.
|
||||
|
||||
## Input
|
||||
|
||||
| Name | Type | Required | Description |
|
||||
|------|------|----------|-------------|
|
||||
| `nonce` | `string` | Yes | The nonce of the project's CLI session lease (.ai-game-dev/session.json). |
|
||||
|
||||
### Input JSON Schema
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"nonce": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"nonce"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Output
|
||||
|
||||
### Output JSON Schema
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"result": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"result"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
@@ -81,58 +81,5 @@ Read the /unity-initial-setup skill for detailed installation instructions.
|
||||
|
||||
## Output
|
||||
|
||||
### Output JSON Schema
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"result": {
|
||||
"$ref": "#/$defs/System.Collections.Generic.List(AIGD.PackageData)"
|
||||
}
|
||||
},
|
||||
"$defs": {
|
||||
"AIGD.PackageData": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Name": {
|
||||
"type": "string",
|
||||
"description": "The official Unity name of the package used as the package ID."
|
||||
},
|
||||
"DisplayName": {
|
||||
"type": "string",
|
||||
"description": "The display name of the package."
|
||||
},
|
||||
"Version": {
|
||||
"type": "string",
|
||||
"description": "The version of the package."
|
||||
},
|
||||
"Description": {
|
||||
"type": "string",
|
||||
"description": "A brief description of the package."
|
||||
},
|
||||
"Source": {
|
||||
"type": "string",
|
||||
"description": "The source of the package (Registry, Embedded, Local, Git, etc.)."
|
||||
},
|
||||
"Category": {
|
||||
"type": "string",
|
||||
"description": "The category of the package."
|
||||
}
|
||||
},
|
||||
"description": "Package information returned from package list operation."
|
||||
},
|
||||
"System.Collections.Generic.List(AIGD.PackageData)": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/$defs/AIGD.PackageData",
|
||||
"description": "Package information returned from package list operation."
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"result"
|
||||
]
|
||||
}
|
||||
```
|
||||
This tool does not return structured output.
|
||||
|
||||
@@ -79,71 +79,5 @@ Read the /unity-initial-setup skill for detailed installation instructions.
|
||||
|
||||
## Output
|
||||
|
||||
### Output JSON Schema
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"result": {
|
||||
"$ref": "#/$defs/System.Collections.Generic.List(AIGD.PackageSearchResult)"
|
||||
}
|
||||
},
|
||||
"$defs": {
|
||||
"AIGD.PackageSearchResult": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Name": {
|
||||
"type": "string",
|
||||
"description": "The official Unity name of the package used as the package ID."
|
||||
},
|
||||
"DisplayName": {
|
||||
"type": "string",
|
||||
"description": "The display name of the package."
|
||||
},
|
||||
"LatestVersion": {
|
||||
"type": "string",
|
||||
"description": "The latest version available in the registry."
|
||||
},
|
||||
"Description": {
|
||||
"type": "string",
|
||||
"description": "A brief description of the package."
|
||||
},
|
||||
"IsInstalled": {
|
||||
"type": "boolean",
|
||||
"description": "Whether this package is already installed in the project."
|
||||
},
|
||||
"InstalledVersion": {
|
||||
"type": "string",
|
||||
"description": "The currently installed version (if installed)."
|
||||
},
|
||||
"AvailableVersions": {
|
||||
"$ref": "#/$defs/System.Collections.Generic.List(System.String)",
|
||||
"description": "Available versions of this package (up to 5 most recent)."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"IsInstalled"
|
||||
],
|
||||
"description": "Package search result with available versions."
|
||||
},
|
||||
"System.Collections.Generic.List(System.String)": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"System.Collections.Generic.List(AIGD.PackageSearchResult)": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/$defs/AIGD.PackageSearchResult",
|
||||
"description": "Package search result with available versions."
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"result"
|
||||
]
|
||||
}
|
||||
```
|
||||
This tool does not return structured output.
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
---
|
||||
name: rql-mutate
|
||||
description: "Change the live Unity scene with RQL set/call: bulk edits in one all-or-nothing, undoable call, saved to disk; dry_run previews."
|
||||
metadata:
|
||||
generated-by: mcp-plugin-dotnet
|
||||
---
|
||||
|
||||
# RQL / Mutate
|
||||
|
||||
Change the live Unity Editor scene with an RQL query whose last stage is set or call. All-or-nothing: every target and value is checked before anything is written; a failure changes nothing. Undoable in the Editor (Ctrl+Z). Changed assets, scenes and the open prefab are saved to disk automatically; an untitled scene needs SaveAs(path). dry_run=true returns the receipt ($ref, member, old, new) without changing anything. Do exactly the change requested; a read-only member fails with readonly-member instead of being approximated.
|
||||
set path = expr, ... assign members (paths may go through structs: set transform.position.y = transform.position.y + 1)
|
||||
call Method(args) invoke a method the tools expose
|
||||
Examples:
|
||||
objects | where name == "Player" | set transform.position = "(0, 1, 0)"
|
||||
objects | get components | where $ is Light | set intensity = intensity * 2, color = "#ffcc88"
|
||||
objects | where tag == "Enemy" | set active = false
|
||||
unity.asset("Assets/Mats/Red.mat") | set properties["_Color"] = "(1, 0, 0, 1)"
|
||||
objects | where name == "Spawner" | set targets = append(targets, ref("GameObject#1234"))
|
||||
Create / add / remove (call; the receipt's result column holds the new object's $ref for follow-up queries):
|
||||
editor | call CreateGameObject("Props") new root GameObject
|
||||
editor | call CreateGameObject("Crate", ref("GameObject#1234"), "Cube") child of a parent, optional primitive
|
||||
objects | where name == "Crate" | call AddComponent("Rigidbody") add a component by type name
|
||||
objects | where name == "Old" | call Destroy() remove a GameObject (components: get components | where $ is X | call Destroy())
|
||||
objects | where name == "Lamp" | set transform.parent = ref("GameObject#1234") reparent (keeps the world position)
|
||||
objects | where name == "Crate" | call Duplicate() copy next to it (returns the copy)
|
||||
Scenes, prefabs, assets, Editor state:
|
||||
editor | call OpenScene("Assets/Scenes/Level.unity") editor | call NewScene("Assets/Scenes/New.unity")
|
||||
scenes | where path == "" | call SaveAs("Assets/Scenes/New.unity") scenes | where name == "Level" | call SetActive()
|
||||
editor | call InstantiatePrefab("Assets/Prefabs/Enemy.prefab", ref("GameObject#1234"), "(0, 0, 5)")
|
||||
objects | where name == "Crate" | call SaveAsPrefab("Assets/Prefabs/Crate.prefab")
|
||||
editor | call OpenPrefab("Assets/Prefabs/Enemy.prefab") then prefab | recurse children | … then editor | call ClosePrefab()
|
||||
editor | call CreateMaterial("Assets/Mats/Glow.mat") editor | call MoveAsset("Assets/A.mat", "Assets/Mats/A.mat")
|
||||
editor | set selection = [ref("GameObject#1234")] editor | set isPlaying = true
|
||||
profiler | call Start() profiler | call Save("Logs/profile.json") (read: profiler | select memory frame)
|
||||
Object literals build values: set settings = {speed: 2, "$type": "FastSettings"}. At most 20 targets per call.
|
||||
|
||||
Query part: the RQL of rql-query (full guide and the sources in its description); unity.assets("t:Material"), unity.asset(path), unity.find("Name"), ref("Light#1234"). Stages: where, select, sort, first N, get <path>, recurse children. Operators: == != < > and or not, contains, starts-with, $ is Light. Paths a.b.c, list[0], map["key"]. Vectors/colors as "(1, 2, 3)" or "#ff8800"; enums as strings.
|
||||
|
||||
## How to Call
|
||||
|
||||
```bash
|
||||
unity-mcp-cli run-tool rql-mutate --input '{
|
||||
"query": "string_value",
|
||||
"dry_run": false
|
||||
}'
|
||||
```
|
||||
|
||||
> For complex input (multi-line strings, code), save the JSON to a file and use:
|
||||
> ```bash
|
||||
> unity-mcp-cli run-tool rql-mutate --input-file args.json
|
||||
> ```
|
||||
>
|
||||
> Or pipe via stdin (recommended):
|
||||
> ```bash
|
||||
> unity-mcp-cli run-tool rql-mutate --input-file - <<'EOF'
|
||||
> {"param": "value"}
|
||||
> EOF
|
||||
> ```
|
||||
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
If `unity-mcp-cli` is not found, either install it globally (`npm install -g unity-mcp-cli`) or use `npx unity-mcp-cli` instead.
|
||||
Read the /unity-initial-setup skill for detailed installation instructions.
|
||||
|
||||
## Input
|
||||
|
||||
| Name | Type | Required | Description |
|
||||
|------|------|----------|-------------|
|
||||
| `query` | `string` | Yes | RQL query ending with a set or call stage, e.g. objects | where name == "Player" | set active = false |
|
||||
| `dry_run` | `boolean` | No | true = preview the receipt without changing anything |
|
||||
|
||||
### Input JSON Schema
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"query": {
|
||||
"type": "string"
|
||||
},
|
||||
"dry_run": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"query"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Output
|
||||
|
||||
This tool does not return structured output.
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
---
|
||||
name: rql-query
|
||||
description: "Query the live Unity scene (GameObjects, components, assets) with RQL in ONE call: filter, project, sort, count, walk hierarchies. Far fewer calls/tokens than reading objects one by one."
|
||||
metadata:
|
||||
generated-by: mcp-plugin-dotnet
|
||||
---
|
||||
|
||||
# RQL / Query
|
||||
|
||||
Run a read-only RQL query against the live Unity Editor scene and return compact rows. One precise query beats many exploratory calls. Changes need rql-mutate.
|
||||
|
||||
RQL: source | stage | stage ...
|
||||
Sources: objects (every GameObject in the loaded scenes, inactive included), roots, scenes, selection, prefab (the prefab open in prefab editing mode), console (Editor log entries), shaders, componentTypes, profiler (memory / rendering / frame snapshots; call Start / Stop / Save), tests (test methods; run a selection with tests-run query), testResults (last run), editor (Editor state and operations). Assets: unity.assets("t:Material") or unity.assets("t:Prefab", "Assets/Enemies"), unity.asset("Assets/Mats/Red.mat"). ref("Light#1234") resolves a $ref; unity.find("Player") or unity.find("Level/Pillar_1") a GameObject by unique name or path.
|
||||
Stages:
|
||||
where <predicate> filter
|
||||
select a b.c alias=(expr) project columns (wrap computed expressions in parentheses)
|
||||
sort <expr> [desc], ... stable sort
|
||||
first N | skip N | count
|
||||
get <path> replace each item by a member (lists are flattened)
|
||||
recurse children [max-depth=N] [include-self=false] walk the hierarchy (input items included by default)
|
||||
distinct [expr] | group-by expr | sum expr | min expr | max expr | avg expr
|
||||
Expressions: == != < <= > >= and or not + - * / %; contains, starts-with, ends-with (case-insensitive); matches "regex"; x in [a, b]; x is null; x is not null; $ is Light (includes subclasses); has(member). Literals: numbers, "strings", true/false/null, lists [a, b], objects {x: 1, y: 2}.
|
||||
Paths: a.b.c, list[0], map["key"]; .member on a list maps over its elements. List methods: .any(pred) .all(pred) .count([pred]) .sum(e) .min(e) .max(e) .first([pred]); inside them bare names refer to the element, falling back to the outer item.
|
||||
Meta: $ (current item), $ref (stable id such as Light#1234), $type, $path, $index, $depth. Enums compare to strings (type == "Spot"); == on strings is case-sensitive.
|
||||
Unity: GameObject has components (list), children (list), active, name, tag, layer, transform (position, localPosition, eulerAngles, localScale, parent). Component members are the C# members (public + [SerializeField]); find them via objects | get components | where $ is Light. Vectors/colors print as (x, y, z); write "(1, 2, 3)", [1, 2, 3] or {x: 1, y: 2, z: 3}; colors also "#ff8800". Material shader properties: properties["_Color"]. Destroyed objects read as null (missing references: where target == null). Navigate with paths or get; select only projects output columns.
|
||||
Results come back as compact rows (header line, then col|col). Long results are truncated — refine with where/first or use count. Unknown members produce warnings with suggestions; rql-schema(type) lists a type's members.
|
||||
|
||||
Examples:
|
||||
objects | where name contains "Enemy" and active | select $ref name transform.position
|
||||
objects | get components | where $ is Light and intensity > 2 | select gameObject.name intensity color
|
||||
roots | recurse children | where components.count() == 1 | select $path name
|
||||
unity.assets("t:Material") | select name shader.name properties["_Color"]
|
||||
console | where logType == "Error" | sort sequence desc | first 5 | select message
|
||||
scenes | select name path isDirty rootCount
|
||||
componentTypes | where name contains "Collider" | select name
|
||||
editor | select isPlaying isPaused selection
|
||||
|
||||
## How to Call
|
||||
|
||||
```bash
|
||||
unity-mcp-cli run-tool rql-query --input '{
|
||||
"query": "string_value"
|
||||
}'
|
||||
```
|
||||
|
||||
> For complex input (multi-line strings, code), save the JSON to a file and use:
|
||||
> ```bash
|
||||
> unity-mcp-cli run-tool rql-query --input-file args.json
|
||||
> ```
|
||||
>
|
||||
> Or pipe via stdin (recommended):
|
||||
> ```bash
|
||||
> unity-mcp-cli run-tool rql-query --input-file - <<'EOF'
|
||||
> {"param": "value"}
|
||||
> EOF
|
||||
> ```
|
||||
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
If `unity-mcp-cli` is not found, either install it globally (`npm install -g unity-mcp-cli`) or use `npx unity-mcp-cli` instead.
|
||||
Read the /unity-initial-setup skill for detailed installation instructions.
|
||||
|
||||
## Input
|
||||
|
||||
| Name | Type | Required | Description |
|
||||
|------|------|----------|-------------|
|
||||
| `query` | `string` | Yes | RQL query, e.g. objects | where $ is ... | select $ref name |
|
||||
|
||||
### Input JSON Schema
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"query": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"query"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Output
|
||||
|
||||
This tool does not return structured output.
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
---
|
||||
name: rql-schema
|
||||
description: List RQL sources and the component types present in the loaded scenes; pass a type name for its members.
|
||||
metadata:
|
||||
generated-by: mcp-plugin-dotnet
|
||||
---
|
||||
|
||||
# RQL / Schema
|
||||
|
||||
Without a type: RQL sources, asset functions, and the component types present in the loaded scenes (with counts), plus GameObject and Transform members. With a type name (e.g. "Light", "Enemy", "Vector3"): that type's members (name type; ro = read-only) and methods. Use it before querying an unfamiliar component.
|
||||
|
||||
## How to Call
|
||||
|
||||
```bash
|
||||
unity-mcp-cli run-tool rql-schema --input '{
|
||||
"type": "string_value"
|
||||
}'
|
||||
```
|
||||
|
||||
> For complex input (multi-line strings, code), save the JSON to a file and use:
|
||||
> ```bash
|
||||
> unity-mcp-cli run-tool rql-schema --input-file args.json
|
||||
> ```
|
||||
>
|
||||
> Or pipe via stdin (recommended):
|
||||
> ```bash
|
||||
> unity-mcp-cli run-tool rql-schema --input-file - <<'EOF'
|
||||
> {"param": "value"}
|
||||
> EOF
|
||||
> ```
|
||||
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
If `unity-mcp-cli` is not found, either install it globally (`npm install -g unity-mcp-cli`) or use `npx unity-mcp-cli` instead.
|
||||
Read the /unity-initial-setup skill for detailed installation instructions.
|
||||
|
||||
## Input
|
||||
|
||||
| Name | Type | Required | Description |
|
||||
|------|------|----------|-------------|
|
||||
| `type` | `string` | No | Optional type name, e.g. "Light", "Rigidbody", "Enemy", "Vector3" |
|
||||
|
||||
### Input JSON Schema
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Output
|
||||
|
||||
This tool does not return structured output.
|
||||
|
||||
@@ -50,7 +50,7 @@ Read the /unity-initial-setup skill for detailed installation instructions.
|
||||
|
||||
| Name | Type | Required | Description |
|
||||
|------|------|----------|-------------|
|
||||
| `cameraRef` | `any` | No | Reference to the camera GameObject. If not specified, uses the Main Camera. |
|
||||
| `cameraRef` | `string` | No | Reference to the camera GameObject. If not specified, uses the Main Camera. RQL: GameObjectRef |
|
||||
| `width` | `integer` | No | Width of the screenshot in pixels. |
|
||||
| `height` | `integer` | No | Height of the screenshot in pixels. |
|
||||
|
||||
@@ -61,7 +61,7 @@ Read the /unity-initial-setup skill for detailed installation instructions.
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"cameraRef": {
|
||||
"$ref": "#/$defs/AIGD.GameObjectRef"
|
||||
"type": "string"
|
||||
},
|
||||
"width": {
|
||||
"type": "integer"
|
||||
@@ -69,48 +69,6 @@ Read the /unity-initial-setup skill for detailed installation instructions.
|
||||
"height": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"$defs": {
|
||||
"UnityEngine.EntityId": {
|
||||
"type": "string",
|
||||
"pattern": "^[0-9]+$"
|
||||
},
|
||||
"System.Type": {
|
||||
"type": "string"
|
||||
},
|
||||
"AIGD.GameObjectRef": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"instanceID": {
|
||||
"$ref": "#/$defs/UnityEngine.EntityId",
|
||||
"description": "instanceID of the UnityEngine.Object. If it is '0' and 'path', 'name', 'assetPath' and 'assetGuid' is not provided, empty or null, then it will be used as 'null'. Priority: 1 (Recommended)"
|
||||
},
|
||||
"path": {
|
||||
"type": "string",
|
||||
"description": "Path of a GameObject in the hierarchy Sample 'character/hand/finger/particle'. Priority: 2."
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Name of a GameObject in hierarchy. Priority: 3."
|
||||
},
|
||||
"assetType": {
|
||||
"$ref": "#/$defs/System.Type",
|
||||
"description": "Type of the asset."
|
||||
},
|
||||
"assetPath": {
|
||||
"type": "string",
|
||||
"description": "Path to the asset within the project. Starts with 'Assets/'"
|
||||
},
|
||||
"assetGuid": {
|
||||
"type": "string",
|
||||
"description": "Unique identifier for the asset."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"instanceID"
|
||||
],
|
||||
"description": "Find GameObject in opened Prefab or in the active Scene."
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -32,17 +32,17 @@ Isolation temporarily activates inactive child GameObjects so their renderers pa
|
||||
```bash
|
||||
unity-mcp-cli run-tool screenshot-isolated --input '{
|
||||
"gameObjectRef": "string_value",
|
||||
"includeChildren": "string_value",
|
||||
"isolated": "string_value",
|
||||
"includeChildren": false,
|
||||
"isolated": false,
|
||||
"backgroundMode": "string_value",
|
||||
"backgroundColor": "string_value",
|
||||
"cameraView": "string_value",
|
||||
"fieldOfView": "string_value",
|
||||
"nearClipPlane": "string_value",
|
||||
"farClipPlane": "string_value",
|
||||
"padding": "string_value",
|
||||
"fieldOfView": 0,
|
||||
"nearClipPlane": 0,
|
||||
"farClipPlane": 0,
|
||||
"padding": 0,
|
||||
"lights": "string_value",
|
||||
"resolution": "string_value"
|
||||
"resolution": 0
|
||||
}'
|
||||
```
|
||||
|
||||
@@ -68,18 +68,18 @@ Read the /unity-initial-setup skill for detailed installation instructions.
|
||||
|
||||
| Name | Type | Required | Description |
|
||||
|------|------|----------|-------------|
|
||||
| `gameObjectRef` | `any` | Yes | Reference to the target GameObject (by instanceId, path, or name). |
|
||||
| `includeChildren` | `any` | No | Include child GameObjects in the render. Default: true. |
|
||||
| `isolated` | `any` | No | When true, renders only the target object using layer-based culling. When false, renders the full scene from the computed camera position. Default: true. |
|
||||
| `backgroundMode` | `any` | No | Background mode. Default: SolidColor. |
|
||||
| `gameObjectRef` | `string` | Yes | Reference to the target GameObject (by instanceId, path, or name). RQL: GameObjectRef |
|
||||
| `includeChildren` | `boolean` | No | Include child GameObjects in the render. Default: true. |
|
||||
| `isolated` | `boolean` | No | When true, renders only the target object using layer-based culling. When false, renders the full scene from the computed camera position. Default: true. |
|
||||
| `backgroundMode` | `string` | No | Background mode. Default: SolidColor. |
|
||||
| `backgroundColor` | `string` | No | Hex background color (e.g. '#404040'). Only used when backgroundMode is SolidColor. |
|
||||
| `cameraView` | `any` | No | Camera angle relative to the target object's bounding box. Default: Front. |
|
||||
| `fieldOfView` | `any` | No | Camera vertical field of view in degrees. Default: 60. |
|
||||
| `nearClipPlane` | `any` | No | Camera near clip plane distance. Default: 0.01. |
|
||||
| `farClipPlane` | `any` | No | Camera far clip plane distance. Default: 1000. |
|
||||
| `padding` | `any` | No | Framing multiplier around the object. 1.0 = tight fit, 1.5 = 50% extra space. Default: 1.2. |
|
||||
| `cameraView` | `string` | No | Camera angle relative to the target object's bounding box. Default: Front. |
|
||||
| `fieldOfView` | `number` | No | Camera vertical field of view in degrees. Default: 60. |
|
||||
| `nearClipPlane` | `number` | No | Camera near clip plane distance. Default: 0.01. |
|
||||
| `farClipPlane` | `number` | No | Camera far clip plane distance. Default: 1000. |
|
||||
| `padding` | `number` | No | Framing multiplier around the object. 1.0 = tight fit, 1.5 = 50% extra space. Default: 1.2. |
|
||||
| `lights` | `string` | No | JSON array of light configurations. Each object defines type, color, intensity, rotation, position, range, spotAngle, shadows, etc. When null, a default white directional light at rotation (50,-30,0) is used. Example: [{"type":"Directional","color":"#FFF4E5","intensity":1.2,"rotation":[45,-45,0]}] |
|
||||
| `resolution` | `any` | No | Output image resolution in pixels (width = height). Default: 512. |
|
||||
| `resolution` | `integer` | No | Output image resolution in pixels (width = height). Default: 512. |
|
||||
|
||||
### Input JSON Schema
|
||||
|
||||
@@ -88,87 +88,15 @@ Read the /unity-initial-setup skill for detailed installation instructions.
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"gameObjectRef": {
|
||||
"$ref": "#/$defs/AIGD.GameObjectRef"
|
||||
"type": "string"
|
||||
},
|
||||
"includeChildren": {
|
||||
"$ref": "#/$defs/System.Boolean"
|
||||
},
|
||||
"isolated": {
|
||||
"$ref": "#/$defs/System.Boolean"
|
||||
},
|
||||
"backgroundMode": {
|
||||
"$ref": "#/$defs/com.IvanMurzak.Unity.MCP.Editor.API.Tool_Screenshot-BackgroundMode"
|
||||
},
|
||||
"backgroundColor": {
|
||||
"type": "string"
|
||||
},
|
||||
"cameraView": {
|
||||
"$ref": "#/$defs/com.IvanMurzak.Unity.MCP.Editor.API.Tool_Screenshot-CameraView"
|
||||
},
|
||||
"fieldOfView": {
|
||||
"$ref": "#/$defs/System.Single"
|
||||
},
|
||||
"nearClipPlane": {
|
||||
"$ref": "#/$defs/System.Single"
|
||||
},
|
||||
"farClipPlane": {
|
||||
"$ref": "#/$defs/System.Single"
|
||||
},
|
||||
"padding": {
|
||||
"$ref": "#/$defs/System.Single"
|
||||
},
|
||||
"lights": {
|
||||
"type": "string"
|
||||
},
|
||||
"resolution": {
|
||||
"$ref": "#/$defs/System.Int32"
|
||||
}
|
||||
},
|
||||
"$defs": {
|
||||
"UnityEngine.EntityId": {
|
||||
"type": "string",
|
||||
"pattern": "^[0-9]+$"
|
||||
},
|
||||
"System.Type": {
|
||||
"type": "string"
|
||||
},
|
||||
"AIGD.GameObjectRef": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"instanceID": {
|
||||
"$ref": "#/$defs/UnityEngine.EntityId",
|
||||
"description": "instanceID of the UnityEngine.Object. If it is '0' and 'path', 'name', 'assetPath' and 'assetGuid' is not provided, empty or null, then it will be used as 'null'. Priority: 1 (Recommended)"
|
||||
},
|
||||
"path": {
|
||||
"type": "string",
|
||||
"description": "Path of a GameObject in the hierarchy Sample 'character/hand/finger/particle'. Priority: 2."
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Name of a GameObject in hierarchy. Priority: 3."
|
||||
},
|
||||
"assetType": {
|
||||
"$ref": "#/$defs/System.Type",
|
||||
"description": "Type of the asset."
|
||||
},
|
||||
"assetPath": {
|
||||
"type": "string",
|
||||
"description": "Path to the asset within the project. Starts with 'Assets/'"
|
||||
},
|
||||
"assetGuid": {
|
||||
"type": "string",
|
||||
"description": "Unique identifier for the asset."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"instanceID"
|
||||
],
|
||||
"description": "Find GameObject in opened Prefab or in the active Scene."
|
||||
},
|
||||
"System.Boolean": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"com.IvanMurzak.Unity.MCP.Editor.API.Tool_Screenshot-BackgroundMode": {
|
||||
"isolated": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"backgroundMode": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"SolidColor",
|
||||
@@ -176,7 +104,10 @@ Read the /unity-initial-setup skill for detailed installation instructions.
|
||||
"Transparent"
|
||||
]
|
||||
},
|
||||
"com.IvanMurzak.Unity.MCP.Editor.API.Tool_Screenshot-CameraView": {
|
||||
"backgroundColor": {
|
||||
"type": "string"
|
||||
},
|
||||
"cameraView": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Front",
|
||||
@@ -188,10 +119,22 @@ Read the /unity-initial-setup skill for detailed installation instructions.
|
||||
"Composite"
|
||||
]
|
||||
},
|
||||
"System.Single": {
|
||||
"fieldOfView": {
|
||||
"type": "number"
|
||||
},
|
||||
"System.Int32": {
|
||||
"nearClipPlane": {
|
||||
"type": "number"
|
||||
},
|
||||
"farClipPlane": {
|
||||
"type": "number"
|
||||
},
|
||||
"padding": {
|
||||
"type": "number"
|
||||
},
|
||||
"lights": {
|
||||
"type": "string"
|
||||
},
|
||||
"resolution": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -22,7 +22,7 @@ Validates the array (non-empty, every entry ends with `.cs`, every entry exists)
|
||||
|
||||
```bash
|
||||
unity-mcp-cli run-tool script-delete --input '{
|
||||
"files": "string_value"
|
||||
"files": []
|
||||
}'
|
||||
```
|
||||
|
||||
@@ -48,7 +48,7 @@ Read the /unity-initial-setup skill for detailed installation instructions.
|
||||
|
||||
| Name | Type | Required | Description |
|
||||
|------|------|----------|-------------|
|
||||
| `files` | `any` | Yes | File paths to the files. Sample: "Assets/Scripts/MyScript.cs". |
|
||||
| `files` | `array` | Yes | File paths to the files. Sample: "Assets/Scripts/MyScript.cs". |
|
||||
|
||||
### Input JSON Schema
|
||||
|
||||
@@ -57,11 +57,6 @@ Read the /unity-initial-setup skill for detailed installation instructions.
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"files": {
|
||||
"$ref": "#/$defs/System.String-1"
|
||||
}
|
||||
},
|
||||
"$defs": {
|
||||
"System.String-1": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: script-execute
|
||||
description: Compiles and executes C# code dynamically using Roslyn. Supports a full-code mode (default) and a body-only mode — see the skill body for the difference and for how to pass Unity object references as parameters.
|
||||
description: "Compiles and runs C# in the Unity Editor (Roslyn): plain statements with the last expression as the result, or a full class with a static method. See the skill body for the modes, usings/include and Unity object parameters."
|
||||
metadata:
|
||||
generated-by: mcp-plugin-dotnet
|
||||
---
|
||||
@@ -9,16 +9,24 @@ metadata:
|
||||
|
||||
## Modes
|
||||
|
||||
- **Full code mode** (default, `isMethodBody=false`): the `csharpCode` argument must define a complete class with a static method (no top-level statements).
|
||||
- **Body-only mode** (`isMethodBody=true`): provide only the method body statements. The tool auto-generates the usings, class, and method header.
|
||||
- **Snippet** (default): plain statements. The last expression is the result (`GameObject.Find("Player").name`). Own `using` lines, local classes and functions are allowed; `await` works. Usings for System, LINQ, UnityEngine, UnityEditor and AIGD are already there; an unknown type name is imported automatically when exactly one namespace has it.
|
||||
- **Full code**: when `csharpCode` declares class `className` with a static method `methodName`, that method runs.
|
||||
- `isMethodBody=true` forces snippet mode.
|
||||
|
||||
Compile errors point at your own lines (`snippet.cs(2,5)`).
|
||||
|
||||
## usings / include
|
||||
|
||||
- `usings`: extra namespaces, e.g. `["MyGame.Gameplay"]`.
|
||||
- `include`: helper `.cs` files or folders (recursive), relative to `<Project>/.ai-game-dev/snippets`, compiled with the snippet.
|
||||
|
||||
## Passing Unity objects as parameters
|
||||
|
||||
Unity objects (`GameObject`, `Component`, etc.) can be passed as parameters using their `Ref` types (`GameObjectRef`, `ComponentRef`, etc.) or directly by type:
|
||||
Parameters become the snippet's variables (or the method's arguments, in order):
|
||||
|
||||
- `UnityEngine.GameObject` — resolves an actual GameObject from value `{"instanceID": N}`, `{"name": "..."}`, or `{"path": "..."}`.
|
||||
- `UnityEngine.Component` (or any component subtype) — resolves from `{"instanceID": N}`.
|
||||
- `AIGD.GameObjectRef` — passes a `GameObjectRef` POCO directly; the method body calls `goRef.FindGameObject()` to resolve it.
|
||||
- `AIGD.GameObjectRef` — passes a `GameObjectRef` POCO directly; call `goRef.FindGameObject()` to resolve it.
|
||||
- `AIGD.ComponentRef` — passes a `ComponentRef` POCO.
|
||||
- `AIGD.ObjectRef` — passes a base `ObjectRef` POCO.
|
||||
|
||||
@@ -30,7 +38,9 @@ unity-mcp-cli run-tool script-execute --input '{
|
||||
"className": "string_value",
|
||||
"methodName": "string_value",
|
||||
"parameters": "string_value",
|
||||
"isMethodBody": false
|
||||
"isMethodBody": false,
|
||||
"usings": [],
|
||||
"include": []
|
||||
}'
|
||||
```
|
||||
|
||||
@@ -56,11 +66,13 @@ Read the /unity-initial-setup skill for detailed installation instructions.
|
||||
|
||||
| Name | Type | Required | Description |
|
||||
|------|------|----------|-------------|
|
||||
| `csharpCode` | `string` | Yes | C# code to compile and execute. In full code mode (default, isMethodBody=false): must define a complete class with a static method. Example: 'using UnityEngine; public class Script { public static void Main() { Debug.Log("Hello"); } }'. Do NOT use top-level statements. In body-only mode (isMethodBody=true): provide only the method body statements. The tool auto-generates usings, class, and method header. Example body: 'go.SetActive(false);'. Custom helper classes can still be defined inline in the body-only string after the main logic, but for complex additional class definitions use full code mode instead. |
|
||||
| `className` | `string` | No | The name of the class containing the method to execute. In body-only mode this becomes the generated class name. |
|
||||
| `methodName` | `string` | No | The name of the method to execute. Must be a static method. In body-only mode this becomes the generated method name. |
|
||||
| `parameters` | `any` | No | Serialized parameters to pass to the method. Each entry must specify 'name' and 'typeName'. Supported parameter types include primitives, strings, and Unity object references: - 'UnityEngine.GameObject': resolves an actual GameObject from value '{"instanceID": N}', '{"name": "..."}', or '{"path": "..."}'. - 'UnityEngine.Component' (or any component subtype): resolves from '{"instanceID": N}'. - 'AIGD.GameObjectRef': passes a GameObjectRef POCO directly; the method body calls goRef.FindGameObject() to resolve it. - 'AIGD.ComponentRef': passes a ComponentRef POCO. - 'AIGD.ObjectRef': passes a base ObjectRef POCO. If the method does not require parameters, leave this empty. |
|
||||
| `isMethodBody` | `boolean` | No | When true, 'csharpCode' is treated as just the method body. The tool auto-generates standard using directives (System, UnityEngine, AIGD, com.IvanMurzak.Unity.MCP.Runtime.Extensions, UnityEditor), the class definition, and the method signature (void return type). Parameters from the 'parameters' list are automatically added to the method signature using their typeName and name. When false (default), 'csharpCode' must be a complete C# compilation unit with class and method definitions. |
|
||||
| `csharpCode` | `string` | Yes | C# code. Snippet: 'var go = GameObject.Find("Player");\ngo.transform.position'. Full: 'public class Script { public static int Main() { return 42; } }'. |
|
||||
| `className` | `string` | No | Full mode: the class whose static method runs (namespace-qualified or not). |
|
||||
| `methodName` | `string` | No | Full mode: the static method to run. |
|
||||
| `parameters` | `string` | No | Values for the snippet's / method's parameters by name, e.g. {go: ref("GameObject#12"), n: 6}. Leave empty if there are none. RQL: SerializedMemberList |
|
||||
| `isMethodBody` | `boolean` | No | Force snippet mode even when the code declares 'className'. |
|
||||
| `usings` | `array` | No | Extra namespaces for snippet mode, e.g. ["MyGame.Gameplay"]. |
|
||||
| `include` | `array` | No | Helper .cs files or folders (recursive) compiled with the code, relative to <Project>/.ai-game-dev/snippets. |
|
||||
|
||||
### Input JSON Schema
|
||||
|
||||
@@ -78,54 +90,22 @@ Read the /unity-initial-setup skill for detailed installation instructions.
|
||||
"type": "string"
|
||||
},
|
||||
"parameters": {
|
||||
"$ref": "#/$defs/com.IvanMurzak.ReflectorNet.Model.SerializedMemberList"
|
||||
"type": "string"
|
||||
},
|
||||
"isMethodBody": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"$defs": {
|
||||
"com.IvanMurzak.ReflectorNet.Model.SerializedMemberList": {
|
||||
"usings": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/$defs/com.IvanMurzak.ReflectorNet.Model.SerializedMember"
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"com.IvanMurzak.ReflectorNet.Model.SerializedMember": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"typeName": {
|
||||
"type": "string",
|
||||
"description": "Full type name. Eg: 'System.String', 'System.Int32', 'UnityEngine.Vector3', etc."
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Object name."
|
||||
},
|
||||
"value": {
|
||||
"description": "Value of the object, serialized as a non stringified JSON element. Can be null if the value is not set. Can be default value if the value is an empty object or array json."
|
||||
},
|
||||
"fields": {
|
||||
"include": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/$defs/com.IvanMurzak.ReflectorNet.Model.SerializedMember",
|
||||
"description": "Nested field value."
|
||||
},
|
||||
"description": "Fields of the object, serialized as a list of 'SerializedMember'."
|
||||
},
|
||||
"props": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/$defs/com.IvanMurzak.ReflectorNet.Model.SerializedMember",
|
||||
"description": "Nested property value."
|
||||
},
|
||||
"description": "Properties of the object, serialized as a list of 'SerializedMember'."
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"typeName"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -136,63 +116,5 @@ Read the /unity-initial-setup skill for detailed installation instructions.
|
||||
|
||||
## Output
|
||||
|
||||
### Output JSON Schema
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"result": {
|
||||
"$ref": "#/$defs/com.IvanMurzak.ReflectorNet.Model.SerializedMember"
|
||||
}
|
||||
},
|
||||
"$defs": {
|
||||
"com.IvanMurzak.ReflectorNet.Model.SerializedMemberList": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/$defs/com.IvanMurzak.ReflectorNet.Model.SerializedMember"
|
||||
}
|
||||
},
|
||||
"com.IvanMurzak.ReflectorNet.Model.SerializedMember": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"typeName": {
|
||||
"type": "string",
|
||||
"description": "Full type name. Eg: 'System.String', 'System.Int32', 'UnityEngine.Vector3', etc."
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Object name."
|
||||
},
|
||||
"value": {
|
||||
"description": "Value of the object, serialized as a non stringified JSON element. Can be null if the value is not set. Can be default value if the value is an empty object or array json."
|
||||
},
|
||||
"fields": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/$defs/com.IvanMurzak.ReflectorNet.Model.SerializedMember",
|
||||
"description": "Nested field value."
|
||||
},
|
||||
"description": "Fields of the object, serialized as a list of 'SerializedMember'."
|
||||
},
|
||||
"props": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/$defs/com.IvanMurzak.ReflectorNet.Model.SerializedMember",
|
||||
"description": "Nested property value."
|
||||
},
|
||||
"description": "Properties of the object, serialized as a list of 'SerializedMember'."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"typeName"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"result"
|
||||
]
|
||||
}
|
||||
```
|
||||
This tool does not return structured output.
|
||||
|
||||
@@ -79,19 +79,5 @@ Read the /unity-initial-setup skill for detailed installation instructions.
|
||||
|
||||
## Output
|
||||
|
||||
### Output JSON Schema
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"result": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"result"
|
||||
]
|
||||
}
|
||||
```
|
||||
This tool does not return structured output.
|
||||
|
||||
@@ -13,6 +13,8 @@ Execute Unity tests and return detailed results. Supports filtering by test mode
|
||||
|
||||
- `testMode` (default `EditMode`) — `EditMode` or `PlayMode`. EditMode is faster; prefer it during iteration.
|
||||
- `testAssembly` / `testNamespace` / `testClass` / `testMethod` — optional, layered filters. Namespace and class filters become regex `groupNames` so the validation count and Unity's execution stay in sync. `testMethod` must be fully qualified (`Namespace.FixtureName.TestName`).
|
||||
- `query` — RQL over the `tests` source instead of the four filters: any selection, run as ONE Test Runner run, e.g. `tests | where fixture == "PlayerTests" or categories contains "Smoke"`. One mode per run; the mode comes from the selected tests. Explore first with rql-query: `tests | where fullName contains "Spline" | select fullName mode`.
|
||||
- `result` — RQL stages applied to the results (source `testResults`: name status durationMs message stackTrace), e.g. `where status == "Failed" | select name message`; the answer is then a summary line plus compact RQL text.
|
||||
|
||||
## Response toggles
|
||||
|
||||
@@ -36,6 +38,8 @@ unity-mcp-cli run-tool tests-run --input '{
|
||||
"testNamespace": "string_value",
|
||||
"testClass": "string_value",
|
||||
"testMethod": "string_value",
|
||||
"query": "string_value",
|
||||
"result": "string_value",
|
||||
"includePassingTests": false,
|
||||
"includeMessages": false,
|
||||
"includeStacktrace": false,
|
||||
@@ -72,6 +76,8 @@ Read the /unity-initial-setup skill for detailed installation instructions.
|
||||
| `testNamespace` | `string` | No | Specific test namespace to run (optional). Example: 'MyTestNamespace' |
|
||||
| `testClass` | `string` | No | Specific test class name to run (optional). Example: 'MyTestClass' |
|
||||
| `testMethod` | `string` | No | Specific fully qualified test method to run (optional). Example: 'MyTestNamespace.FixtureName.TestName' |
|
||||
| `query` | `string` | No | RQL over the 'tests' source selecting the tests (instead of the filters above), run as one run. Example: tests | where fullName contains "Player" and mode == "EditMode" |
|
||||
| `result` | `string` | No | RQL stages applied to the results (source 'testResults': name status durationMs message stackTrace); the answer is a summary line plus compact text. Example: where status == "Failed" | select name message |
|
||||
| `includePassingTests` | `boolean` | No | Include details for all tests, both passing and failing (default: false). If you just need details for failing tests, set to false. |
|
||||
| `includeMessages` | `boolean` | No | Include test result messages in the test results (default: true). If you just need pass/fail status, set to false. |
|
||||
| `includeStacktrace` | `boolean` | No | Include stack traces in the test results (default: false). |
|
||||
@@ -104,6 +110,12 @@ Read the /unity-initial-setup skill for detailed installation instructions.
|
||||
"testMethod": {
|
||||
"type": "string"
|
||||
},
|
||||
"query": {
|
||||
"type": "string"
|
||||
},
|
||||
"result": {
|
||||
"type": "string"
|
||||
},
|
||||
"includePassingTests": {
|
||||
"type": "boolean"
|
||||
},
|
||||
@@ -135,147 +147,5 @@ Read the /unity-initial-setup skill for detailed installation instructions.
|
||||
|
||||
## Output
|
||||
|
||||
### Output JSON Schema
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"result": {
|
||||
"$ref": "#/$defs/com.IvanMurzak.Unity.MCP.Editor.API.TestRunner.TestRunResponse"
|
||||
}
|
||||
},
|
||||
"$defs": {
|
||||
"com.IvanMurzak.Unity.MCP.Editor.API.TestRunner.TestSummaryData": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Status": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Unknown",
|
||||
"Passed",
|
||||
"Failed"
|
||||
]
|
||||
},
|
||||
"TotalTests": {
|
||||
"type": "integer"
|
||||
},
|
||||
"PassedTests": {
|
||||
"type": "integer"
|
||||
},
|
||||
"FailedTests": {
|
||||
"type": "integer"
|
||||
},
|
||||
"SkippedTests": {
|
||||
"type": "integer"
|
||||
},
|
||||
"Duration": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"Status",
|
||||
"TotalTests",
|
||||
"PassedTests",
|
||||
"FailedTests",
|
||||
"SkippedTests",
|
||||
"Duration"
|
||||
]
|
||||
},
|
||||
"System.Collections.Generic.List(com.IvanMurzak.Unity.MCP.Editor.API.TestRunner.TestResultData)": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/$defs/com.IvanMurzak.Unity.MCP.Editor.API.TestRunner.TestResultData"
|
||||
}
|
||||
},
|
||||
"com.IvanMurzak.Unity.MCP.Editor.API.TestRunner.TestResultData": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Name": {
|
||||
"type": "string"
|
||||
},
|
||||
"Status": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Passed",
|
||||
"Failed",
|
||||
"Skipped"
|
||||
]
|
||||
},
|
||||
"Duration": {
|
||||
"type": "string"
|
||||
},
|
||||
"Message": {
|
||||
"type": "string"
|
||||
},
|
||||
"StackTrace": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"Status",
|
||||
"Duration"
|
||||
]
|
||||
},
|
||||
"System.Collections.Generic.List(com.IvanMurzak.Unity.MCP.Editor.API.TestRunner.TestLogEntry)": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/$defs/com.IvanMurzak.Unity.MCP.Editor.API.TestRunner.TestLogEntry"
|
||||
}
|
||||
},
|
||||
"com.IvanMurzak.Unity.MCP.Editor.API.TestRunner.TestLogEntry": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Condition": {
|
||||
"type": "string"
|
||||
},
|
||||
"StackTrace": {
|
||||
"type": "string"
|
||||
},
|
||||
"Type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Error",
|
||||
"Assert",
|
||||
"Warning",
|
||||
"Log",
|
||||
"Exception"
|
||||
]
|
||||
},
|
||||
"Timestamp": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"LogLevel": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"Type",
|
||||
"Timestamp"
|
||||
]
|
||||
},
|
||||
"com.IvanMurzak.Unity.MCP.Editor.API.TestRunner.TestRunResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Summary": {
|
||||
"$ref": "#/$defs/com.IvanMurzak.Unity.MCP.Editor.API.TestRunner.TestSummaryData",
|
||||
"description": "Summary of the test run including total, passed, failed, and skipped counts."
|
||||
},
|
||||
"Results": {
|
||||
"$ref": "#/$defs/System.Collections.Generic.List(com.IvanMurzak.Unity.MCP.Editor.API.TestRunner.TestResultData)",
|
||||
"description": "List of individual test results with details about each test."
|
||||
},
|
||||
"Logs": {
|
||||
"$ref": "#/$defs/System.Collections.Generic.List(com.IvanMurzak.Unity.MCP.Editor.API.TestRunner.TestLogEntry)",
|
||||
"description": "Log entries captured during test execution."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"result"
|
||||
]
|
||||
}
|
||||
```
|
||||
This tool does not return structured output.
|
||||
|
||||
@@ -23,7 +23,7 @@ Each entry is resolved against the tool manager's exact-name and case-insensitiv
|
||||
```bash
|
||||
unity-mcp-cli run-tool tool-set-enabled-state --input '{
|
||||
"tools": "string_value",
|
||||
"includeLogs": "string_value"
|
||||
"includeLogs": false
|
||||
}'
|
||||
```
|
||||
|
||||
@@ -49,8 +49,8 @@ Read the /unity-initial-setup skill for detailed installation instructions.
|
||||
|
||||
| Name | Type | Required | Description |
|
||||
|------|------|----------|-------------|
|
||||
| `tools` | `any` | Yes | Array of tools with their desired enabled state. |
|
||||
| `includeLogs` | `any` | No | Include operation logs in the result. Default: false |
|
||||
| `tools` | `string` | Yes | Array of tools with their desired enabled state. RQL: [ToolToggleInput] |
|
||||
| `includeLogs` | `boolean` | No | Include operation logs in the result. Default: false |
|
||||
|
||||
### Input JSON Schema
|
||||
|
||||
@@ -59,36 +59,9 @@ Read the /unity-initial-setup skill for detailed installation instructions.
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"tools": {
|
||||
"$ref": "#/$defs/AIGD.ToolToggleInput-1"
|
||||
"type": "string"
|
||||
},
|
||||
"includeLogs": {
|
||||
"$ref": "#/$defs/System.Boolean"
|
||||
}
|
||||
},
|
||||
"$defs": {
|
||||
"AIGD.ToolToggleInput": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Name": {
|
||||
"type": "string",
|
||||
"description": "Name of the MCP tool to enable or disable."
|
||||
},
|
||||
"Enabled": {
|
||||
"type": "boolean",
|
||||
"description": "Whether the tool should be enabled (true) or disabled (false)."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"Enabled"
|
||||
]
|
||||
},
|
||||
"AIGD.ToolToggleInput-1": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/$defs/AIGD.ToolToggleInput"
|
||||
}
|
||||
},
|
||||
"System.Boolean": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
@@ -100,73 +73,5 @@ Read the /unity-initial-setup skill for detailed installation instructions.
|
||||
|
||||
## Output
|
||||
|
||||
### Output JSON Schema
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"result": {
|
||||
"$ref": "#/$defs/AIGD.ToolToggleResult"
|
||||
}
|
||||
},
|
||||
"$defs": {
|
||||
"com.IvanMurzak.ReflectorNet.Model.Logs": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/$defs/com.IvanMurzak.ReflectorNet.Model.LogEntry"
|
||||
}
|
||||
},
|
||||
"com.IvanMurzak.ReflectorNet.Model.LogEntry": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Depth": {
|
||||
"type": "integer"
|
||||
},
|
||||
"Message": {
|
||||
"type": "string"
|
||||
},
|
||||
"Type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Trace",
|
||||
"Debug",
|
||||
"Info",
|
||||
"Success",
|
||||
"Warning",
|
||||
"Error",
|
||||
"Critical"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"Depth",
|
||||
"Type"
|
||||
]
|
||||
},
|
||||
"System.Collections.Generic.Dictionary(System.String,System.Boolean)": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"AIGD.ToolToggleResult": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Logs": {
|
||||
"$ref": "#/$defs/com.IvanMurzak.ReflectorNet.Model.Logs",
|
||||
"description": "Optional operation logs. Only included when 'includeLogs' is true."
|
||||
},
|
||||
"Success": {
|
||||
"$ref": "#/$defs/System.Collections.Generic.Dictionary(System.String,System.Boolean)",
|
||||
"description": "Result of each tool operation. Key: original input name as provided by the caller (case preserved as-is). Value: true if the enable/disable operation completed successfully, false if the name was unknown, ambiguous, or empty."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"result"
|
||||
]
|
||||
}
|
||||
```
|
||||
This tool does not return structured output.
|
||||
|
||||
@@ -0,0 +1,612 @@
|
||||
---
|
||||
name: unity-rql
|
||||
description: |-
|
||||
How to read and change anything in the Unity Editor with RQL (rql-query / rql-mutate / rql-schema): the query
|
||||
language, operators, sources (scene objects, assets, scenes, prefabs, console logs, Editor state), Editor operations
|
||||
(create, add components, scenes, prefabs, assets, selection, Play Mode) and what installed extensions add.
|
||||
metadata:
|
||||
generated-by: mcp-plugin-dotnet
|
||||
---
|
||||
# RQL — query and change the Unity Editor
|
||||
|
||||
RQL is one pipeline language for the whole Editor: find objects, read members, filter, aggregate, and change them in one
|
||||
call. Prefer one precise query over many exploratory calls.
|
||||
|
||||
- `rql-query` — read-only queries, compact table results.
|
||||
- `rql-mutate` — queries ending with `set` / `call`; all-or-nothing, undoable (Ctrl+Z), `dry_run: true` previews.
|
||||
- `rql-schema` — sources and component types in the scene; `rql-schema(type)` lists one type's members and methods.
|
||||
|
||||
```bash
|
||||
unity-mcp-cli run-tool rql-query --input '{"query": "objects | where name contains \"Enemy\" | select $ref name"}'
|
||||
unity-mcp-cli run-tool rql-mutate --input '{"query": "objects | where name == \"Player\" | set active = false"}'
|
||||
```
|
||||
|
||||
## Language
|
||||
|
||||
```
|
||||
RQL: source | stage | stage ...
|
||||
Sources: objects (every GameObject in the loaded scenes, inactive included), roots, scenes, selection, prefab (the prefab open in prefab editing mode), console (Editor log entries), shaders, componentTypes, profiler (memory / rendering / frame snapshots; call Start / Stop / Save), tests (test methods; run a selection with tests-run query), testResults (last run), editor (Editor state and operations). Assets: unity.assets("t:Material") or unity.assets("t:Prefab", "Assets/Enemies"), unity.asset("Assets/Mats/Red.mat"). ref("Light#1234") resolves a $ref; unity.find("Player") or unity.find("Level/Pillar_1") a GameObject by unique name or path.
|
||||
Stages:
|
||||
where <predicate> filter
|
||||
select a b.c alias=(expr) project columns (wrap computed expressions in parentheses)
|
||||
sort <expr> [desc], ... stable sort
|
||||
first N | skip N | count
|
||||
get <path> replace each item by a member (lists are flattened)
|
||||
recurse children [max-depth=N] [include-self=false] walk the hierarchy (input items included by default)
|
||||
distinct [expr] | group-by expr | sum expr | min expr | max expr | avg expr
|
||||
Expressions: == != < <= > >= and or not + - * / %; contains, starts-with, ends-with (case-insensitive); matches "regex"; x in [a, b]; x is null; x is not null; $ is Light (includes subclasses); has(member). Literals: numbers, "strings", true/false/null, lists [a, b], objects {x: 1, y: 2}.
|
||||
Paths: a.b.c, list[0], map["key"]; .member on a list maps over its elements. List methods: .any(pred) .all(pred) .count([pred]) .sum(e) .min(e) .max(e) .first([pred]); inside them bare names refer to the element, falling back to the outer item.
|
||||
Meta: $ (current item), $ref (stable id such as Light#1234), $type, $path, $index, $depth. Enums compare to strings (type == "Spot"); == on strings is case-sensitive.
|
||||
Unity: GameObject has components (list), children (list), active, name, tag, layer, transform (position, localPosition, eulerAngles, localScale, parent). Component members are the C# members (public + [SerializeField]); find them via objects | get components | where $ is Light. Vectors/colors print as (x, y, z); write "(1, 2, 3)", [1, 2, 3] or {x: 1, y: 2, z: 3}; colors also "#ff8800". Material shader properties: properties["_Color"]. Destroyed objects read as null (missing references: where target == null). Navigate with paths or get; select only projects output columns.
|
||||
Results come back as compact rows (header line, then col|col). Long results are truncated — refine with where/first or use count. Unknown members produce warnings with suggestions; rql-schema(type) lists a type's members.
|
||||
```
|
||||
|
||||
## Changing things (rql-mutate)
|
||||
|
||||
```
|
||||
set path = expr, ... assign members (paths may go through structs: set transform.position.y = transform.position.y + 1)
|
||||
call Method(args) invoke a method the tools expose
|
||||
Examples:
|
||||
objects | where name == "Player" | set transform.position = "(0, 1, 0)"
|
||||
objects | get components | where $ is Light | set intensity = intensity * 2, color = "#ffcc88"
|
||||
objects | where tag == "Enemy" | set active = false
|
||||
unity.asset("Assets/Mats/Red.mat") | set properties["_Color"] = "(1, 0, 0, 1)"
|
||||
objects | where name == "Spawner" | set targets = append(targets, ref("GameObject#1234"))
|
||||
Create / add / remove (call; the receipt's result column holds the new object's $ref for follow-up queries):
|
||||
editor | call CreateGameObject("Props") new root GameObject
|
||||
editor | call CreateGameObject("Crate", ref("GameObject#1234"), "Cube") child of a parent, optional primitive
|
||||
objects | where name == "Crate" | call AddComponent("Rigidbody") add a component by type name
|
||||
objects | where name == "Old" | call Destroy() remove a GameObject (components: get components | where $ is X | call Destroy())
|
||||
objects | where name == "Lamp" | set transform.parent = ref("GameObject#1234") reparent (keeps the world position)
|
||||
objects | where name == "Crate" | call Duplicate() copy next to it (returns the copy)
|
||||
Scenes, prefabs, assets, Editor state:
|
||||
editor | call OpenScene("Assets/Scenes/Level.unity") editor | call NewScene("Assets/Scenes/New.unity")
|
||||
scenes | where path == "" | call SaveAs("Assets/Scenes/New.unity") scenes | where name == "Level" | call SetActive()
|
||||
editor | call InstantiatePrefab("Assets/Prefabs/Enemy.prefab", ref("GameObject#1234"), "(0, 0, 5)")
|
||||
objects | where name == "Crate" | call SaveAsPrefab("Assets/Prefabs/Crate.prefab")
|
||||
editor | call OpenPrefab("Assets/Prefabs/Enemy.prefab") then prefab | recurse children | … then editor | call ClosePrefab()
|
||||
editor | call CreateMaterial("Assets/Mats/Glow.mat") editor | call MoveAsset("Assets/A.mat", "Assets/Mats/A.mat")
|
||||
editor | set selection = [ref("GameObject#1234")] editor | set isPlaying = true
|
||||
profiler | call Start() profiler | call Save("Logs/profile.json") (read: profiler | select memory frame)
|
||||
```
|
||||
|
||||
## Sources
|
||||
|
||||
| Source | What |
|
||||
|---|---|
|
||||
| `animation` | animation: animators (every Animator in the loaded scenes), CreateClip(path, frameRate, loop), CreateController(path, motion) |
|
||||
| `cinemachine` | Cinemachine: cameras, brains, noiseProfiles, bodyTypes / aimTypes / extensionTypes; CreateCamera(name, follow, lookAt, position, eulerAngles, priority), EnsureBrain(camera) |
|
||||
| `componentTypes` | component types that can be added (name fullName namespace) |
|
||||
| `console` | captured Editor log entries, oldest first (last 1000): logType message timestamp stackTrace sequence |
|
||||
| `editor` | Editor state (isPlaying, isPaused, selection …) and operations: CreateGameObject, OpenScene, NewScene, SaveScenes, InstantiatePrefab, OpenPrefab / SavePrefab / ClosePrefab, CopyAsset / MoveAsset / DeleteAsset / CreateFolder, CreateMaterial, SaveAssets, RefreshAssets, ClearConsole, ExecuteMenuItem (rql-schema "editor" for signatures) |
|
||||
| `input` | Input System: assets (.inputactions), layouts, interactions, processors; CreateAsset(path, map?) |
|
||||
| `navigation` | AI Navigation project settings and operations: agentTypes (bake settings, writable), areas (name, cost), BakeAll(), ClearAll() |
|
||||
| `objects` | every GameObject in the loaded scenes, depth-first, inactive ones included |
|
||||
| `prefab` | root GameObject of the prefab open in prefab editing mode (none otherwise) |
|
||||
| `probuilder` | ProBuilder: meshes (every ProBuilderMesh in the loaded scenes), CreateShape(type, name, size, position, rotation, parent), CreatePolyShape(points, height, name, position, flipNormals, parent), Merge(meshes, deleteSources) |
|
||||
| `profiler` | Unity profiler: enabled supported memory rendering script frame modules (live snapshots, MB / ms); calls Start, Stop, ClearFrames, EnableModule, Save, Load (rql-schema "profiler" for signatures) |
|
||||
| `roots` | root GameObjects of the loaded scenes |
|
||||
| `scenes` | loaded scenes |
|
||||
| `selection` | objects selected in the Editor |
|
||||
| `shaders` | every shader the Editor knows (built-in and project): name supported hasErrors |
|
||||
| `splines` | spline containers of the loaded scenes (containers) and CreateContainer(name, position, eulerAngles, closed, parent) |
|
||||
| `terrain` | terrain operations without an owner: Create (Terrain GameObject + TerrainData asset), CreateLayer (TerrainLayer asset) |
|
||||
| `testResults` | results of the last tests-run: name status durationMs message stackTrace |
|
||||
| `tests` | test methods (fullName name fixture namespace assembly mode categories parameterized explicit ignored); run a selection with tests-run query, e.g. tests \| where fixture == "PlayerTests" |
|
||||
| `tilemap` | tilemap operations without an owner: CreateTilemap (Grid + Tilemap GameObject), CreateTile, CreateRuleTile (tile assets) |
|
||||
| `timeline` | timeline operations without an owner: Create (TimelineAsset .playable), CreateSignal (SignalAsset .signal) |
|
||||
| `probuilder.edges(…)` | probuilder.edges(mesh, faces?): distinct edges [[a, b], …] of the faces (index list; default every face), for Bevel / SubdivideEdges / ConnectEdges |
|
||||
| `probuilder.facing(…)` | probuilder.facing(mesh, direction): indices of the faces pointing Up, Down, Left, Right, Forward, Back or Other (local space, within 45°) |
|
||||
| `probuilder.openEdges(…)` | probuilder.openEdges(mesh): border edges [[a, b], …] (a face on one side only: around holes, plane borders), for Bridge |
|
||||
| `probuilder.vertices(…)` | probuilder.vertices(mesh, start?, count?): [{index, position}] local vertex positions (at most 20 per call; default 0, 20) |
|
||||
| `terrain.heightAt(…)` | terrain.heightAt(terrain, worldX, worldZ): world-space surface height (Y) at a world X / Z position |
|
||||
| `terrain.heightStats(…)` | terrain.heightStats(terrain, x?, y?, w?, h?): {min, max, average, cells} of a heightmap region (default: the whole heightmap) |
|
||||
| `terrain.heights(…)` | terrain.heights(terrain, x, y, w?, h?): normalized heights 0 … 1 of a heightmap region as rows (at most 20 × 20 cells) |
|
||||
| `tilemap.cell(…)` | tilemap.cell(tilemap, cell): {cell, tile, path, sprite, color, colliderType, flags, transform} of one cell (tile null when empty) |
|
||||
| `tilemap.cellToWorld(…)` | tilemap.cellToWorld(tilemap, cell): the world position of a cell's center |
|
||||
| `tilemap.cells(…)` | tilemap.cells(tilemap, tile?): the first 20 occupied cells (optionally of one tile asset, path or name), bottom-left first |
|
||||
| `tilemap.count(…)` | tilemap.count(tilemap, tile?, minX?, minY?, maxX?, maxY?, z?): occupied cells, optionally of one tile (asset, path or name) and inside a region |
|
||||
| `tilemap.tileAt(…)` | tilemap.tileAt(tilemap, cell): the tile asset at a cell "(x, y, z)", or null |
|
||||
| `tilemap.tiles(…)` | tilemap.tiles(tilemap, minX, minY, maxX, maxY, z?): tile names of a region as rows, top row (maxY) first, null = empty (at most 20 × 20) |
|
||||
| `tilemap.worldToCell(…)` | tilemap.worldToCell(tilemap, "(x, y, z)"): the cell containing a world position |
|
||||
| `unity.asset(…)` | unity.asset(path): the main asset at a path, e.g. "Assets/Mats/Red.mat" |
|
||||
| `unity.assets(…)` | unity.assets(filter, folder?): AssetDatabase search, e.g. "t:Material", "t:Prefab Enemy" (at most 200, loaded as needed) |
|
||||
| `unity.find(…)` | unity.find(name): the GameObject with that unique name or hierarchy path ("Level/Pillar_1"), e.g. set Follow = unity.find("Player") |
|
||||
|
||||
## Animation
|
||||
|
||||
Clips and controllers are assets: `unity.assets("t:AnimationClip")`, `unity.asset("Assets/…/Walk.anim")`,
|
||||
`unity.asset("Assets/…/Player.controller")`. An AnimationClip has `curves` (path type property keyCount timeRange keys, keys with
|
||||
writable time value inTangent outTangent …), `objectCurves` (sprite swaps), `events` and `settings` (loopTime loopBlend mirror …), all
|
||||
writable views, plus ordinary members (frameRate wrapMode legacy length isLooping). An AnimatorController has `layers` (name
|
||||
defaultWeight blendingMode defaultState `states` anyStateTransitions) and `parameters` (name type defaultFloat defaultInt defaultBool);
|
||||
states and transitions are assets whose members (speed motion tag … / hasExitTime exitTime duration conditions …) are set directly.
|
||||
Writes and calls are undoable; creating an asset is not. `rql-schema "AnimationClip"` / `"AnimatorController"` list the methods.
|
||||
|
||||
Clips (curve `path` is the child path under the Animator, "" = its own GameObject; `type` the animated component):
|
||||
|
||||
```
|
||||
animation | call CreateClip("Assets/Animations/Walk.anim") empty clip, 60 fps
|
||||
animation | call CreateClip("Assets/Animations/Idle.anim", 30, true) path, frameRate, loop
|
||||
unity.assets("t:AnimationClip") | select name length frameRate isLooping n=(curves.count()) e=(events.count())
|
||||
unity.asset("Assets/Animations/Walk.anim") | call SetCurve("", "Transform", "localPosition.y", [[0, 0], [0.5, 1], [1, 0]]) path, type, property, keys [time, value(, inTangent, outTangent)]
|
||||
unity.asset("Assets/Animations/Walk.anim") | call SetCurve("Body", "SpriteRenderer", "m_Color.a", [{time: 0, value: 1}, {time: 1, value: 0, inTangent: -1}])
|
||||
unity.asset("Assets/Animations/Walk.anim") | get curves | select path type property keyCount timeRange
|
||||
unity.asset("Assets/Animations/Walk.anim") | get curves | where property == "localPosition.y" | get keys | select index time value inTangent outTangent
|
||||
unity.asset("Assets/Animations/Walk.anim") | get curves | where property == "localPosition.y" | set keys[1].value = 2, keys[1].outTangent = 0
|
||||
unity.asset("Assets/Animations/Walk.anim") | get curves | where property == "localPosition.y" | call AddKey(1.5, 0.5) returns the key index; RemoveKey(index), SetKeys([[t, v], …]), Evaluate(t)
|
||||
unity.asset("Assets/Animations/Walk.anim") | get curves | where path == "Body" | set postWrapMode = "Loop"
|
||||
unity.asset("Assets/Animations/Walk.anim") | call RemoveCurve("Body", "SpriteRenderer", "m_Color.a") or … | get curves | where … | call Remove()
|
||||
unity.asset("Assets/Animations/Walk.anim") | set frameRate = 30, settings.loopTime = true
|
||||
unity.asset("Assets/Animations/Walk.anim") | call AddEvent(0.5, "Footstep", "left") time, functionName, stringParameter?, floatParameter?, intParameter?
|
||||
unity.asset("Assets/Animations/Walk.anim") | get events | select index time functionName stringParameter
|
||||
unity.asset("Assets/Animations/Walk.anim") | set events[0].time = 0.25, events[0].intParameter = 1
|
||||
unity.asset("Assets/Animations/Walk.anim") | call RemoveEvent(0) ClearEvents() / ClearCurves() remove all
|
||||
```
|
||||
|
||||
Animator controllers (states by name; a trailing `layer` argument is a layer name or index, default 0):
|
||||
|
||||
```
|
||||
animation | call CreateController("Assets/Animations/Player.controller") Base Layer, empty state machine (CreateController(path, motion) adds a state)
|
||||
unity.asset("Assets/Animations/Player.controller") | call AddParameter("Speed", "Float") Float, Int, Bool or Trigger
|
||||
unity.asset("Assets/Animations/Player.controller") | call AddParameter("Grounded", "Bool", true) optional default value
|
||||
unity.asset("Assets/Animations/Player.controller") | call AddParameter("Jump", "Trigger")
|
||||
unity.asset("Assets/Animations/Player.controller") | call AddState("Idle", unity.asset("Assets/Animations/Idle.anim")) name, motion?, layer?; the first state becomes the default
|
||||
unity.asset("Assets/Animations/Player.controller") | call AddState("Walk", unity.asset("Assets/Animations/Walk.anim"))
|
||||
unity.asset("Assets/Animations/Player.controller") | call AddTransition("Idle", "Walk", "Speed", "Greater", 0.1) from, to ("Exit" = exit), parameter?, mode?, threshold?, layer?
|
||||
unity.asset("Assets/Animations/Player.controller") | call AddTransition("Walk", "Idle", "Speed", "Less", 0.1)
|
||||
unity.asset("Assets/Animations/Player.controller") | call AddAnyStateTransition("Idle", "Jump") mode defaults by parameter type: Bool / Trigger If, Float Greater, Int Equals
|
||||
unity.asset("Assets/Animations/Player.controller") | call SetDefaultState("Idle")
|
||||
unity.asset("Assets/Animations/Player.controller") | get layers | select index name defaultWeight defaultState.name states.name
|
||||
unity.asset("Assets/Animations/Player.controller") | get layers | get states | select name speed motion.name transitions.destinationState.name
|
||||
unity.asset("Assets/Animations/Player.controller") | get layers | get states | where name == "Walk" | set speed = 1.5
|
||||
unity.asset("Assets/Animations/Player.controller") | get layers | get states | where name == "Idle" | get transitions | set hasExitTime = true, exitTime = 0.9, duration = 0.25
|
||||
unity.asset("Assets/Animations/Player.controller") | get layers | get states | where name == "Idle" | get transitions | call AddCondition("Grounded", "If") RemoveCondition(index), ClearConditions()
|
||||
unity.asset("Assets/Animations/Player.controller") | get layers | get states | get transitions | select destinationState.name hasExitTime conditions
|
||||
unity.asset("Assets/Animations/Player.controller") | get parameters | select name type defaultFloat defaultBool
|
||||
unity.asset("Assets/Animations/Player.controller") | get parameters | where name == "Speed" | set defaultFloat = 0.5
|
||||
unity.asset("Assets/Animations/Player.controller") | call AddLayer("Upper Body") returns the layer index
|
||||
unity.asset("Assets/Animations/Player.controller") | set layers[1].defaultWeight = 0.5, layers[1].blendingMode = "Additive"
|
||||
unity.asset("Assets/Animations/Player.controller") | call AddState("Wave", null, "Upper Body")
|
||||
unity.asset("Assets/Animations/Player.controller") | call RemoveTransition("Walk", "Idle") from "AnyState" / to "Exit" for those transitions
|
||||
unity.asset("Assets/Animations/Player.controller") | call RemoveState("Wave", "Upper Body")
|
||||
unity.asset("Assets/Animations/Player.controller") | call RemoveLayer("Upper Body")
|
||||
unity.asset("Assets/Animations/Player.controller") | call RemoveTransition("AnyState", "Idle")
|
||||
unity.asset("Assets/Animations/Player.controller") | call RemoveParameter("Jump") conditions using it are removed too
|
||||
```
|
||||
|
||||
Animator components (`animation | get animators` = every Animator in the loaded scenes):
|
||||
|
||||
```
|
||||
editor | call CreateGameObject("Player")
|
||||
objects | where name == "Player" | call AddComponent("Animator")
|
||||
animation | get animators | set runtimeAnimatorController = unity.asset("Assets/Animations/Player.controller"), applyRootMotion = false
|
||||
animation | get animators | select gameObject.name runtimeAnimatorController.name isHuman cullingMode
|
||||
```
|
||||
|
||||
Parameter names and types are read-only (conditions refer to them): rename by RemoveParameter + AddParameter. New transitions
|
||||
have no exit time and no blend duration; set them on the transition. Only the Animator's configuration members are readable (its
|
||||
playback state is not meaningful in Edit Mode); in Play Mode `call SetParameter("Speed", 2)` / `call Play("Walk")` drive it.
|
||||
Other components' AnimationCurve fields take keyframe lists too: `set curve = [[0, 0], [1, 1]]`.
|
||||
|
||||
## Cinemachine
|
||||
|
||||
Cinemachine 3: a `CinemachineCamera` (virtual camera) on its own GameObject; the `CinemachineBrain` on the Unity Camera
|
||||
shows the live one (highest `Priority.Value`) and blends between them. A camera's pipeline is a Body component
|
||||
(position: Follow, OrbitalFollow, ThirdPersonFollow, PositionComposer …), an Aim component (rotation: RotationComposer,
|
||||
HardLookAt, PanTilt …), an optional noise component and extensions, all on the camera's GameObject. Follow / LookAt
|
||||
targets take a GameObject name or ref. Writes and calls are undoable.
|
||||
|
||||
```
|
||||
editor | call CreateGameObject("Player", null, "Capsule") (a target for the examples)
|
||||
cinemachine | call CreateCamera("FollowCam", "Player", null, "(0, 3, -6)", "(20, 0, 0)", 10) name, follow?, lookAt?, position?, eulerAngles?, priority? (adds a CinemachineBrain to the main Camera)
|
||||
cinemachine | call CreateCamera("Overview")
|
||||
cinemachine | get cameras | select name Priority.Value IsLive Follow.name LookAt.name body.$type aim.$type noise.$type
|
||||
cinemachine | get cameras | where name == "FollowCam" | call SetBody("Follow") Body by name; cinemachine | get bodyTypes lists them ("None" removes)
|
||||
cinemachine | get cameras | where name == "FollowCam" | call SetAim("RotationComposer") Aim by name; cinemachine | get aimTypes
|
||||
cinemachine | get cameras | where name == "FollowCam" | set body.FollowOffset = "(0, 2, -8)", body.TrackerSettings.PositionDamping = "(1, 1, 1)"
|
||||
cinemachine | get cameras | where name == "FollowCam" | set aim.Composition.ScreenPosition = "(0.1, 0)", aim.Damping = "(0.5, 0.5)"
|
||||
cinemachine | get cameras | where name == "FollowCam" | set Lens.FieldOfView = 50, Lens.NearClipPlane = 0.3, Lens.Dutch = 5
|
||||
cinemachine | get cameras | where name == "Overview" | set Lens.ModeOverride = "Orthographic", Lens.OrthographicSize = 12
|
||||
cinemachine | get cameras | where name == "FollowCam" | set Priority.Value = 20
|
||||
cinemachine | get cameras | where name == "Overview" | call SetTargets("Player") follow (and look at) Player; SetTargets(follow, lookAt) for both, null clears
|
||||
cinemachine | get cameras | where name == "Overview" | set LookAt = null
|
||||
cinemachine | get cameras | where name == "FollowCam" | call SetNoise("Handheld_normal_mild", 1.5, 1) profile, amplitudeGain?, frequencyGain?; cinemachine | get noiseProfiles | select name
|
||||
cinemachine | get cameras | where name == "FollowCam" | set noise.AmplitudeGain = 0.5
|
||||
cinemachine | get cameras | where name == "FollowCam" | call SetBody("OrbitalFollow") replace the Body
|
||||
cinemachine | get cameras | where name == "FollowCam" | set body.Radius = 6, body.OrbitStyle = "Sphere"
|
||||
objects | where name == "FollowCam" | call AddComponent("CinemachineDeoccluder") extensions are components (cinemachine | get extensionTypes)
|
||||
cinemachine | get cameras | select name extensions.$type
|
||||
cinemachine | call EnsureBrain() brain on the main Camera (EnsureBrain("Camera name") for another)
|
||||
cinemachine | get brains | set DefaultBlend.Style = "EaseInOut", DefaultBlend.Time = 1.5
|
||||
cinemachine | get brains | select gameObject.name DefaultBlend.Style DefaultBlend.Time UpdateMethod activeCamera
|
||||
cinemachine | get cameras | where name == "Overview" | call SetNoise("None")
|
||||
cinemachine | get cameras | where name == "Overview" | call Destroy() remove the CinemachineCamera component (objects | … | call Destroy() removes the GameObject)
|
||||
```
|
||||
|
||||
`body` / `aim` / `noise` are the pipeline components themselves, so their members are written directly
|
||||
(`rql-schema "CinemachineFollow"` lists them). LensSettings is a struct written in place (`set Lens.FieldOfView = …`);
|
||||
`Lens.ModeOverride` (None, Orthographic, Perspective, Physical) overrides the Unity Camera's projection. Blend styles:
|
||||
Cut, EaseInOut, EaseIn, EaseOut, HardIn, HardOut, Linear, Custom. Brains update the live camera in Play Mode; `IsLive`
|
||||
reports it.
|
||||
|
||||
## Input System
|
||||
|
||||
An InputActionAsset (`.inputactions` file) has `maps` → `actions` → `bindings` and `controlSchemes`; `actions` also lists
|
||||
every action of every map. Every `set` and `call` is validated (control paths need a known device layout, interactions /
|
||||
processors / composites must be registered, groups must be control schemes of the asset), written to the `.inputactions`
|
||||
file and re-imported at once, and is undoable. Paths look like `"<Keyboard>/space"`, `"<Gamepad>/leftStick"`,
|
||||
`"<Mouse>/leftButton"`; groups are scheme names joined by `;` (`"Keyboard&Mouse;Gamepad"`).
|
||||
|
||||
```
|
||||
input | call CreateAsset("Assets/Input/Player.inputactions", "Player") path, map? (first action map); missing folders are created
|
||||
input | get assets | select $ref name path
|
||||
unity.asset("Assets/Input/Player.inputactions") | call AddControlScheme("Keyboard&Mouse", ["<Keyboard>", "<Mouse>"]) name, requiredDevices?, optionalDevices?, bindingGroup? (default: name)
|
||||
unity.asset("Assets/Input/Player.inputactions") | call AddControlScheme("Gamepad", ["<Gamepad>"])
|
||||
unity.asset("Assets/Input/Player.inputactions") | call AddMap("UI")
|
||||
unity.asset("Assets/Input/Player.inputactions") | get maps | where name == "Player" | call AddAction("Jump") name, type? (Button, Value, PassThrough), expectedControlType?, binding?
|
||||
unity.asset("Assets/Input/Player.inputactions") | get maps | where name == "Player" | call AddAction("Move", "Value", "Vector2")
|
||||
unity.asset("Assets/Input/Player.inputactions") | get actions | where name == "Jump" | call AddBinding("<Keyboard>/space", "Keyboard&Mouse") path, groups?, interactions?, processors?
|
||||
unity.asset("Assets/Input/Player.inputactions") | get actions | where name == "Jump" | call AddBinding("<Gamepad>/buttonSouth", "Gamepad", "hold(duration=0.4)")
|
||||
unity.asset("Assets/Input/Player.inputactions") | get actions | where name == "Move" | call AddComposite("2DVector", {up: "<Keyboard>/w", down: "<Keyboard>/s", left: "<Keyboard>/a", right: "<Keyboard>/d"}, "Keyboard&Mouse") composite, {part: path}, groups?, interactions?, processors?
|
||||
unity.asset("Assets/Input/Player.inputactions") | get actions | where name == "Move" | call AddBinding("<Gamepad>/leftStick", "Gamepad", null, "stickDeadzone")
|
||||
unity.asset("Assets/Input/Player.inputactions") | get maps | select name actionCount
|
||||
unity.asset("Assets/Input/Player.inputactions") | get actions | select map name type expectedControlType interactions bindingCount
|
||||
unity.asset("Assets/Input/Player.inputactions") | get actions | get bindings | select action index path name groups interactions processors isComposite isPartOfComposite
|
||||
unity.asset("Assets/Input/Player.inputactions") | get controlSchemes | select name bindingGroup requiredDevices optionalDevices
|
||||
unity.asset("Assets/Input/Player.inputactions") | get actions | get bindings | where path == "<Gamepad>/buttonSouth" | set path = "<Gamepad>/buttonEast", interactions = "tap"
|
||||
unity.asset("Assets/Input/Player.inputactions") | get actions | get bindings | where isPartOfComposite and name == "up" | set path = "<Keyboard>/upArrow"
|
||||
unity.asset("Assets/Input/Player.inputactions") | get actions | where name == "Jump" | set name = "Leap", type = "PassThrough", interactions = "press"
|
||||
unity.asset("Assets/Input/Player.inputactions") | get actions | where name == "Move" | set processors = "invertVector2", initialStateCheck = true
|
||||
unity.asset("Assets/Input/Player.inputactions") | get controlSchemes | where name == "Keyboard&Mouse" | set requiredDevices = ["<Keyboard>"], optionalDevices = ["<Mouse>"]
|
||||
unity.asset("Assets/Input/Player.inputactions") | get controlSchemes | where name == "Gamepad" | set name = "Controller" also renames the group of its bindings
|
||||
unity.asset("Assets/Input/Player.inputactions") | get maps | where name == "Player" | set name = "Gameplay"
|
||||
unity.asset("Assets/Input/Player.inputactions") | get actions | get bindings | where groups == "Controller" | call Remove() a composite root removes its parts
|
||||
unity.asset("Assets/Input/Player.inputactions") | get actions | where name == "Leap" | call Remove()
|
||||
unity.asset("Assets/Input/Player.inputactions") | get controlSchemes | where name == "Controller" | call Remove()
|
||||
unity.asset("Assets/Input/Player.inputactions") | get maps | where name == "UI" | call Remove()
|
||||
input | select interactions processors registered names; input | get layouts lists device and control layouts
|
||||
```
|
||||
|
||||
Assets referenced by a scene component work the same way: `objects | get components | where $ is PlayerInput | get actions | get maps`.
|
||||
Bindings are addressed by id, so removing some bindings in one query does not shift the others. `call` needs rql-mutate.
|
||||
Created assets are not removed by Undo; undoing an edit rewrites the file.
|
||||
|
||||
## Navigation
|
||||
|
||||
AI Navigation components are components: `objects | get components | where $ is NavMeshSurface` (also NavMeshModifier,
|
||||
NavMeshModifierVolume, NavMeshLink, NavMeshAgent). Add them with AddComponent, then set members (all undoable):
|
||||
|
||||
```
|
||||
objects | where name == "Ground" | call AddComponent("NavMeshSurface")
|
||||
objects | get components | where $ is NavMeshSurface | set collectObjects = "Volume", size = "(20, 5, 20)", center = "(0, 1, 0)"
|
||||
objects | get components | where $ is NavMeshSurface | set agentType = "Humanoid", defaultAreaName = "Walkable", layerMask = ["Default", "Water"]
|
||||
objects | get components | where $ is NavMeshSurface | set overrideVoxelSize = true, voxelSize = 0.1
|
||||
objects | get components | where $ is NavMeshSurface | call Bake() build now (saved scene: NavMesh-<name>.asset next to it)
|
||||
objects | get components | where $ is NavMeshSurface | call Clear() remove the baked data
|
||||
objects | get components | where $ is NavMeshSurface | select gameObject.name agentType navMeshData buildSettings.agentRadius
|
||||
navigation | call BakeAll() every active surface (also ClearAll())
|
||||
```
|
||||
|
||||
Modifiers, volumes, links:
|
||||
|
||||
```
|
||||
objects | where name == "Water" | call AddComponent("NavMeshModifier")
|
||||
objects | get components | where $ is NavMeshModifier | set overrideArea = true, areaName = "Not Walkable"
|
||||
objects | get components | where $ is NavMeshModifier | set ignoreFromBuild = true, applyToChildren = false, affectedAgents = ["All"]
|
||||
objects | where name == "Mud" | call AddComponent("NavMeshModifierVolume")
|
||||
objects | get components | where $ is NavMeshModifierVolume | set size = "(4, 2, 4)", center = "(0, 1, 0)", areaName = "Jump"
|
||||
objects | where name == "Gap" | call AddComponent("NavMeshLink")
|
||||
objects | get components | where $ is NavMeshLink | set startPoint = "(0, 0, -2)", endPoint = "(0, 1, 3)", width = 1, bidirectional = false, costModifier = 2, areaName = "Jump"
|
||||
```
|
||||
|
||||
Agents (`SetDestination` / `Warp` / `ResetPath` act only on an agent on a baked NavMesh, i.e. in Play Mode; they return false otherwise):
|
||||
|
||||
```
|
||||
objects | where name == "Enemy" | call AddComponent("NavMeshAgent")
|
||||
objects | get components | where $ is NavMeshAgent | set speed = 5, acceleration = 12, angularSpeed = 240, stoppingDistance = 0.5
|
||||
objects | get components | where $ is NavMeshAgent | set agentType = "Humanoid", areaNames = ["Walkable", "Jump"] area mask; ["All"] = every area
|
||||
objects | get components | where $ is NavMeshAgent | call SetDestination("(10, 0, 5)")
|
||||
objects | get components | where $ is NavMeshAgent | select gameObject.name isOnNavMesh hasPath remainingDistance
|
||||
```
|
||||
|
||||
Bake settings live on the agent type (shared by every surface baking for it; rebake afterwards); areas name the area indices:
|
||||
|
||||
```
|
||||
navigation | get agentTypes | select agentTypeID name agentRadius agentHeight agentSlope agentClimb
|
||||
navigation | get agentTypes | where name == "Humanoid" | set agentRadius = 0.4, agentHeight = 1.8, agentSlope = 40, agentClimb = 0.5
|
||||
navigation | get areas | where name != "" | select index name cost
|
||||
navigation | get areas | where index == 3 | set name = "Water", cost = 4
|
||||
```
|
||||
|
||||
`agentType`, `areaName` / `defaultAreaName`, `areaNames` and `affectedAgents` are the name views of agentTypeID, area /
|
||||
defaultArea, areaMask and the agent-type list; the numeric members stay writable. A LayerMask reads as its int mask and takes an
|
||||
int (-1 = Everything), a layer name or a list of layer names.
|
||||
|
||||
## Particle systems
|
||||
|
||||
Particle systems are components: `objects | get components | where $ is ParticleSystem`. Module structs (`main`,
|
||||
`emission`, `shape` …) are written through, even though they are get-only properties:
|
||||
|
||||
```
|
||||
objects | get components | where $ is ParticleSystem | set main.startLifetime = 3, main.loop = false
|
||||
objects | get components | where $ is ParticleSystem | set emission.rateOverTime = [5, 25] random between two
|
||||
objects | get components | where $ is ParticleSystem | set main.startColor = "#ff8800"
|
||||
objects | get components | where $ is ParticleSystem | set main.startColor = [["#ff0000", 0], ["#0000ff", 1]] gradient
|
||||
```
|
||||
|
||||
`MinMaxCurve` takes a number or `[min, max]`; `MinMaxGradient` a color, `[color, color]` or gradient keys.
|
||||
Playback in the Editor: `objects | get components | where $ is ParticleSystem | call Play()` (also Pause, Stop, Clear,
|
||||
Simulate(seconds)).
|
||||
|
||||
## ProBuilder
|
||||
|
||||
ProBuilder meshes are components: `probuilder | get meshes` (= `objects | get components | where $ is ProBuilderMesh`). A mesh
|
||||
reads as faceCount vertexCount edgeCount triangleCount, `bounds` (local) / `worldBounds`, `directions` (face indices per local
|
||||
direction), `materials` (slots: index material faceCount) and `faces` (read-only views: index direction center normal
|
||||
submeshIndex material vertices edges); the raw vertex arrays are not members. Edit with `call` (rql-mutate): faces are index lists
|
||||
`[0, 1]`, edges vertex index pairs `[[0, 1], [1, 2]]`. `probuilder.facing($, "Up")`, `probuilder.edges($, faces?)`,
|
||||
`probuilder.openEdges($)` and `probuilder.vertices($, start?, count?)` compute selections (also as call arguments). The receipt's
|
||||
result column holds the created mesh's $ref: `ref("ProBuilderMesh#…") | call Extrude([0], 1)`.
|
||||
|
||||
Create and inspect:
|
||||
|
||||
```
|
||||
probuilder | call CreateShape("Cube", "Crate", "(2, 1, 2)", "(0, 0.5, 0)") type, name?, size?, position?, rotation?, parent?
|
||||
probuilder | call CreateShape("Cube", "Box", null, "(3, 0.5, 0)") types: Cube Stair CurvedStair Prism Cylinder Plane Door Pipe Cone Sprite Arch Sphere Torus
|
||||
probuilder | call CreateShape("Cylinder", "Block", "(1, 2, 1)", "(6, 1, 0)")
|
||||
probuilder | call CreatePolyShape(["(0, 0)", "(4, 0)", "(4, 3)", "(0, 3)"], 0.5, "Floor", "(-6, 0, 0)") points (x, z), height, name?, position?, flipNormals?, parent?
|
||||
probuilder | get meshes | select $ref gameObject.name faceCount vertexCount edgeCount triangleCount bounds.size
|
||||
probuilder | get meshes | where gameObject.name == "Crate" | select directions materials worldBounds.center
|
||||
probuilder | get meshes | where gameObject.name == "Crate" | get faces | select index direction center normal vertexCount submeshIndex material.name
|
||||
probuilder | get meshes | where gameObject.name == "Crate" | get faces | where direction == "Up" | select index center edges
|
||||
probuilder | get meshes | where gameObject.name == "Crate" | select up=(probuilder.facing($, "Up")) edges=(probuilder.edges($, [0])) v=(probuilder.vertices($, 0, 4))
|
||||
```
|
||||
|
||||
Faces (indices shift after DeleteFaces; Extrude appends the new side faces and returns their indices):
|
||||
|
||||
```
|
||||
editor | call CreateMaterial("Assets/Materials/Grass.mat")
|
||||
probuilder | get meshes | where gameObject.name == "Crate" | call SetFaceMaterial(probuilder.facing($, "Up"), "Assets/Materials/Grass.mat") faces, material (path, unity.asset(…) or ref); returns the submesh index
|
||||
probuilder | get meshes | where gameObject.name == "Crate" | get materials | select index material.name faceCount
|
||||
probuilder | get meshes | where gameObject.name == "Crate" | call Extrude(probuilder.facing($, "Up"), 0.5) faces, distance (negative = inward), method? FaceNormal | IndividualFaces | VertexNormal
|
||||
probuilder | get meshes | where gameObject.name == "Crate" | call Extrude(probuilder.facing($, "Forward"), 0.25, "IndividualFaces")
|
||||
probuilder | get meshes | where gameObject.name == "Crate" | call FlipNormals([0]) faces? (every face when omitted)
|
||||
probuilder | get meshes | where gameObject.name == "Box" | call DeleteFaces(probuilder.facing($, "Up")) at least one face must remain
|
||||
probuilder | get meshes | where gameObject.name == "Box" | select open=(probuilder.openEdges($))
|
||||
probuilder | get meshes | where gameObject.name == "Box" | call Bridge(probuilder.openEdges($)[0], probuilder.openEdges($)[2]) two open edges [a, b], allowNonManifold?; returns the new face index
|
||||
```
|
||||
|
||||
Edges, pivot, merge:
|
||||
|
||||
```
|
||||
probuilder | get meshes | where gameObject.name == "Block" | call Bevel(probuilder.edges($, probuilder.facing($, "Down")), 0.1) edges, amount 0 … 1 (exclusive); returns the new face indices
|
||||
probuilder | get meshes | where gameObject.name == "Block" | call SubdivideEdges(probuilder.edges($, [0]), 1) edges, subdivisions (1 = split in half); returns the vertices added
|
||||
probuilder | get meshes | where gameObject.name == "Block" | call ConnectEdges(probuilder.edges($, [1])) at least 2 edges sharing faces; returns the new face indices
|
||||
probuilder | get meshes | where gameObject.name == "Floor" | call SetPivot("Center") "Center" (bounds) or "FirstVertex"; the geometry stays in place
|
||||
probuilder | get meshes | where gameObject.name == "Floor" | call SetPivotAt("(-6, 0, 0)") a world position
|
||||
probuilder | call Merge([meshes.first(gameObject.name == "Crate"), meshes.first(gameObject.name == "Box")]) refs to meshes or GameObjects (first = target), deleteSources? (default true)
|
||||
```
|
||||
|
||||
Directions are in the mesh's local space (normal within 45° of the axis; the rest is Other). Invalid indices, edges that are not
|
||||
edges of the mesh, amounts outside the range and deleting every face fail without changing anything. Every call is undoable
|
||||
(the mesh is rebuilt after Undo / Redo); a created material asset stays.
|
||||
|
||||
## Splines
|
||||
|
||||
A `SplineContainer` component holds splines; `splines[i]` has `closed`, `knotCount`, `length` (world units) and
|
||||
`knots[j]` with writable `position` (container-local), `worldPosition`, `tangentIn`, `tangentOut`, `eulerAngles`,
|
||||
`tangentMode` (AutoSmooth, Linear, Mirrored, Continuous, Broken) and `tension`. The `splines` source lists every
|
||||
container (`splines | get containers`) and creates new ones. Writes and calls are undoable. `rql-schema "SplineContainer"`
|
||||
lists the methods; `… | get splines | get knots | first 1 | describe` lists the knot members.
|
||||
|
||||
```
|
||||
splines | call CreateContainer("Road") new GameObject + SplineContainer (one empty spline)
|
||||
splines | call CreateContainer("Loop", "(0, 0, 5)", "(0, 90, 0)", true) name, position, eulerAngles, closed
|
||||
splines | get containers | select gameObject.name n=(splines.count()) splines.knotCount
|
||||
objects | get components | where $ is SplineContainer | where gameObject.name == "Road" | call AddKnots(["(0, 0, 0)", "(5, 0, 2)", "(10, 0, 0)"]) append several knots to spline 0
|
||||
objects | get components | where $ is SplineContainer | where gameObject.name == "Road" | call AddKnot("(15, 0, 3)") append one knot to spline 0
|
||||
objects | get components | where $ is SplineContainer | where gameObject.name == "Road" | call AddSpline() returns the new spline index
|
||||
objects | get components | where $ is SplineContainer | where gameObject.name == "Road" | call AddKnot(1, "(0, 2, 0)") append to spline 1
|
||||
objects | get components | where $ is SplineContainer | where gameObject.name == "Road" | call InsertKnot(1, "(2, 0, 1)") insert at knot index 1 (InsertKnot(spline, knot, position) for others)
|
||||
objects | get components | where $ is SplineContainer | where gameObject.name == "Road" | call RemoveKnot(0) RemoveKnot(spline, knot) for other splines
|
||||
objects | get components | where $ is SplineContainer | where gameObject.name == "Road" | call Evaluate(0.5) point at t: position (world) localPosition tangent up
|
||||
objects | get components | where $ is SplineContainer | where gameObject.name == "Road" | get splines | get knots | select index position tangentMode
|
||||
objects | get components | where $ is SplineContainer | where gameObject.name == "Road" | set splines[0].knots[2].position = "(10, 1, 0)" move a knot (container-local)
|
||||
objects | get components | where $ is SplineContainer | where gameObject.name == "Road" | set splines[0].knots[0].tangentMode = "Linear"
|
||||
objects | get components | where $ is SplineContainer | where gameObject.name == "Road" | get splines | get knots | set tangentMode = "AutoSmooth" every knot of every spline
|
||||
objects | get components | where $ is SplineContainer | where gameObject.name == "Road" | set splines[0].closed = true
|
||||
objects | get components | where $ is SplineContainer | where gameObject.name == "Road" | call RemoveSpline(1)
|
||||
```
|
||||
|
||||
Knot methods take an optional leading spline index (`AddKnot(position)` = spline 0, `AddKnot(1, position)` = spline 1);
|
||||
new knots are AutoSmooth. Writing a tangent of an AutoSmooth / Linear knot switches it to Broken so the value sticks.
|
||||
Evaluate needs rql-mutate (it is a call); its result column holds the sample. Unity.Mathematics `float2` / `float3` /
|
||||
`float4` / `quaternion` values print and are written like vectors: `"(1, 2, 3)"`; a quaternion also accepts euler
|
||||
degrees `"(0, 90, 0)"`.
|
||||
|
||||
## Terrain
|
||||
|
||||
Terrains are components: `objects | get components | where $ is Terrain`. Settings are members of the Terrain, the data
|
||||
(size, resolutions, layers, prototypes) lives in its `terrainData`. Heights are normalized 0 … 1 (fraction of
|
||||
`terrainData.size.y`); heightmap / alphamap cells are `x` along world X and `y` along world Z.
|
||||
|
||||
```
|
||||
objects | get components | where $ is Terrain | select $ref gameObject.name terrainData.size terrainData.heightmapResolution terrainData.terrainLayers.name
|
||||
terrain | call Create("Island", "Assets/Terrain/Island.asset", 257, "(500, 120, 500)", "(0, 0, 0)") name, dataPath, heightmapResolution, size, position
|
||||
objects | get components | where $ is Terrain | set terrainData.size = "(800, 200, 800)"
|
||||
objects | get components | where $ is Terrain | set terrainData.heightmapResolution = 513, terrainData.alphamapResolution = 512
|
||||
objects | get components | where $ is Terrain | set heightmapPixelError = 2, drawTreesAndFoliage = false, materialTemplate = unity.asset("Assets/Mats/Terrain.mat")
|
||||
```
|
||||
|
||||
Heights (`call` needs rql-mutate; sampling functions work in rql-query):
|
||||
|
||||
```
|
||||
objects | get components | where $ is Terrain | call SetHeights(0.25) flatten everything to 25 %
|
||||
objects | get components | where $ is Terrain | call SetHeights(0.6, 100, 100, 32, 32) height, x, y, w, h (w / h 0 = to the edge)
|
||||
objects | get components | where $ is Terrain | call SetHeightGrid([[0.1, 0.2], [0.3, 0.4]], 10, 20) explicit rows (row = y) starting at cell (10, 20)
|
||||
objects | get components | where $ is Terrain | select h=(terrain.heights($, 10, 20, 2, 2)) normalized rows, at most 20 × 20
|
||||
objects | get components | where $ is Terrain | select s=(terrain.heightStats($)) {min, max, average, cells}; region: ($, x, y, w, h)
|
||||
objects | get components | where $ is Terrain | select y=(terrain.heightAt($, 250, 250)) world surface Y at world X / Z
|
||||
```
|
||||
|
||||
Layers (textures), trees and details:
|
||||
|
||||
```
|
||||
terrain | call CreateLayer("Assets/Terrain/Grass.terrainlayer", unity.asset("Assets/Textures/grass.png"), "(10, 10)")
|
||||
objects | get components | where $ is Terrain | call AddLayer(unity.asset("Assets/Terrain/Grass.terrainlayer")) returns the layer index
|
||||
objects | get components | where $ is Terrain | call PaintLayer(1, 1.0, 0, 0, 64, 64) layer, strength, x, y, w, h on the alphamap
|
||||
objects | get components | where $ is Terrain | call RemoveLayer(0)
|
||||
objects | get components | where $ is Terrain | set terrainData.terrainLayers[0].tileSize = "(20, 20)"
|
||||
objects | get components | where $ is Terrain | call AddTreePrototype(unity.asset("Assets/Trees/Oak.prefab")) returns the prototype index
|
||||
objects | get components | where $ is Terrain | call PlaceTrees(0, 200, 0.1, 0.1, 0.5, 0.5) prototype, count, minX, minZ, maxX, maxZ (normalized), heightScale?, widthScale?
|
||||
objects | get components | where $ is Terrain | call PlaceTreesAt(["(0.5, 0.5)", "(0.25, 0.75)"], 0) normalized (x, z) positions, prototype
|
||||
objects | get components | where $ is Terrain | call ClearTrees()
|
||||
objects | get components | where $ is Terrain | select terrainData.treeInstanceCount terrainData.treePrototypes.prefab
|
||||
objects | get components | where $ is Terrain | set terrainData.treePrototypes[0] = {prefab: unity.asset("Assets/Trees/Oak.prefab"), bendFactor: 0.3} prototypes are replaced whole
|
||||
objects | get components | where $ is Terrain | set terrainData.treeInstances[0].heightScale = 2
|
||||
objects | get components | where $ is Terrain | call AddDetailPrototype(unity.asset("Assets/Textures/grass_blade.png")) texture = grass billboard, prefab = detail mesh
|
||||
objects | get components | where $ is Terrain | get terrainData | call SetDetailResolution(1024, 32)
|
||||
objects | get components | where $ is Terrain | where gameObject.name == "Center" | call SetNeighbors(ref("Terrain#…"), null, ref("Terrain#…"), null) left, top, right, bottom
|
||||
```
|
||||
|
||||
`terrainData.treeInstances` is read only when named (`select terrainData.treeInstances[0]`). Tree / detail prototype
|
||||
members are read-only (TerrainData returns copies): replace the element with an object literal. Invalid resolutions, regions
|
||||
outside the map and out-of-range indices fail without changing anything. Heights, paint, layers and trees are undoable;
|
||||
created assets (TerrainData, TerrainLayer) are not removed by Undo. Neighbors are not saved with the scene (Unity
|
||||
reconnects terrains with `allowAutoConnect` and the same `groupingID`).
|
||||
|
||||
## Tilemap
|
||||
|
||||
Tilemaps are components on children of a `Grid`: `objects | get components | where $ is Tilemap`. Cells are `"(x, y, z)"` (z = 0 for 2D);
|
||||
tile arguments take an asset path (`"Assets/Tiles/Grass.asset"`), a ref or `unity.asset(…)`; sprite arguments also take
|
||||
the texture (`unity.asset("Assets/Art/grass.png")`), its path or `"Assets/Art/sheet.png#grass_3"` (one sprite of a sheet).
|
||||
|
||||
```
|
||||
objects | get components | where $ is Tilemap | select $ref gameObject.name tileCount usedTiles cellBounds orientation
|
||||
tilemap | call CreateTilemap("Ground") name, parent?, cellSize?, gridName? (new Grid + Tilemap)
|
||||
tilemap | call CreateTilemap("Walls", ref("GameObject#…")) parent with a Grid: another layer of that Grid
|
||||
tilemap | call CreateTile("Assets/Tiles/Grass.asset", "Assets/Art/grass.png", "#FFFFFF", "Grid") path, sprite?, color?, colliderType?
|
||||
tilemap | call CreateRuleTile("Assets/Tiles/Ground.asset", "Assets/Art/ground.png#ground_4") path, defaultSprite?, colliderType?
|
||||
```
|
||||
|
||||
Painting (`call` needs rql-mutate; undoable):
|
||||
|
||||
```
|
||||
objects | get components | where $ is Tilemap | where gameObject.name == "Ground" | call SetTile("(0, 0, 0)", "Assets/Tiles/Grass.asset")
|
||||
objects | get components | where $ is Tilemap | call SetTile("(3, 1, 0)", null) erase one cell
|
||||
objects | get components | where $ is Tilemap | call SetTiles(["(0, 0, 0)", "(1, 0, 0)", "(2, 0, 0)"], "Assets/Tiles/Grass.asset")
|
||||
objects | get components | where $ is Tilemap | call BoxFill("Assets/Tiles/Grass.asset", -5, -3, 5, 3) tile, minX, minY, maxX, maxY, z? (corners inclusive)
|
||||
objects | get components | where $ is Tilemap | call ClearBox(0, 0, 2, 2) returns how many tiles were removed
|
||||
objects | get components | where $ is Tilemap | call FloodFill("(1, 1, 0)", "Assets/Tiles/Water.asset")
|
||||
objects | get components | where $ is Tilemap | call ClearAllTiles()
|
||||
objects | get components | where $ is Tilemap | call SetColor("(0, 0, 0)", "#FF8080") tint one painted cell
|
||||
objects | get components | where $ is Tilemap | call SetTransform("(0, 0, 0)", 90, "(1, 1, 1)", true, false) rotation°, scale?, flipX?, flipY?
|
||||
objects | get components | where $ is Tilemap | call SetColliderType("(0, 0, 0)", "None") None / Sprite / Grid
|
||||
objects | get components | where $ is Tilemap | set orientation = "XZ", tileAnchor = "(0.5, 0.5, 0)", color = "(1, 1, 1, 0.5)"
|
||||
objects | get components | where $ is Tilemap | call CompressBounds() shrink cellBounds to the painted cells
|
||||
objects | get components | where $ is Grid | set cellSize = "(1, 0.5, 0)", cellLayout = "Isometric"
|
||||
objects | get components | where $ is TilemapRenderer | set sortingOrder = 2, mode = "Individual"
|
||||
```
|
||||
|
||||
Reading cells (functions work in rql-query):
|
||||
|
||||
```
|
||||
objects | get components | where $ is Tilemap | select t=(tilemap.tileAt($, "(0, 0, 0)")) the tile asset or null
|
||||
objects | get components | where $ is Tilemap | select c=(tilemap.cell($, "(0, 0, 0)")) {cell, tile, path, sprite, color, colliderType, flags, transform}
|
||||
objects | get components | where $ is Tilemap | select rows=(tilemap.tiles($, 0, 0, 9, 9)) tile names, top row (maxY) first, at most 20 × 20
|
||||
objects | get components | where $ is Tilemap | select n=(tilemap.count($, "Grass")) occupied cells of a tile (name, path or asset); region: ($, tile, minX, minY, maxX, maxY)
|
||||
objects | get components | where $ is Tilemap | select cells=(tilemap.cells($, "Assets/Tiles/Grass.asset")) first 20 cells holding that tile
|
||||
objects | get components | where $ is Tilemap | select c=(tilemap.worldToCell($, "(2.5, 1.2, 0)")) w=(tilemap.cellToWorld($, "(2, 1, 0)"))
|
||||
```
|
||||
|
||||
Tile assets are ordinary objects: `unity.assets("t:TileBase") | select $ref name`,
|
||||
`unity.asset("Assets/Tiles/Grass.asset") | set sprite = "Assets/Art/grass2.png", colliderType = "Grid"`. RuleTile rules:
|
||||
|
||||
```
|
||||
unity.asset("Assets/Tiles/Ground.asset") | call AddRule("Assets/Art/ground.png#ground_1", "NNN/T.T/TTT") sprite, pattern, colliderType?
|
||||
unity.asset("Assets/Tiles/Ground.asset") | call ClearRules()
|
||||
objects | get components | where $ is Tilemap | call RefreshAllTiles() repaint after editing rules
|
||||
```
|
||||
|
||||
A pattern lists the 8 neighbors in rows top to bottom (center ignored): `T` = this tile, `N` = not this tile, `.` = any;
|
||||
rules are checked in order and the first match wins (`"..."` = always). Methods on empty cells (SetColor, SetTransform,
|
||||
SetColliderType), regions over 1 048 576 cells and bad paths fail without changing anything. `cellBounds.max` is exclusive.
|
||||
Created assets are not removed by Undo.
|
||||
|
||||
## Timeline
|
||||
|
||||
A TimelineAsset (`.playable`) holds tracks; tracks hold clips and markers; a scene `PlayableDirector` plays it and binds
|
||||
each track to a scene object. Times are seconds. Find timelines with `unity.assets("t:TimelineAsset")`.
|
||||
|
||||
```
|
||||
unity.assets("t:TimelineAsset") | select $ref name duration frameRate tracks.name
|
||||
unity.asset("Assets/Cutscenes/Intro.playable") | get tracks | select $ref name $type bindingType muted clips.count() markers.count()
|
||||
unity.asset("Assets/Cutscenes/Intro.playable") | get tracks | recurse children | select $depth name $type groups and their sub-tracks
|
||||
unity.asset("Assets/Cutscenes/Intro.playable") | get tracks | get clips | select track.name displayName start duration end asset.name
|
||||
timeline | call Create("Assets/Cutscenes/Intro.playable", 30) path, frameRate?, fixedDuration? (> 0 = FixedLength)
|
||||
unity.asset("Assets/Cutscenes/Intro.playable") | set frameRate = 24, durationMode = "FixedLength", fixedDuration = 12
|
||||
```
|
||||
|
||||
Tracks (type: Animation, Activation, Audio, Signal, Control, Playable, Group or a TrackAsset type name):
|
||||
|
||||
```
|
||||
unity.asset("Assets/Cutscenes/Intro.playable") | call AddTrack("Animation", "Hero") type, name?, group? — returns the track
|
||||
unity.asset("Assets/Cutscenes/Intro.playable") | call AddTrack("Group", "Crowd")
|
||||
unity.asset("Assets/Cutscenes/Intro.playable") | call AddTrack("Activation", "Door", "Crowd") nested in the GroupTrack named Crowd
|
||||
unity.asset("Assets/Cutscenes/Intro.playable") | get tracks | where name == "Hero" | set muted = true, locked = false, name = "Hero Anim"
|
||||
unity.asset("Assets/Cutscenes/Intro.playable") | get tracks | where name == "Door" | call Delete() with its clips, markers and sub-tracks
|
||||
```
|
||||
|
||||
Clips (AnimationTrack: an AnimationClip, AudioTrack: an AudioClip, other tracks: a default clip with asset null):
|
||||
|
||||
```
|
||||
unity.asset("Assets/Cutscenes/Intro.playable") | get tracks | where name == "Hero" | call AddClip(unity.asset("Assets/Anim/Walk.anim"), 2, 3, "Walk") asset?, start?, duration?, name?
|
||||
unity.asset("Assets/Cutscenes/Intro.playable") | get tracks | where name == "Door" | call AddClip(null, 0, 1.5)
|
||||
unity.asset("Assets/Cutscenes/Intro.playable") | get tracks | get clips | where displayName == "Walk" | set start = start + 0.5 move (duration kept)
|
||||
unity.asset("Assets/Cutscenes/Intro.playable") | get tracks | get clips | where displayName == "Walk" | set duration = 4, clipIn = 0.25, timeScale = 1.5, easeInDuration = 0.5, easeOutDuration = 0.3
|
||||
unity.asset("Assets/Cutscenes/Intro.playable") | get tracks | get clips | where displayName == "Walk" | set asset.removeStartOffset = false the clip's PlayableAsset
|
||||
unity.asset("Assets/Cutscenes/Intro.playable") | get tracks | get clips | where end > 10 | call Delete()
|
||||
```
|
||||
|
||||
Markers and signals:
|
||||
|
||||
```
|
||||
timeline | call CreateSignal("Assets/Cutscenes/Boom.signal")
|
||||
unity.asset("Assets/Cutscenes/Intro.playable") | call AddMarker(3.5) SignalEmitter on the timeline marker track
|
||||
unity.asset("Assets/Cutscenes/Intro.playable") | get tracks | where $type == "SignalTrack" | call AddMarker(1, "Signal")
|
||||
unity.asset("Assets/Cutscenes/Intro.playable") | get markers | set asset = unity.asset("Assets/Cutscenes/Boom.signal"), time = 4
|
||||
unity.asset("Assets/Cutscenes/Intro.playable") | get tracks | get markers | where time > 8 | call Delete()
|
||||
```
|
||||
|
||||
Director and bindings (a GameObject is narrowed to the component the track drives, e.g. its Animator):
|
||||
|
||||
```
|
||||
objects | where name == "Cutscene" | call AddComponent("PlayableDirector")
|
||||
objects | get components | where $ is PlayableDirector | where gameObject.name == "Cutscene" | set playableAsset = unity.asset("Assets/Cutscenes/Intro.playable"), playOnAwake = false
|
||||
objects | get components | where $ is PlayableDirector | select gameObject.name playableAsset.name bindings
|
||||
objects | get components | where $ is PlayableDirector | set bindings["Hero"] = ref("GameObject#…"), bindings["Door"] = null
|
||||
```
|
||||
|
||||
Crossfades (blendInDuration / blendOutDuration, read-only) come from overlapping clips: move a clip's start into its neighbour.
|
||||
Invalid values (negative times, eases longer than the clip, a time scale on clips that cannot change speed, a clip asset that does not fit the track, unknown track names)
|
||||
fail without changing anything; Timeline does not clamp them silently here. Creating, deleting and editing tracks, clips,
|
||||
markers and bindings is undoable; created asset files stay. rql-mutate saves the edited .playable.
|
||||
Clips have no $ref: address them through their timeline (`… | get tracks | get clips | where …`).
|
||||
|
||||
## Installed RQL modules
|
||||
|
||||
- `com.IvanMurzak.Unity.MCP.Editor.Rql.Modules.UnityCoreModule`
|
||||
- `com.IvanMurzak.Unity.MCP.Editor.Rql.ToolTypesModule`
|
||||
- `com.IvanMurzak.Unity.MCP.Editor.Rql.Mathematics.MathematicsModule`
|
||||
- `com.IvanMurzak.Unity.MCP.Editor.Rql.Animation.AnimationModule`
|
||||
- `com.IvanMurzak.Unity.MCP.Editor.Rql.Cinemachine.CinemachineModule`
|
||||
- `com.IvanMurzak.Unity.MCP.Editor.Rql.InputSystem.InputSystemModule`
|
||||
- `com.IvanMurzak.Unity.MCP.Editor.Rql.Navigation.NavigationModule`
|
||||
- `com.IvanMurzak.Unity.MCP.Editor.Rql.Particles.ParticleSystemModule`
|
||||
- `com.IvanMurzak.Unity.MCP.Editor.Rql.Physics3D.PhysicsModule`
|
||||
- `com.IvanMurzak.Unity.MCP.Editor.Rql.ProBuilder.ProBuilderModule`
|
||||
- `com.IvanMurzak.Unity.MCP.Editor.Rql.Splines.SplinesModule`
|
||||
- `com.IvanMurzak.Unity.MCP.Editor.Rql.Terrains.TerrainModule`
|
||||
- `com.IvanMurzak.Unity.MCP.Editor.Rql.Tilemaps.TilemapModule`
|
||||
- `com.IvanMurzak.Unity.MCP.Editor.Rql.Timelines.TimelineModule`
|
||||
@@ -179,7 +179,7 @@ Read the /unity-initial-setup skill for detailed installation instructions.
|
||||
| Name | Type | Required | Description |
|
||||
|------|------|----------|-------------|
|
||||
| `path` | `string` | Yes | Path for the C# (.cs) file to be created. Sample: "Assets/Skills/MySkill.cs".
|
||||
CRITICAL — Assembly Definition placement: If the project uses Assembly Definition files (.asmdef), you MUST place the script inside a folder that belongs to an assembly definition which already references all required dependencies (e.g. com.IvanMurzak.McpPlugin, UnityEditor, UnityEngine). Placing the file in the wrong assembly will cause compile errors due to missing type references. Before choosing a path, inspect existing .asmdef files with the assets-find tool to identify the correct assembly folder. |
|
||||
CRITICAL — Assembly Definition placement: If the project uses Assembly Definition files (.asmdef), you MUST place the script inside a folder that belongs to an assembly definition which already references all required dependencies (e.g. com.IvanMurzak.McpPlugin, UnityEditor, UnityEngine). Placing the file in the wrong assembly will cause compile errors due to missing type references. Before choosing a path, inspect existing .asmdef files with the rql-query tool (e.g. unity.assets("t:AssemblyDefinitionAsset")) to identify the correct assembly folder. |
|
||||
| `code` | `string` | Yes | C# code for the skill tool. |
|
||||
|
||||
### Input JSON Schema
|
||||
|
||||
@@ -24,7 +24,7 @@ Iterates `UnityMcpPluginEditor.Instance.Tools.GetAllTools()`, evaluates the filt
|
||||
```bash
|
||||
unity-mcp-cli run-tool unity-tool-list --input '{
|
||||
"regexSearch": "string_value",
|
||||
"includeDescription": "string_value",
|
||||
"includeDescription": false,
|
||||
"includeInputs": "string_value"
|
||||
}'
|
||||
```
|
||||
@@ -52,8 +52,8 @@ Read the /unity-initial-setup skill for detailed installation instructions.
|
||||
| Name | Type | Required | Description |
|
||||
|------|------|----------|-------------|
|
||||
| `regexSearch` | `string` | No | Regex pattern to filter tools. Matches against tool name, description, and argument names and descriptions. |
|
||||
| `includeDescription` | `any` | No | Include tool descriptions in the result. Default: false |
|
||||
| `includeInputs` | `any` | No | Include input arguments in the result. Default: None |
|
||||
| `includeDescription` | `boolean` | No | Include tool descriptions in the result. Default: false |
|
||||
| `includeInputs` | `string` | No | Include input arguments in the result. Default: None |
|
||||
|
||||
### Input JSON Schema
|
||||
|
||||
@@ -65,24 +65,15 @@ Read the /unity-initial-setup skill for detailed installation instructions.
|
||||
"type": "string"
|
||||
},
|
||||
"includeDescription": {
|
||||
"$ref": "#/$defs/System.Boolean"
|
||||
},
|
||||
"includeInputs": {
|
||||
"$ref": "#/$defs/com.IvanMurzak.Unity.MCP.Editor.API.Tool_Tool-InputRequest"
|
||||
}
|
||||
},
|
||||
"$defs": {
|
||||
"System.Boolean": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"com.IvanMurzak.Unity.MCP.Editor.API.Tool_Tool-InputRequest": {
|
||||
"includeInputs": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"None",
|
||||
"Inputs",
|
||||
"InputsWithDescription"
|
||||
],
|
||||
"description": "Specifies what to include for tool input arguments."
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -90,67 +81,5 @@ Read the /unity-initial-setup skill for detailed installation instructions.
|
||||
|
||||
## Output
|
||||
|
||||
### Output JSON Schema
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"result": {
|
||||
"$ref": "#/$defs/AIGD.ToolInfoData-1"
|
||||
}
|
||||
},
|
||||
"$defs": {
|
||||
"AIGD.ToolInfoData": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Tool name."
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"description": "Tool description."
|
||||
},
|
||||
"inputs": {
|
||||
"$ref": "#/$defs/AIGD.ToolInputData-1",
|
||||
"description": "Tool input arguments."
|
||||
}
|
||||
},
|
||||
"description": "MCP tool information."
|
||||
},
|
||||
"AIGD.ToolInputData-1": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/$defs/AIGD.ToolInputData",
|
||||
"description": "MCP tool input argument."
|
||||
}
|
||||
},
|
||||
"AIGD.ToolInputData": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Argument name."
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"description": "Argument description."
|
||||
}
|
||||
},
|
||||
"description": "MCP tool input argument."
|
||||
},
|
||||
"AIGD.ToolInfoData-1": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/$defs/AIGD.ToolInfoData",
|
||||
"description": "MCP tool information."
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"result"
|
||||
]
|
||||
}
|
||||
```
|
||||
This tool does not return structured output.
|
||||
|
||||
+7
-7
@@ -115,11 +115,11 @@ Material:
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _DstBlendAlpha: 0
|
||||
- _EchoOpacity1: 0.5927114
|
||||
- _EchoOpacity2: 0
|
||||
- _EchoOpacity1: 0
|
||||
- _EchoOpacity2: 0.3193835
|
||||
- _EchoOpacity3: 0
|
||||
- _EchoRadius1: 5.386
|
||||
- _EchoRadius2: 0
|
||||
- _EchoRadius1: 0
|
||||
- _EchoRadius2: 4.493115
|
||||
- _EchoRadius3: 0
|
||||
- _EnvironmentReflections: 1
|
||||
- _FresnelPower: 2.5
|
||||
@@ -162,9 +162,9 @@ Material:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EchoColor: {r: 4, g: 3.026, b: 1.049, a: 1}
|
||||
- _EchoCoreColor: {r: 7.5, g: 5.5, b: 2.2, a: 1}
|
||||
- _EchoPosition1: {r: -43.056625, g: -0.029093798, b: 23.00288, a: 1}
|
||||
- _EchoPosition2: {r: -40.5, g: -0.027898155, b: -6, a: 1}
|
||||
- _EchoPosition3: {r: -35.5, g: -0.027898155, b: -14, a: 1}
|
||||
- _EchoPosition1: {r: -37.285122, g: 0.12999992, b: -36.339718, a: 1}
|
||||
- _EchoPosition2: {r: -36.50726, g: 0.12999992, b: -36.424538, a: 1}
|
||||
- _EchoPosition3: {r: -37.424873, g: 0.13000004, b: -36.465725, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
- _WaveCenter: {r: 0, g: 0, b: 0, a: 0}
|
||||
|
||||
+7
-7
@@ -99,11 +99,11 @@ Material:
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _DstBlendAlpha: 0
|
||||
- _EchoOpacity1: 0.5927114
|
||||
- _EchoOpacity2: 0
|
||||
- _EchoOpacity1: 0
|
||||
- _EchoOpacity2: 0.3193835
|
||||
- _EchoOpacity3: 0
|
||||
- _EchoRadius1: 5.386
|
||||
- _EchoRadius2: 0
|
||||
- _EchoRadius1: 0
|
||||
- _EchoRadius2: 4.493115
|
||||
- _EchoRadius3: 0
|
||||
- _EnvironmentReflections: 1
|
||||
- _FresnelPower: 2.5
|
||||
@@ -144,9 +144,9 @@ Material:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EchoColor: {r: 4, g: 3.026, b: 1.049, a: 1}
|
||||
- _EchoCoreColor: {r: 7.5, g: 5.5, b: 2.2, a: 1}
|
||||
- _EchoPosition1: {r: -43.056625, g: -0.029093798, b: 23.00288, a: 1}
|
||||
- _EchoPosition2: {r: -40.5, g: -0.027898155, b: -6, a: 1}
|
||||
- _EchoPosition3: {r: -35.5, g: -0.027898155, b: -14, a: 1}
|
||||
- _EchoPosition1: {r: -37.285122, g: 0.12999992, b: -36.339718, a: 1}
|
||||
- _EchoPosition2: {r: -36.50726, g: 0.12999992, b: -36.424538, a: 1}
|
||||
- _EchoPosition3: {r: -37.424873, g: 0.13000004, b: -36.465725, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
- _WaveCenter: {r: 0, g: 0, b: 0, a: 0}
|
||||
|
||||
+7
-7
@@ -100,11 +100,11 @@ Material:
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _DstBlendAlpha: 0
|
||||
- _EchoOpacity1: 0.5927114
|
||||
- _EchoOpacity2: 0
|
||||
- _EchoOpacity1: 0
|
||||
- _EchoOpacity2: 0.3193835
|
||||
- _EchoOpacity3: 0
|
||||
- _EchoRadius1: 5.386
|
||||
- _EchoRadius2: 0
|
||||
- _EchoRadius1: 0
|
||||
- _EchoRadius2: 4.493115
|
||||
- _EchoRadius3: 0
|
||||
- _EnvironmentReflections: 1
|
||||
- _FresnelPower: 2.5
|
||||
@@ -147,9 +147,9 @@ Material:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EchoColor: {r: 4, g: 3.026, b: 1.049, a: 1}
|
||||
- _EchoCoreColor: {r: 7.5, g: 5.5, b: 2.2, a: 1}
|
||||
- _EchoPosition1: {r: -43.056625, g: -0.029093798, b: 23.00288, a: 1}
|
||||
- _EchoPosition2: {r: -40.5, g: -0.027898155, b: -6, a: 1}
|
||||
- _EchoPosition3: {r: -35.5, g: -0.027898155, b: -14, a: 1}
|
||||
- _EchoPosition1: {r: -37.285122, g: 0.12999992, b: -36.339718, a: 1}
|
||||
- _EchoPosition2: {r: -36.50726, g: 0.12999992, b: -36.424538, a: 1}
|
||||
- _EchoPosition3: {r: -37.424873, g: 0.13000004, b: -36.465725, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
- _WaveCenter: {r: 0, g: 0, b: 0, a: 0}
|
||||
|
||||
+7
-7
@@ -115,11 +115,11 @@ Material:
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _DstBlendAlpha: 0
|
||||
- _EchoOpacity1: 0.5927114
|
||||
- _EchoOpacity2: 0
|
||||
- _EchoOpacity1: 0
|
||||
- _EchoOpacity2: 0.3193835
|
||||
- _EchoOpacity3: 0
|
||||
- _EchoRadius1: 5.386
|
||||
- _EchoRadius2: 0
|
||||
- _EchoRadius1: 0
|
||||
- _EchoRadius2: 4.493115
|
||||
- _EchoRadius3: 0
|
||||
- _EnvironmentReflections: 1
|
||||
- _FresnelPower: 2.5
|
||||
@@ -162,9 +162,9 @@ Material:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EchoColor: {r: 4, g: 3.026, b: 1.049, a: 1}
|
||||
- _EchoCoreColor: {r: 7.5, g: 5.5, b: 2.2, a: 1}
|
||||
- _EchoPosition1: {r: -43.056625, g: -0.029093798, b: 23.00288, a: 1}
|
||||
- _EchoPosition2: {r: -40.5, g: -0.027898155, b: -6, a: 1}
|
||||
- _EchoPosition3: {r: -35.5, g: -0.027898155, b: -14, a: 1}
|
||||
- _EchoPosition1: {r: -37.285122, g: 0.12999992, b: -36.339718, a: 1}
|
||||
- _EchoPosition2: {r: -36.50726, g: 0.12999992, b: -36.424538, a: 1}
|
||||
- _EchoPosition3: {r: -37.424873, g: 0.13000004, b: -36.465725, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
- _WaveCenter: {r: 0, g: 0, b: 0, a: 0}
|
||||
|
||||
+7
-7
@@ -102,11 +102,11 @@ Material:
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _DstBlendAlpha: 0
|
||||
- _EchoOpacity1: 0.5927114
|
||||
- _EchoOpacity2: 0
|
||||
- _EchoOpacity1: 0
|
||||
- _EchoOpacity2: 0.3193835
|
||||
- _EchoOpacity3: 0
|
||||
- _EchoRadius1: 5.386
|
||||
- _EchoRadius2: 0
|
||||
- _EchoRadius1: 0
|
||||
- _EchoRadius2: 4.493115
|
||||
- _EchoRadius3: 0
|
||||
- _EnvironmentReflections: 1
|
||||
- _FresnelPower: 2.5
|
||||
@@ -149,9 +149,9 @@ Material:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EchoColor: {r: 4, g: 3.026, b: 1.049, a: 1}
|
||||
- _EchoCoreColor: {r: 7.5, g: 5.5, b: 2.2, a: 1}
|
||||
- _EchoPosition1: {r: -43.056625, g: -0.029093798, b: 23.00288, a: 1}
|
||||
- _EchoPosition2: {r: -40.5, g: -0.027898155, b: -6, a: 1}
|
||||
- _EchoPosition3: {r: -35.5, g: -0.027898155, b: -14, a: 1}
|
||||
- _EchoPosition1: {r: -37.285122, g: 0.12999992, b: -36.339718, a: 1}
|
||||
- _EchoPosition2: {r: -36.50726, g: 0.12999992, b: -36.424538, a: 1}
|
||||
- _EchoPosition3: {r: -37.424873, g: 0.13000004, b: -36.465725, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
- _WaveCenter: {r: 0, g: 0, b: 0, a: 0}
|
||||
|
||||
+7
-7
@@ -101,11 +101,11 @@ Material:
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _DstBlendAlpha: 0
|
||||
- _EchoOpacity1: 0.5927114
|
||||
- _EchoOpacity2: 0
|
||||
- _EchoOpacity1: 0
|
||||
- _EchoOpacity2: 0.3193835
|
||||
- _EchoOpacity3: 0
|
||||
- _EchoRadius1: 5.386
|
||||
- _EchoRadius2: 0
|
||||
- _EchoRadius1: 0
|
||||
- _EchoRadius2: 4.493115
|
||||
- _EchoRadius3: 0
|
||||
- _EnvironmentReflections: 1
|
||||
- _FresnelPower: 2.5
|
||||
@@ -148,9 +148,9 @@ Material:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EchoColor: {r: 4, g: 3.026, b: 1.049, a: 1}
|
||||
- _EchoCoreColor: {r: 7.5, g: 5.5, b: 2.2, a: 1}
|
||||
- _EchoPosition1: {r: -43.056625, g: -0.029093798, b: 23.00288, a: 1}
|
||||
- _EchoPosition2: {r: -40.5, g: -0.027898155, b: -6, a: 1}
|
||||
- _EchoPosition3: {r: -35.5, g: -0.027898155, b: -14, a: 1}
|
||||
- _EchoPosition1: {r: -37.285122, g: 0.12999992, b: -36.339718, a: 1}
|
||||
- _EchoPosition2: {r: -36.50726, g: 0.12999992, b: -36.424538, a: 1}
|
||||
- _EchoPosition3: {r: -37.424873, g: 0.13000004, b: -36.465725, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
- _WaveCenter: {r: 0, g: 0, b: 0, a: 0}
|
||||
|
||||
@@ -72,11 +72,11 @@ Material:
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _EchoOpacity1: 0.5927114
|
||||
- _EchoOpacity2: 0
|
||||
- _EchoOpacity1: 0
|
||||
- _EchoOpacity2: 0.3193835
|
||||
- _EchoOpacity3: 0
|
||||
- _EchoRadius1: 5.386
|
||||
- _EchoRadius2: 0
|
||||
- _EchoRadius1: 0
|
||||
- _EchoRadius2: 4.493115
|
||||
- _EchoRadius3: 0
|
||||
- _FresnelPower: 2.5
|
||||
- _FresnelStrength: 0.4
|
||||
@@ -110,9 +110,9 @@ Material:
|
||||
- _Color: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _EchoColor: {r: 4, g: 3.026, b: 1.049, a: 1}
|
||||
- _EchoCoreColor: {r: 7.5, g: 5.5, b: 2.2, a: 1}
|
||||
- _EchoPosition1: {r: -43.056625, g: -0.029093798, b: 23.00288, a: 1}
|
||||
- _EchoPosition2: {r: -40.5, g: -0.027898155, b: -6, a: 1}
|
||||
- _EchoPosition3: {r: -35.5, g: -0.027898155, b: -14, a: 1}
|
||||
- _EchoPosition1: {r: -37.285122, g: 0.12999992, b: -36.339718, a: 1}
|
||||
- _EchoPosition2: {r: -36.50726, g: 0.12999992, b: -36.424538, a: 1}
|
||||
- _EchoPosition3: {r: -37.424873, g: 0.13000004, b: -36.465725, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _WaveCenter: {r: 0, g: 0, b: 0, a: 0}
|
||||
m_BuildTextureStacks: []
|
||||
|
||||
@@ -62,11 +62,11 @@ Material:
|
||||
- _CloudBandWidth: 3.2
|
||||
- _ColorRevealIntensity: 1.6
|
||||
- _ColorRevealSharpness: 1
|
||||
- _EchoOpacity1: 0.5927114
|
||||
- _EchoOpacity2: 0
|
||||
- _EchoOpacity1: 0
|
||||
- _EchoOpacity2: 0.3193835
|
||||
- _EchoOpacity3: 0
|
||||
- _EchoRadius1: 5.386
|
||||
- _EchoRadius2: 0
|
||||
- _EchoRadius1: 0
|
||||
- _EchoRadius2: 4.493115
|
||||
- _EchoRadius3: 0
|
||||
- _FresnelPower: 2.5
|
||||
- _FresnelStrength: 0.4
|
||||
@@ -87,9 +87,9 @@ Material:
|
||||
- _BaseColor: {r: 0.015, g: 0.015, b: 0.02, a: 1}
|
||||
- _EchoColor: {r: 4, g: 3.026, b: 1.049, a: 1}
|
||||
- _EchoCoreColor: {r: 7.5, g: 5.5, b: 2.2, a: 1}
|
||||
- _EchoPosition1: {r: -43.056625, g: -0.029093798, b: 23.00288, a: 1}
|
||||
- _EchoPosition2: {r: -40.5, g: -0.027898155, b: -6, a: 1}
|
||||
- _EchoPosition3: {r: -35.5, g: -0.027898155, b: -14, a: 1}
|
||||
- _EchoPosition1: {r: -37.285122, g: 0.12999992, b: -36.339718, a: 1}
|
||||
- _EchoPosition2: {r: -36.50726, g: 0.12999992, b: -36.424538, a: 1}
|
||||
- _EchoPosition3: {r: -37.424873, g: 0.13000004, b: -36.465725, a: 1}
|
||||
- _WaveCenter: {r: 0, g: 0, b: 0, a: 0}
|
||||
m_BuildTextureStacks: []
|
||||
m_AllowLocking: 1
|
||||
Binary file not shown.
@@ -0,0 +1,81 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
/// Отображает текущий статус найденных цифр кода лифта на игровом экране (HUD).
|
||||
/// Например: "КОД ЛИФТА: [ 7 ] [ ? ] [ 1 ] [ ? ]"
|
||||
/// </summary>
|
||||
public class CodeHUDTracker : MonoBehaviour
|
||||
{
|
||||
private static CodeHUDTracker _instance;
|
||||
public static CodeHUDTracker Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = Object.FindAnyObjectByType<CodeHUDTracker>(FindObjectsInactive.Include);
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
[Header("Слоты для цифр")]
|
||||
[SerializeField] private Text[] digitSlotTexts = new Text[4];
|
||||
[SerializeField] private Image[] digitSlotBorders = new Image[4];
|
||||
|
||||
[Header("Цвета")]
|
||||
public Color discoveredTextColor = new Color(1.0f, 0.85f, 0.1f, 1.0f); // Ярко-золотой
|
||||
public Color undiscoveredTextColor = new Color(0.45f, 0.45f, 0.45f, 0.7f); // Серый
|
||||
public Color discoveredBorderColor = new Color(1.0f, 0.85f, 0.1f, 0.8f);
|
||||
public Color undiscoveredBorderColor = new Color(0.3f, 0.3f, 0.3f, 0.4f);
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_instance = this;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (LevelCodeManager.Instance != null)
|
||||
{
|
||||
LevelCodeManager.Instance.OnDigitDiscovered += HandleDigitDiscovered;
|
||||
}
|
||||
RefreshDisplay();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (LevelCodeManager.Instance != null)
|
||||
{
|
||||
LevelCodeManager.Instance.OnDigitDiscovered -= HandleDigitDiscovered;
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleDigitDiscovered(int pos, int val)
|
||||
{
|
||||
RefreshDisplay();
|
||||
}
|
||||
|
||||
public void RefreshDisplay()
|
||||
{
|
||||
if (LevelCodeManager.Instance == null) return;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
bool isDiscovered = LevelCodeManager.Instance.IsDigitDiscovered(i);
|
||||
int digit = LevelCodeManager.Instance.GetDigit(i);
|
||||
|
||||
if (digitSlotTexts != null && i < digitSlotTexts.Length && digitSlotTexts[i] != null)
|
||||
{
|
||||
digitSlotTexts[i].text = isDiscovered ? digit.ToString() : "?";
|
||||
digitSlotTexts[i].color = isDiscovered ? discoveredTextColor : undiscoveredTextColor;
|
||||
}
|
||||
|
||||
if (digitSlotBorders != null && i < digitSlotBorders.Length && digitSlotBorders[i] != null)
|
||||
{
|
||||
digitSlotBorders[i].color = isDiscovered ? discoveredBorderColor : undiscoveredBorderColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f520b1196771b924287149561be1ad81
|
||||
@@ -226,10 +226,10 @@ public class EchoTrigger : MonoBehaviour
|
||||
|
||||
void HandleManualEchoPulse()
|
||||
{
|
||||
// Возможность выпустить эхолокационный импульс (Space, E, Q или ПКМ)
|
||||
// Возможность выпустить эхолокационный импульс (Space, Q или ПКМ)
|
||||
var keyboard = Keyboard.current;
|
||||
var mouse = Mouse.current;
|
||||
bool pulseKey = (keyboard != null && (keyboard.spaceKey.wasPressedThisFrame || keyboard.eKey.wasPressedThisFrame || keyboard.qKey.wasPressedThisFrame))
|
||||
bool pulseKey = (keyboard != null && (keyboard.spaceKey.wasPressedThisFrame || keyboard.qKey.wasPressedThisFrame))
|
||||
|| (mouse != null && mouse.rightButton.wasPressedThisFrame);
|
||||
|
||||
if (pulseKey)
|
||||
|
||||
@@ -0,0 +1,994 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEngine.UI;
|
||||
using UnityEditor.SceneManagement;
|
||||
|
||||
public static class LevelStoryBuilder
|
||||
{
|
||||
private static Font defaultUiFont;
|
||||
private static Font handwrittenFont;
|
||||
private static Material echoMat;
|
||||
|
||||
[MenuItem("Tools/Build Level Story System (Elevator + Notes)")]
|
||||
public static void Build()
|
||||
{
|
||||
Debug.Log("<color=cyan>=== СБОРКА СЮЖЕТНОЙ СИСТЕМЫ: ЛИФТ И 4 ЗАПИСКИ С КОДОМ ===</color>");
|
||||
|
||||
if (EditorApplication.isPlaying)
|
||||
{
|
||||
Debug.LogError("Нельзя запускать сборку во время Play Mode! Остановите игру.");
|
||||
return;
|
||||
}
|
||||
|
||||
defaultUiFont = Resources.GetBuiltinResource<Font>("LegacyRuntime.ttf");
|
||||
if (defaultUiFont == null) defaultUiFont = Resources.GetBuiltinResource<Font>("Arial.ttf");
|
||||
|
||||
handwrittenFont = AssetDatabase.LoadAssetAtPath<Font>("Assets/Fonts/SegoeScriptBold.ttf");
|
||||
if (handwrittenFont == null) handwrittenFont = AssetDatabase.LoadAssetAtPath<Font>("Assets/Fonts/Inkfree.ttf");
|
||||
if (handwrittenFont == null) handwrittenFont = defaultUiFont;
|
||||
|
||||
echoMat = AssetDatabase.LoadAssetAtPath<Material>("Assets/EchoCloudMat.mat");
|
||||
if (echoMat == null) echoMat = AssetDatabase.LoadAssetAtPath<Material>("Assets/EchoMat.mat");
|
||||
|
||||
// Убеждаемся, что у игрока стоит тег Player
|
||||
var player = GameObject.Find("Player");
|
||||
if (player != null)
|
||||
{
|
||||
player.tag = "Player";
|
||||
EditorUtility.SetDirty(player);
|
||||
}
|
||||
|
||||
// 1. Создаем или находим StoryManager (LevelCodeManager)
|
||||
SetupStoryManager();
|
||||
|
||||
// 2. Создаем 3D-зону лифта и терминал
|
||||
SetupElevatorPlatformAndTerminal();
|
||||
|
||||
// 3. Создаем 4 записки в разных комнатах лаборатории
|
||||
SetupFourStoryNotes();
|
||||
|
||||
// 4. Добавляем в HUD_Canvas весь UI
|
||||
SetupStoryUIInHUDCanvas();
|
||||
|
||||
// Сохраняем сцену
|
||||
EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
|
||||
EditorSceneManager.SaveOpenScenes();
|
||||
|
||||
Debug.Log("<color=green>=== СЮЖЕТНАЯ СИСТЕМА УСПЕШНО СОБРАНА И СОХРАНЕНА! ===</color>");
|
||||
}
|
||||
|
||||
private static void SetupStoryManager()
|
||||
{
|
||||
var existing = Object.FindAnyObjectByType<LevelCodeManager>();
|
||||
if (existing == null)
|
||||
{
|
||||
var go = new GameObject("StoryManager");
|
||||
Undo.RegisterCreatedObjectUndo(go, "Create StoryManager");
|
||||
go.AddComponent<LevelCodeManager>();
|
||||
Debug.Log("<color=yellow>[LevelStoryBuilder] Создан объект StoryManager с LevelCodeManager.</color>");
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetupElevatorPlatformAndTerminal()
|
||||
{
|
||||
var oldElevator = GameObject.Find("Elevator_Level2_Zone");
|
||||
if (oldElevator != null)
|
||||
{
|
||||
Undo.DestroyObjectImmediate(oldElevator);
|
||||
}
|
||||
|
||||
GameObject elevatorRoot = new GameObject("Elevator_Level2_Zone");
|
||||
Undo.RegisterCreatedObjectUndo(elevatorRoot, "Create Elevator_Level2_Zone");
|
||||
elevatorRoot.transform.position = new Vector3(0f, 0f, 45f);
|
||||
|
||||
// 1. Платформа лифта (6x6м на полу)
|
||||
GameObject platform = GameObject.CreatePrimitive(PrimitiveType.Cube);
|
||||
platform.name = "Elevator_Platform";
|
||||
platform.transform.SetParent(elevatorRoot.transform);
|
||||
platform.transform.localPosition = new Vector3(0f, 0.05f, 0f);
|
||||
platform.transform.localScale = new Vector3(6f, 0.1f, 6f);
|
||||
if (echoMat != null) platform.GetComponent<MeshRenderer>().sharedMaterial = echoMat;
|
||||
|
||||
CreateElevatorFrame(elevatorRoot.transform);
|
||||
|
||||
// 2. Стойка терминала управления лифтом
|
||||
GameObject console = new GameObject("Elevator_Terminal_Console");
|
||||
console.transform.SetParent(elevatorRoot.transform);
|
||||
console.transform.localPosition = new Vector3(1.8f, 0f, -2.2f);
|
||||
console.transform.localRotation = Quaternion.Euler(0f, -35f, 0f);
|
||||
|
||||
GameObject stand = GameObject.CreatePrimitive(PrimitiveType.Cylinder);
|
||||
stand.name = "Stand";
|
||||
stand.transform.SetParent(console.transform);
|
||||
stand.transform.localPosition = new Vector3(0f, 0.55f, 0f);
|
||||
stand.transform.localScale = new Vector3(0.2f, 0.55f, 0.2f);
|
||||
if (echoMat != null) stand.GetComponent<MeshRenderer>().sharedMaterial = echoMat;
|
||||
|
||||
GameObject screenBox = GameObject.CreatePrimitive(PrimitiveType.Cube);
|
||||
screenBox.name = "ScreenBox";
|
||||
screenBox.transform.SetParent(console.transform);
|
||||
screenBox.transform.localPosition = new Vector3(0f, 1.15f, 0f);
|
||||
screenBox.transform.localRotation = Quaternion.Euler(30f, 0f, 0f);
|
||||
screenBox.transform.localScale = new Vector3(0.7f, 0.45f, 0.12f);
|
||||
if (echoMat != null) screenBox.GetComponent<MeshRenderer>().sharedMaterial = echoMat;
|
||||
|
||||
GameObject lightGo = new GameObject("Terminal_StatusLight");
|
||||
lightGo.transform.SetParent(console.transform);
|
||||
lightGo.transform.localPosition = new Vector3(0f, 1.45f, 0f);
|
||||
Light statusLight = lightGo.AddComponent<Light>();
|
||||
statusLight.type = LightType.Point;
|
||||
statusLight.color = new Color(1f, 0.85f, 0.1f);
|
||||
statusLight.intensity = 2.5f;
|
||||
statusLight.range = 5.0f;
|
||||
|
||||
var terminalComp = console.AddComponent<ElevatorTerminal>();
|
||||
terminalComp.interactionDistance = 3.8f;
|
||||
terminalComp.statusLight = statusLight;
|
||||
terminalComp.screenRenderer = screenBox.GetComponent<MeshRenderer>();
|
||||
|
||||
CreateWorldText(console.transform, new Vector3(0f, 1.7f, 0f), "ТЕРМИНАЛ ЛИФТА\n[ВВЕДИТЕ 4 ЦИФРЫ]", new Color(1f, 0.85f, 0.1f), 0.035f);
|
||||
}
|
||||
|
||||
private static void CreateElevatorFrame(Transform parent)
|
||||
{
|
||||
Vector3[] corners = new Vector3[] {
|
||||
new Vector3(-2.9f, 2.25f, -2.9f),
|
||||
new Vector3(2.9f, 2.25f, -2.9f),
|
||||
new Vector3(-2.9f, 2.25f, 2.9f),
|
||||
new Vector3(2.9f, 2.25f, 2.9f)
|
||||
};
|
||||
|
||||
for (int i = 0; i < corners.Length; i++)
|
||||
{
|
||||
GameObject pillar = GameObject.CreatePrimitive(PrimitiveType.Cube);
|
||||
pillar.name = $"Pillar_{i}";
|
||||
pillar.transform.SetParent(parent);
|
||||
pillar.transform.localPosition = corners[i];
|
||||
pillar.transform.localScale = new Vector3(0.25f, 4.5f, 0.25f);
|
||||
if (echoMat != null) pillar.GetComponent<MeshRenderer>().sharedMaterial = echoMat;
|
||||
}
|
||||
|
||||
GameObject beam = GameObject.CreatePrimitive(PrimitiveType.Cube);
|
||||
beam.name = "Elevator_TopBeam";
|
||||
beam.transform.SetParent(parent);
|
||||
beam.transform.localPosition = new Vector3(0f, 4.3f, -2.9f);
|
||||
beam.transform.localScale = new Vector3(6f, 0.4f, 0.3f);
|
||||
if (echoMat != null) beam.GetComponent<MeshRenderer>().sharedMaterial = echoMat;
|
||||
|
||||
CreateWorldText(parent, new Vector3(0f, 4.3f, -3.1f), "ВЫХОД: ЭВАКУАЦИОННЫЙ ЛИФТ (УРОВЕНЬ 2)", new Color(1f, 0.85f, 0.1f), 0.05f);
|
||||
}
|
||||
|
||||
private static void SetupFourStoryNotes()
|
||||
{
|
||||
var oldNotes = GameObject.Find("StoryNotes_Container");
|
||||
if (oldNotes != null)
|
||||
{
|
||||
Undo.DestroyObjectImmediate(oldNotes);
|
||||
}
|
||||
|
||||
GameObject notesRoot = new GameObject("StoryNotes_Container");
|
||||
Undo.RegisterCreatedObjectUndo(notesRoot, "Create StoryNotes_Container");
|
||||
|
||||
var noteDefs = new[]
|
||||
{
|
||||
new {
|
||||
pos = 0,
|
||||
coords = new Vector3(-36f, 0.85f, -36f),
|
||||
title = "ЗАПИСКА ДЕЖУРНОГО ТЕХНИКА #1",
|
||||
sector = "СЕКТОР B: КРИОГЕНИКА",
|
||||
text = "Срочное сообщение: система заблокировала шлюз из-за проникновения мутантов. Первую цифру кода аварийного лифта пришлось изменить, чтобы изолировать отсек. Запомните её, если хотите выбраться отсюда живым! Слепые твари не видят вас в темноте, пока вы стоите неподвижно."
|
||||
},
|
||||
new {
|
||||
pos = 1,
|
||||
coords = new Vector3(36f, 0.85f, -36f),
|
||||
title = "РАПОРТ СЛУЖБЫ БЕЗОПАСНОСТИ #2",
|
||||
sector = "СЕКТОР C: АРХИВ ОРУЖЕЙНОЙ",
|
||||
text = "Внимание личному составу: мутанты ориентируются исключительно на эхо шагов и грохот выстрелов! Вторая цифра защитного протокола лифта сохранена в этой директиве. Берегите патроны и используйте скрытное перемещение."
|
||||
},
|
||||
new {
|
||||
pos = 2,
|
||||
coords = new Vector3(-34f, 0.85f, -10f),
|
||||
title = "ДНЕВНИК ГЛАВНОГО БИОХИМИКА #3",
|
||||
sector = "СЕКТОР D: БИОХИМИЯ",
|
||||
text = "Эксперимент 'Эхо-11' полностью вышел из-под контроля. Все отсеки запечатаны. Третья цифра для активации транспортного лифта зафиксирована здесь. Если вы читаете это — немедленно прорывайтесь к реакторному залу на севере!"
|
||||
},
|
||||
new {
|
||||
pos = 3,
|
||||
coords = new Vector3(36f, 0.85f, 16f),
|
||||
title = "СЕРВЕРНЫЙ ЛОГ ЭНЕРГОСИСТЕМЫ #4",
|
||||
sector = "СЕКТОР G: ГЕНЕТИКА И КИБЕРНЕТИКА",
|
||||
text = "Автоматический протокол эвакуации: питание гидравлической шахты переведено на аварийный генератор. Финальная, четвертая цифра защитного кода записана в этот модуль. Транспортный лифт ожидает в северном крыле комплекса."
|
||||
}
|
||||
};
|
||||
|
||||
foreach (var def in noteDefs)
|
||||
{
|
||||
CreateNoteObject(notesRoot.transform, def.pos, def.coords, def.title, def.sector, def.text);
|
||||
}
|
||||
}
|
||||
|
||||
private static void CreateNoteObject(Transform parent, int digitPos, Vector3 position, string title, string sector, string text)
|
||||
{
|
||||
GameObject noteGo = new GameObject($"Note_Digit_{digitPos + 1}");
|
||||
noteGo.transform.SetParent(parent);
|
||||
noteGo.transform.position = position;
|
||||
|
||||
GameObject folder = GameObject.CreatePrimitive(PrimitiveType.Cube);
|
||||
folder.name = "FolderVisual";
|
||||
folder.transform.SetParent(noteGo.transform);
|
||||
folder.transform.localPosition = Vector3.zero;
|
||||
folder.transform.localRotation = Quaternion.Euler(0f, Random.Range(-30f, 30f), 0f);
|
||||
folder.transform.localScale = new Vector3(0.4f, 0.04f, 0.55f);
|
||||
if (echoMat != null) folder.GetComponent<MeshRenderer>().sharedMaterial = echoMat;
|
||||
|
||||
GameObject paper = GameObject.CreatePrimitive(PrimitiveType.Cube);
|
||||
paper.name = "PaperSheet";
|
||||
paper.transform.SetParent(folder.transform);
|
||||
paper.transform.localPosition = new Vector3(0f, 0.55f, 0f);
|
||||
paper.transform.localScale = new Vector3(0.85f, 0.1f, 0.85f);
|
||||
if (echoMat != null) paper.GetComponent<MeshRenderer>().sharedMaterial = echoMat;
|
||||
|
||||
GameObject markerLight = new GameObject("NoteLight");
|
||||
markerLight.transform.SetParent(noteGo.transform);
|
||||
markerLight.transform.localPosition = new Vector3(0f, 0.4f, 0f);
|
||||
Light lightComp = markerLight.AddComponent<Light>();
|
||||
lightComp.type = LightType.Point;
|
||||
lightComp.color = new Color(1.0f, 0.85f, 0.1f);
|
||||
lightComp.intensity = 2.0f;
|
||||
lightComp.range = 3.5f;
|
||||
|
||||
NotePickup pickup = noteGo.AddComponent<NotePickup>();
|
||||
pickup.digitPosition = digitPos;
|
||||
pickup.noteTitle = title;
|
||||
pickup.sectorName = sector;
|
||||
pickup.storyText = text;
|
||||
pickup.interactionDistance = 3.6f;
|
||||
// 3D текстовая подсказка отключена по запросу пользователя (убрана желтая надпись НАЖМИТЕ [E])
|
||||
// CreateWorldText(noteGo.transform, new Vector3(0f, 0.7f, 0f), $"[ЗАПИСКА #{digitPos + 1}]\nНАЖМИТЕ [E]", new Color(1f, 0.85f, 0.1f), 0.025f);
|
||||
}
|
||||
|
||||
private static void CreateWorldText(Transform parent, Vector3 localPos, string text, Color color, float characterSize)
|
||||
{
|
||||
GameObject textGo = new GameObject("FloatingLabel");
|
||||
textGo.transform.SetParent(parent);
|
||||
textGo.transform.localPosition = localPos;
|
||||
TextMesh tm = textGo.AddComponent<TextMesh>();
|
||||
tm.text = text;
|
||||
tm.fontSize = 42;
|
||||
tm.characterSize = characterSize;
|
||||
tm.color = color;
|
||||
tm.alignment = TextAlignment.Center;
|
||||
tm.anchor = TextAnchor.MiddleCenter;
|
||||
tm.fontStyle = FontStyle.Bold;
|
||||
if (defaultUiFont != null) tm.font = defaultUiFont;
|
||||
}
|
||||
|
||||
private static void SetupStoryUIInHUDCanvas()
|
||||
{
|
||||
GameObject hudCanvasGo = GameObject.Find("HUD_Canvas");
|
||||
if (hudCanvasGo == null)
|
||||
{
|
||||
hudCanvasGo = new GameObject("HUD_Canvas");
|
||||
Canvas c = hudCanvasGo.AddComponent<Canvas>();
|
||||
c.renderMode = RenderMode.ScreenSpaceOverlay;
|
||||
hudCanvasGo.AddComponent<CanvasScaler>();
|
||||
hudCanvasGo.AddComponent<GraphicRaycaster>();
|
||||
}
|
||||
|
||||
Transform hudRoot = hudCanvasGo.transform;
|
||||
|
||||
SetupInteractionPrompt(hudRoot);
|
||||
SetupCodeHUDTracker(hudRoot);
|
||||
SetupNoteViewerPanel(hudRoot);
|
||||
SetupElevatorKeypadPanel(hudRoot);
|
||||
SetupLevelSuccessPanel(hudRoot);
|
||||
}
|
||||
|
||||
private static void SetupInteractionPrompt(Transform hudRoot)
|
||||
{
|
||||
var old = hudRoot.Find("InteractionPromptPanel");
|
||||
if (old != null) Undo.DestroyObjectImmediate(old.gameObject);
|
||||
}
|
||||
|
||||
private static void SetupCodeHUDTracker(Transform hudRoot)
|
||||
{
|
||||
var old = hudRoot.Find("CodeTrackerHUD");
|
||||
if (old != null) Undo.DestroyObjectImmediate(old.gameObject);
|
||||
|
||||
GameObject trackerObj = new GameObject("CodeTrackerHUD");
|
||||
trackerObj.transform.SetParent(hudRoot, false);
|
||||
|
||||
RectTransform rt = trackerObj.AddComponent<RectTransform>();
|
||||
rt.anchorMin = new Vector2(1.0f, 1.0f);
|
||||
rt.anchorMax = new Vector2(1.0f, 1.0f);
|
||||
rt.pivot = new Vector2(1.0f, 1.0f);
|
||||
rt.anchoredPosition = new Vector2(-25f, -25f);
|
||||
rt.sizeDelta = new Vector2(260f, 68f);
|
||||
|
||||
Image bg = trackerObj.AddComponent<Image>();
|
||||
bg.color = new Color(0.04f, 0.04f, 0.04f, 0.88f);
|
||||
|
||||
Outline outline = trackerObj.AddComponent<Outline>();
|
||||
outline.effectColor = new Color(1.0f, 0.85f, 0.1f, 0.5f);
|
||||
outline.effectDistance = new Vector2(1f, -1f);
|
||||
|
||||
GameObject labelObj = new GameObject("Label");
|
||||
labelObj.transform.SetParent(trackerObj.transform, false);
|
||||
RectTransform labelRt = labelObj.AddComponent<RectTransform>();
|
||||
labelRt.anchorMin = new Vector2(0f, 0.6f);
|
||||
labelRt.anchorMax = new Vector2(1f, 1f);
|
||||
labelRt.offsetMin = new Vector2(10f, 0f);
|
||||
labelRt.offsetMax = new Vector2(-10f, -4f);
|
||||
|
||||
Text labelTxt = labelObj.AddComponent<Text>();
|
||||
labelTxt.font = defaultUiFont;
|
||||
labelTxt.fontSize = 13;
|
||||
labelTxt.fontStyle = FontStyle.Bold;
|
||||
labelTxt.alignment = TextAnchor.MiddleCenter;
|
||||
labelTxt.color = new Color(1.0f, 0.85f, 0.1f, 0.9f);
|
||||
labelTxt.text = "КОД ЛИФТА (УРОВЕНЬ 2):";
|
||||
|
||||
Text[] slotTexts = new Text[4];
|
||||
Image[] slotBorders = new Image[4];
|
||||
|
||||
float startX = 25f;
|
||||
float spacing = 55f;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
GameObject slotObj = new GameObject($"Slot_{i}");
|
||||
slotObj.transform.SetParent(trackerObj.transform, false);
|
||||
|
||||
RectTransform slotRt = slotObj.AddComponent<RectTransform>();
|
||||
slotRt.anchorMin = new Vector2(0f, 0f);
|
||||
slotRt.anchorMax = new Vector2(0f, 0.6f);
|
||||
slotRt.pivot = new Vector2(0.5f, 0.5f);
|
||||
slotRt.anchoredPosition = new Vector2(startX + i * spacing + 20f, 20f);
|
||||
slotRt.sizeDelta = new Vector2(42f, 32f);
|
||||
|
||||
Image slotBg = slotObj.AddComponent<Image>();
|
||||
slotBg.color = new Color(0.08f, 0.08f, 0.08f, 0.95f);
|
||||
slotBorders[i] = slotBg;
|
||||
|
||||
Outline slotOutline = slotObj.AddComponent<Outline>();
|
||||
slotOutline.effectColor = new Color(0.3f, 0.3f, 0.3f, 0.5f);
|
||||
slotOutline.effectDistance = new Vector2(1f, -1f);
|
||||
|
||||
GameObject txtObj = new GameObject("Text");
|
||||
txtObj.transform.SetParent(slotObj.transform, false);
|
||||
RectTransform txtRt = txtObj.AddComponent<RectTransform>();
|
||||
txtRt.anchorMin = Vector2.zero;
|
||||
txtRt.anchorMax = Vector2.one;
|
||||
txtRt.sizeDelta = Vector2.zero;
|
||||
|
||||
Text st = txtObj.AddComponent<Text>();
|
||||
st.font = handwrittenFont;
|
||||
st.fontSize = 20;
|
||||
st.fontStyle = FontStyle.Bold;
|
||||
st.alignment = TextAnchor.MiddleCenter;
|
||||
st.color = new Color(0.45f, 0.45f, 0.45f, 0.7f);
|
||||
st.text = "?";
|
||||
slotTexts[i] = st;
|
||||
}
|
||||
|
||||
var trackerComp = trackerObj.AddComponent<CodeHUDTracker>();
|
||||
SetField(trackerComp, "digitSlotTexts", slotTexts);
|
||||
SetField(trackerComp, "digitSlotBorders", slotBorders);
|
||||
}
|
||||
|
||||
private static void SetupNoteViewerPanel(Transform hudRoot)
|
||||
{
|
||||
var old = hudRoot.Find("NoteViewerPanel");
|
||||
if (old != null) Undo.DestroyObjectImmediate(old.gameObject);
|
||||
|
||||
var tornPaperSprite = AssetDatabase.LoadAssetAtPath<Sprite>("Assets/Textures/TornPaper_Sprite.png");
|
||||
var inkFreeFont = AssetDatabase.LoadAssetAtPath<Font>("Assets/Fonts/Inkfree.ttf");
|
||||
var courierFont = Font.CreateDynamicFontFromOSFont("Courier New", 18);
|
||||
if (courierFont == null) courierFont = Font.CreateDynamicFontFromOSFont("Consolas", 18);
|
||||
if (courierFont == null) courierFont = defaultUiFont;
|
||||
|
||||
GameObject rootPanel = new GameObject("NoteViewerPanel", typeof(RectTransform), typeof(CanvasRenderer), typeof(Image), typeof(Button));
|
||||
rootPanel.transform.SetParent(hudRoot, false);
|
||||
|
||||
RectTransform rootRt = rootPanel.GetComponent<RectTransform>();
|
||||
rootRt.anchorMin = Vector2.zero;
|
||||
rootRt.anchorMax = Vector2.one;
|
||||
rootRt.sizeDelta = Vector2.zero;
|
||||
|
||||
Image overlay = rootPanel.GetComponent<Image>();
|
||||
overlay.color = new Color(0.02f, 0.02f, 0.03f, 0.82f);
|
||||
|
||||
Button overlayBtn = rootPanel.GetComponent<Button>();
|
||||
overlayBtn.transition = Selectable.Transition.None;
|
||||
|
||||
GameObject shadowObj = new GameObject("PaperShadow", typeof(RectTransform), typeof(CanvasRenderer), typeof(Image));
|
||||
shadowObj.transform.SetParent(rootPanel.transform, false);
|
||||
RectTransform shadowRt = shadowObj.GetComponent<RectTransform>();
|
||||
shadowRt.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
shadowRt.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
shadowRt.pivot = new Vector2(0.5f, 0.5f);
|
||||
shadowRt.anchoredPosition = new Vector2(8f, 12f);
|
||||
shadowRt.sizeDelta = new Vector2(635f, 635f);
|
||||
Image shadowImg = shadowObj.GetComponent<Image>();
|
||||
if (tornPaperSprite != null) shadowImg.sprite = tornPaperSprite;
|
||||
shadowImg.color = new Color(0f, 0f, 0f, 0.45f);
|
||||
|
||||
GameObject paperObj = new GameObject("NoteDocumentCard", typeof(RectTransform), typeof(CanvasRenderer), typeof(Image));
|
||||
paperObj.transform.SetParent(rootPanel.transform, false);
|
||||
RectTransform paperRt = paperObj.GetComponent<RectTransform>();
|
||||
paperRt.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
paperRt.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
paperRt.pivot = new Vector2(0.5f, 0.5f);
|
||||
paperRt.anchoredPosition = new Vector2(0f, 20f);
|
||||
paperRt.sizeDelta = new Vector2(620f, 620f);
|
||||
|
||||
Image paperImg = paperObj.GetComponent<Image>();
|
||||
if (tornPaperSprite != null) paperImg.sprite = tornPaperSprite;
|
||||
paperImg.color = Color.white;
|
||||
|
||||
paperObj.transform.localRotation = Quaternion.Euler(0f, 0f, -1.2f);
|
||||
shadowObj.transform.localRotation = paperObj.transform.localRotation;
|
||||
|
||||
GameObject headerObj = new GameObject("DocumentHeader", typeof(RectTransform), typeof(CanvasRenderer), typeof(Text));
|
||||
headerObj.transform.SetParent(paperObj.transform, false);
|
||||
RectTransform headerRt = headerObj.GetComponent<RectTransform>();
|
||||
headerRt.anchorMin = new Vector2(0.5f, 1f);
|
||||
headerRt.anchorMax = new Vector2(0.5f, 1f);
|
||||
headerRt.pivot = new Vector2(0.5f, 1f);
|
||||
headerRt.anchoredPosition = new Vector2(0f, -65f);
|
||||
headerRt.sizeDelta = new Vector2(450f, 32f);
|
||||
|
||||
Text headerTxt = headerObj.GetComponent<Text>();
|
||||
headerTxt.font = courierFont;
|
||||
headerTxt.fontSize = 24;
|
||||
headerTxt.fontStyle = FontStyle.Bold;
|
||||
headerTxt.alignment = TextAnchor.MiddleCenter;
|
||||
headerTxt.color = new Color(0.12f, 0.12f, 0.14f, 1.0f);
|
||||
headerTxt.text = "Секретный протокол";
|
||||
|
||||
GameObject ellipsisObj = new GameObject("EllipsisText", typeof(RectTransform), typeof(CanvasRenderer), typeof(Text));
|
||||
ellipsisObj.transform.SetParent(paperObj.transform, false);
|
||||
RectTransform ellipsisRt = ellipsisObj.GetComponent<RectTransform>();
|
||||
ellipsisRt.anchorMin = new Vector2(0.5f, 1f);
|
||||
ellipsisRt.anchorMax = new Vector2(0.5f, 1f);
|
||||
ellipsisRt.pivot = new Vector2(0.5f, 1f);
|
||||
ellipsisRt.anchoredPosition = new Vector2(0f, -94f);
|
||||
ellipsisRt.sizeDelta = new Vector2(450f, 22f);
|
||||
|
||||
Text ellipsisTxt = ellipsisObj.GetComponent<Text>();
|
||||
ellipsisTxt.font = courierFont;
|
||||
ellipsisTxt.fontSize = 18;
|
||||
ellipsisTxt.alignment = TextAnchor.MiddleCenter;
|
||||
ellipsisTxt.color = new Color(0.35f, 0.35f, 0.38f, 0.85f);
|
||||
ellipsisTxt.text = ". . .";
|
||||
|
||||
GameObject sectorObj = new GameObject("SectorText", typeof(RectTransform), typeof(CanvasRenderer), typeof(Text));
|
||||
sectorObj.transform.SetParent(paperObj.transform, false);
|
||||
RectTransform sectorRt = sectorObj.GetComponent<RectTransform>();
|
||||
sectorRt.anchorMin = new Vector2(0.5f, 1f);
|
||||
sectorRt.anchorMax = new Vector2(0.5f, 1f);
|
||||
sectorRt.pivot = new Vector2(0.5f, 1f);
|
||||
sectorRt.anchoredPosition = new Vector2(0f, -120f);
|
||||
sectorRt.sizeDelta = new Vector2(440f, 22f);
|
||||
|
||||
Text sectorTxt = sectorObj.GetComponent<Text>();
|
||||
sectorTxt.font = courierFont;
|
||||
sectorTxt.fontSize = 12;
|
||||
sectorTxt.fontStyle = FontStyle.Bold;
|
||||
sectorTxt.alignment = TextAnchor.MiddleCenter;
|
||||
sectorTxt.color = new Color(0.38f, 0.38f, 0.42f, 0.9f);
|
||||
sectorTxt.text = "ОТДЕЛ: СЕКТОР B // КРИОГЕНИКА";
|
||||
|
||||
GameObject storyObj = new GameObject("StoryText", typeof(RectTransform), typeof(CanvasRenderer), typeof(Text));
|
||||
storyObj.transform.SetParent(paperObj.transform, false);
|
||||
RectTransform storyRt = storyObj.GetComponent<RectTransform>();
|
||||
storyRt.anchorMin = new Vector2(0.5f, 1f);
|
||||
storyRt.anchorMax = new Vector2(0.5f, 1f);
|
||||
storyRt.pivot = new Vector2(0.5f, 1f);
|
||||
storyRt.anchoredPosition = new Vector2(0f, -148f);
|
||||
storyRt.sizeDelta = new Vector2(430f, 160f);
|
||||
|
||||
Text storyTxt = storyObj.GetComponent<Text>();
|
||||
storyTxt.font = courierFont;
|
||||
storyTxt.fontSize = 13;
|
||||
storyTxt.alignment = TextAnchor.UpperLeft;
|
||||
storyTxt.lineSpacing = 1.18f;
|
||||
storyTxt.color = new Color(0.18f, 0.18f, 0.22f, 1.0f);
|
||||
storyTxt.text = "Срочное сообщение: система заблокировала шлюз из-за проникновения мутантов. Первую цифру кода аварийного лифта пришлось изменить, чтобы изолировать отсек. Запомните её, если хотите выбраться отсюда живым!";
|
||||
|
||||
GameObject codeArea = new GameObject("PaperCodeArea", typeof(RectTransform));
|
||||
codeArea.transform.SetParent(paperObj.transform, false);
|
||||
RectTransform codeRt = codeArea.GetComponent<RectTransform>();
|
||||
codeRt.anchorMin = new Vector2(0.5f, 1f);
|
||||
codeRt.anchorMax = new Vector2(0.5f, 1f);
|
||||
codeRt.pivot = new Vector2(0.5f, 1f);
|
||||
codeRt.anchoredPosition = new Vector2(0f, -320f);
|
||||
codeRt.sizeDelta = new Vector2(440f, 150f);
|
||||
|
||||
GameObject posObj = new GameObject("PositionText", typeof(RectTransform), typeof(CanvasRenderer), typeof(Text));
|
||||
posObj.transform.SetParent(codeArea.transform, false);
|
||||
RectTransform posRt = posObj.GetComponent<RectTransform>();
|
||||
posRt.anchorMin = new Vector2(0.5f, 1f);
|
||||
posRt.anchorMax = new Vector2(0.5f, 1f);
|
||||
posRt.pivot = new Vector2(0.5f, 1f);
|
||||
posRt.anchoredPosition = new Vector2(0f, 0f);
|
||||
posRt.sizeDelta = new Vector2(440f, 26f);
|
||||
|
||||
Text posTxt = posObj.GetComponent<Text>();
|
||||
posTxt.font = courierFont;
|
||||
posTxt.fontSize = 13;
|
||||
posTxt.fontStyle = FontStyle.Bold;
|
||||
posTxt.alignment = TextAnchor.MiddleCenter;
|
||||
posTxt.color = new Color(0.25f, 0.25f, 0.30f, 1.0f);
|
||||
posTxt.text = "ПОЗИЦИЯ В КОДЕ ЛИФТА: 1-Я ЦИФРА [ _ * * * ]";
|
||||
|
||||
GameObject digitObj = new GameObject("BigDigitText", typeof(RectTransform), typeof(CanvasRenderer), typeof(Text));
|
||||
digitObj.transform.SetParent(codeArea.transform, false);
|
||||
RectTransform digitRt = digitObj.GetComponent<RectTransform>();
|
||||
digitRt.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
digitRt.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
digitRt.pivot = new Vector2(0.5f, 0.5f);
|
||||
digitRt.anchoredPosition = new Vector2(0f, -25f);
|
||||
digitRt.sizeDelta = new Vector2(160f, 110f);
|
||||
|
||||
Text digitTxt = digitObj.GetComponent<Text>();
|
||||
digitTxt.font = inkFreeFont != null ? inkFreeFont : courierFont;
|
||||
digitTxt.fontSize = 82;
|
||||
digitTxt.fontStyle = FontStyle.Bold;
|
||||
digitTxt.alignment = TextAnchor.MiddleCenter;
|
||||
digitTxt.color = new Color(0.06f, 0.16f, 0.52f, 1.0f);
|
||||
digitTxt.text = "7";
|
||||
|
||||
GameObject hintObj = new GameObject("CloseHint", typeof(RectTransform), typeof(CanvasRenderer), typeof(Text));
|
||||
hintObj.transform.SetParent(rootPanel.transform, false);
|
||||
RectTransform hintRt = hintObj.GetComponent<RectTransform>();
|
||||
hintRt.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
hintRt.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
hintRt.pivot = new Vector2(0.5f, 0.5f);
|
||||
hintRt.anchoredPosition = new Vector2(0f, -325f);
|
||||
hintRt.sizeDelta = new Vector2(600f, 32f);
|
||||
|
||||
Text hintTxt = hintObj.GetComponent<Text>();
|
||||
hintTxt.font = courierFont;
|
||||
hintTxt.fontSize = 13;
|
||||
hintTxt.alignment = TextAnchor.MiddleCenter;
|
||||
hintTxt.color = new Color(0.85f, 0.85f, 0.85f, 0.70f);
|
||||
hintTxt.text = "[ НАЖМИТЕ E, ESC ИЛИ КЛИКНИТЕ, ЧТОБЫ ЗАКРЫТЬ ]";
|
||||
|
||||
var noteViewerComp = rootPanel.AddComponent<NoteViewerUI>();
|
||||
SetField(noteViewerComp, "notePanelRoot", rootPanel);
|
||||
SetField(noteViewerComp, "documentHeader", headerTxt);
|
||||
SetField(noteViewerComp, "sectorText", sectorTxt);
|
||||
SetField(noteViewerComp, "positionNoticeText", posTxt);
|
||||
SetField(noteViewerComp, "bigDigitText", digitTxt);
|
||||
SetField(noteViewerComp, "flavorBodyText", storyTxt);
|
||||
SetField(noteViewerComp, "closeButton", overlayBtn);
|
||||
|
||||
overlayBtn.onClick.RemoveAllListeners();
|
||||
overlayBtn.onClick.AddListener(noteViewerComp.CloseNote);
|
||||
|
||||
rootPanel.SetActive(false);
|
||||
}
|
||||
|
||||
private static void SetupElevatorKeypadPanel(Transform hudRoot)
|
||||
{
|
||||
var old = hudRoot.Find("ElevatorKeypadPanel");
|
||||
if (old != null) Undo.DestroyObjectImmediate(old.gameObject);
|
||||
|
||||
GameObject rootPanel = new GameObject("ElevatorKeypadPanel");
|
||||
rootPanel.transform.SetParent(hudRoot, false);
|
||||
|
||||
RectTransform rootRt = rootPanel.AddComponent<RectTransform>();
|
||||
rootRt.anchorMin = Vector2.zero;
|
||||
rootRt.anchorMax = Vector2.one;
|
||||
rootRt.sizeDelta = Vector2.zero;
|
||||
|
||||
Image overlay = rootPanel.AddComponent<Image>();
|
||||
overlay.color = new Color(0f, 0f, 0f, 0.9f);
|
||||
|
||||
GameObject card = new GameObject("TerminalCard");
|
||||
card.transform.SetParent(rootPanel.transform, false);
|
||||
|
||||
RectTransform cardRt = card.AddComponent<RectTransform>();
|
||||
cardRt.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
cardRt.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
cardRt.pivot = new Vector2(0.5f, 0.5f);
|
||||
cardRt.sizeDelta = new Vector2(560f, 660f);
|
||||
|
||||
Image cardBg = card.AddComponent<Image>();
|
||||
cardBg.color = new Color(0.04f, 0.04f, 0.04f, 0.98f);
|
||||
|
||||
Outline cardOutline = card.AddComponent<Outline>();
|
||||
cardOutline.effectColor = new Color(1.0f, 0.85f, 0.10f, 0.8f);
|
||||
cardOutline.effectDistance = new Vector2(2f, -2f);
|
||||
|
||||
GameObject headerObj = new GameObject("Title");
|
||||
headerObj.transform.SetParent(card.transform, false);
|
||||
RectTransform headerRt = headerObj.AddComponent<RectTransform>();
|
||||
headerRt.anchorMin = new Vector2(0f, 1f);
|
||||
headerRt.anchorMax = new Vector2(1f, 1f);
|
||||
headerRt.pivot = new Vector2(0.5f, 1f);
|
||||
headerRt.anchoredPosition = new Vector2(0f, -20f);
|
||||
headerRt.sizeDelta = new Vector2(520f, 36f);
|
||||
|
||||
Text headerTxt = headerObj.AddComponent<Text>();
|
||||
headerTxt.font = defaultUiFont;
|
||||
headerTxt.fontSize = 18;
|
||||
headerTxt.fontStyle = FontStyle.Bold;
|
||||
headerTxt.alignment = TextAnchor.MiddleCenter;
|
||||
headerTxt.color = new Color(1.0f, 0.85f, 0.1f, 1.0f);
|
||||
headerTxt.text = "ТЕРМИНАЛ ЛИФТА // ВЫХОД НА УРОВЕНЬ 2";
|
||||
|
||||
GameObject displayBox = new GameObject("DisplayBox");
|
||||
displayBox.transform.SetParent(card.transform, false);
|
||||
RectTransform displayRt = displayBox.AddComponent<RectTransform>();
|
||||
displayRt.anchorMin = new Vector2(0.5f, 1f);
|
||||
displayRt.anchorMax = new Vector2(0.5f, 1f);
|
||||
displayRt.pivot = new Vector2(0.5f, 1f);
|
||||
displayRt.anchoredPosition = new Vector2(0f, -70f);
|
||||
displayRt.sizeDelta = new Vector2(460f, 85f);
|
||||
|
||||
Image dispBg = displayBox.AddComponent<Image>();
|
||||
dispBg.color = new Color(0.01f, 0.01f, 0.01f, 1.0f);
|
||||
|
||||
Outline dispOutline = displayBox.AddComponent<Outline>();
|
||||
dispOutline.effectColor = new Color(1.0f, 0.85f, 0.10f, 0.4f);
|
||||
dispOutline.effectDistance = new Vector2(1.5f, -1.5f);
|
||||
|
||||
Text[] digitSlots = new Text[4];
|
||||
Image[] digitSlotBorders = new Image[4];
|
||||
|
||||
float slotStartX = -150f;
|
||||
float slotSpacing = 100f;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
GameObject sObj = new GameObject($"DigitSlot_{i}");
|
||||
sObj.transform.SetParent(displayBox.transform, false);
|
||||
|
||||
RectTransform sRt = sObj.AddComponent<RectTransform>();
|
||||
sRt.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
sRt.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
sRt.pivot = new Vector2(0.5f, 0.5f);
|
||||
sRt.anchoredPosition = new Vector2(slotStartX + i * slotSpacing, 0f);
|
||||
sRt.sizeDelta = new Vector2(75f, 65f);
|
||||
|
||||
Image sBg = sObj.AddComponent<Image>();
|
||||
sBg.color = new Color(0.06f, 0.06f, 0.06f, 1.0f);
|
||||
digitSlotBorders[i] = sBg;
|
||||
|
||||
Outline sOutline = sObj.AddComponent<Outline>();
|
||||
sOutline.effectColor = new Color(1.0f, 0.85f, 0.10f, 0.3f);
|
||||
sOutline.effectDistance = new Vector2(1f, -1f);
|
||||
|
||||
GameObject txtObj = new GameObject("Text");
|
||||
txtObj.transform.SetParent(sObj.transform, false);
|
||||
RectTransform txtRt = txtObj.AddComponent<RectTransform>();
|
||||
txtRt.anchorMin = Vector2.zero;
|
||||
txtRt.anchorMax = Vector2.one;
|
||||
txtRt.sizeDelta = Vector2.zero;
|
||||
|
||||
Text st = txtObj.AddComponent<Text>();
|
||||
st.font = defaultUiFont;
|
||||
st.fontSize = 42;
|
||||
st.fontStyle = FontStyle.Bold;
|
||||
st.alignment = TextAnchor.MiddleCenter;
|
||||
st.color = new Color(1.0f, 0.85f, 0.1f, 1.0f);
|
||||
st.text = "_";
|
||||
digitSlots[i] = st;
|
||||
}
|
||||
|
||||
GameObject statusObj = new GameObject("StatusText");
|
||||
statusObj.transform.SetParent(card.transform, false);
|
||||
RectTransform statusRt = statusObj.AddComponent<RectTransform>();
|
||||
statusRt.anchorMin = new Vector2(0.5f, 1f);
|
||||
statusRt.anchorMax = new Vector2(0.5f, 1f);
|
||||
statusRt.pivot = new Vector2(0.5f, 1f);
|
||||
statusRt.anchoredPosition = new Vector2(0f, -170f);
|
||||
statusRt.sizeDelta = new Vector2(500f, 32f);
|
||||
|
||||
Text statusTxt = statusObj.AddComponent<Text>();
|
||||
statusTxt.font = defaultUiFont;
|
||||
statusTxt.fontSize = 15;
|
||||
statusTxt.fontStyle = FontStyle.Bold;
|
||||
statusTxt.alignment = TextAnchor.MiddleCenter;
|
||||
statusTxt.color = new Color(1.0f, 0.85f, 0.1f, 1.0f);
|
||||
statusTxt.text = "ВВЕДИТЕ 4-ЗНАЧНЫЙ КОД С ЗАПИСОК";
|
||||
|
||||
GameObject keypadGrid = new GameObject("KeypadGrid");
|
||||
keypadGrid.transform.SetParent(card.transform, false);
|
||||
RectTransform gridRt = keypadGrid.AddComponent<RectTransform>();
|
||||
gridRt.anchorMin = new Vector2(0.5f, 0f);
|
||||
gridRt.anchorMax = new Vector2(0.5f, 0f);
|
||||
gridRt.pivot = new Vector2(0.5f, 0f);
|
||||
gridRt.anchoredPosition = new Vector2(0f, 90f);
|
||||
gridRt.sizeDelta = new Vector2(390f, 340f);
|
||||
|
||||
Button[] numberButtons = new Button[10];
|
||||
Button clearButton = null;
|
||||
Button enterButton = null;
|
||||
|
||||
float btnW = 115f;
|
||||
float btnH = 68f;
|
||||
float[] xs = new float[] { -130f, 0f, 130f };
|
||||
|
||||
int[][] layout = new int[][]
|
||||
{
|
||||
new int[] { 1, 2, 3 },
|
||||
new int[] { 4, 5, 6 },
|
||||
new int[] { 7, 8, 9 }
|
||||
};
|
||||
|
||||
for (int r = 0; r < 3; r++)
|
||||
{
|
||||
float yPos = 255f - r * 85f;
|
||||
for (int c = 0; c < 3; c++)
|
||||
{
|
||||
int val = layout[r][c];
|
||||
numberButtons[val] = CreateKeypadButton(keypadGrid.transform, xs[c], yPos, btnW, btnH, val.ToString(),
|
||||
new Color(0.12f, 0.12f, 0.12f, 1f), new Color(1f, 0.85f, 0.1f, 1f));
|
||||
}
|
||||
}
|
||||
|
||||
clearButton = CreateKeypadButton(keypadGrid.transform, xs[0], 0f, btnW, btnH, "СБРОС",
|
||||
new Color(0.35f, 0.08f, 0.08f, 1f), new Color(1f, 0.4f, 0.4f, 1f));
|
||||
|
||||
numberButtons[0] = CreateKeypadButton(keypadGrid.transform, xs[1], 0f, btnW, btnH, "0",
|
||||
new Color(0.12f, 0.12f, 0.12f, 1f), new Color(1f, 0.85f, 0.1f, 1f));
|
||||
|
||||
enterButton = CreateKeypadButton(keypadGrid.transform, xs[2], 0f, btnW, btnH, "ВВОД",
|
||||
new Color(1.0f, 0.85f, 0.1f, 1f), new Color(0.05f, 0.05f, 0.05f, 1f));
|
||||
|
||||
GameObject exitObj = new GameObject("ExitButton");
|
||||
exitObj.transform.SetParent(card.transform, false);
|
||||
RectTransform exitRt = exitObj.AddComponent<RectTransform>();
|
||||
exitRt.anchorMin = new Vector2(0.5f, 0f);
|
||||
exitRt.anchorMax = new Vector2(0.5f, 0f);
|
||||
exitRt.pivot = new Vector2(0.5f, 0f);
|
||||
exitRt.anchoredPosition = new Vector2(0f, 25f);
|
||||
exitRt.sizeDelta = new Vector2(390f, 44f);
|
||||
|
||||
Image exitImg = exitObj.AddComponent<Image>();
|
||||
exitImg.color = new Color(0.12f, 0.12f, 0.12f, 1f);
|
||||
|
||||
Outline exitOutline = exitObj.AddComponent<Outline>();
|
||||
exitOutline.effectColor = new Color(0.5f, 0.5f, 0.5f, 0.6f);
|
||||
exitOutline.effectDistance = new Vector2(1.5f, -1.5f);
|
||||
|
||||
Button exitBtn = exitObj.AddComponent<Button>();
|
||||
|
||||
GameObject exitTxtObj = new GameObject("Text");
|
||||
exitTxtObj.transform.SetParent(exitObj.transform, false);
|
||||
RectTransform exitTxtRt = exitTxtObj.AddComponent<RectTransform>();
|
||||
exitTxtRt.anchorMin = Vector2.zero;
|
||||
exitTxtRt.anchorMax = Vector2.one;
|
||||
exitTxtRt.sizeDelta = Vector2.zero;
|
||||
|
||||
Text etxt = exitTxtObj.AddComponent<Text>();
|
||||
etxt.font = defaultUiFont;
|
||||
etxt.fontSize = 15;
|
||||
etxt.fontStyle = FontStyle.Bold;
|
||||
etxt.alignment = TextAnchor.MiddleCenter;
|
||||
etxt.color = new Color(0.85f, 0.85f, 0.85f, 1.0f);
|
||||
etxt.text = "ОТОЙТИ ОТ ТЕРМИНАЛА [ESC]";
|
||||
|
||||
var keypadComp = rootPanel.AddComponent<ElevatorKeypadUI>();
|
||||
SetField(keypadComp, "keypadPanelRoot", rootPanel);
|
||||
SetField(keypadComp, "digitSlots", digitSlots);
|
||||
SetField(keypadComp, "digitSlotBorders", digitSlotBorders);
|
||||
SetField(keypadComp, "statusText", statusTxt);
|
||||
SetField(keypadComp, "numberButtons", numberButtons);
|
||||
SetField(keypadComp, "clearButton", clearButton);
|
||||
SetField(keypadComp, "enterButton", enterButton);
|
||||
SetField(keypadComp, "exitButton", exitBtn);
|
||||
|
||||
rootPanel.SetActive(false);
|
||||
}
|
||||
|
||||
private static Button CreateKeypadButton(Transform parent, float x, float y, float w, float h, string text, Color bgColor, Color textColor)
|
||||
{
|
||||
GameObject btnObj = new GameObject($"Btn_{text}");
|
||||
btnObj.transform.SetParent(parent, false);
|
||||
|
||||
RectTransform rt = btnObj.AddComponent<RectTransform>();
|
||||
rt.anchorMin = new Vector2(0.5f, 0f);
|
||||
rt.anchorMax = new Vector2(0.5f, 0f);
|
||||
rt.pivot = new Vector2(0.5f, 0f);
|
||||
rt.anchoredPosition = new Vector2(x, y);
|
||||
rt.sizeDelta = new Vector2(w, h);
|
||||
|
||||
Image bg = btnObj.AddComponent<Image>();
|
||||
bg.color = bgColor;
|
||||
|
||||
Outline outline = btnObj.AddComponent<Outline>();
|
||||
outline.effectColor = new Color(1.0f, 0.85f, 0.10f, 0.45f);
|
||||
outline.effectDistance = new Vector2(1.5f, -1.5f);
|
||||
|
||||
Button btn = btnObj.AddComponent<Button>();
|
||||
ColorBlock cb = btn.colors;
|
||||
cb.normalColor = bgColor;
|
||||
cb.highlightedColor = bgColor + new Color(0.15f, 0.15f, 0.15f, 0f);
|
||||
cb.pressedColor = bgColor - new Color(0.1f, 0.1f, 0.1f, 0f);
|
||||
btn.colors = cb;
|
||||
|
||||
GameObject txtObj = new GameObject("Text");
|
||||
txtObj.transform.SetParent(btnObj.transform, false);
|
||||
RectTransform txtRt = txtObj.AddComponent<RectTransform>();
|
||||
txtRt.anchorMin = Vector2.zero;
|
||||
txtRt.anchorMax = Vector2.one;
|
||||
txtRt.sizeDelta = Vector2.zero;
|
||||
|
||||
Text txt = txtObj.AddComponent<Text>();
|
||||
txt.font = defaultUiFont;
|
||||
txt.fontSize = (text.Length > 2) ? 17 : 26;
|
||||
txt.fontStyle = FontStyle.Bold;
|
||||
txt.alignment = TextAnchor.MiddleCenter;
|
||||
txt.color = textColor;
|
||||
txt.text = text;
|
||||
|
||||
return btn;
|
||||
}
|
||||
|
||||
private static void SetupLevelSuccessPanel(Transform hudRoot)
|
||||
{
|
||||
var old = hudRoot.Find("LevelSuccessPanel");
|
||||
if (old != null) Undo.DestroyObjectImmediate(old.gameObject);
|
||||
|
||||
GameObject rootPanel = new GameObject("LevelSuccessPanel");
|
||||
rootPanel.transform.SetParent(hudRoot, false);
|
||||
|
||||
RectTransform rootRt = rootPanel.AddComponent<RectTransform>();
|
||||
rootRt.anchorMin = Vector2.zero;
|
||||
rootRt.anchorMax = Vector2.one;
|
||||
rootRt.sizeDelta = Vector2.zero;
|
||||
|
||||
Image overlay = rootPanel.AddComponent<Image>();
|
||||
overlay.color = new Color(0f, 0f, 0f, 0.92f);
|
||||
|
||||
GameObject card = new GameObject("SuccessCard");
|
||||
card.transform.SetParent(rootPanel.transform, false);
|
||||
|
||||
RectTransform cardRt = card.AddComponent<RectTransform>();
|
||||
cardRt.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
cardRt.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
cardRt.pivot = new Vector2(0.5f, 0.5f);
|
||||
cardRt.sizeDelta = new Vector2(650f, 440f);
|
||||
|
||||
Image cardBg = card.AddComponent<Image>();
|
||||
cardBg.color = new Color(0.04f, 0.04f, 0.04f, 0.98f);
|
||||
|
||||
Outline cardOutline = card.AddComponent<Outline>();
|
||||
cardOutline.effectColor = new Color(1.0f, 0.85f, 0.10f, 0.9f);
|
||||
cardOutline.effectDistance = new Vector2(2f, -2f);
|
||||
|
||||
GameObject titleObj = new GameObject("Title");
|
||||
titleObj.transform.SetParent(card.transform, false);
|
||||
RectTransform titleRt = titleObj.AddComponent<RectTransform>();
|
||||
titleRt.anchorMin = new Vector2(0f, 1f);
|
||||
titleRt.anchorMax = new Vector2(1f, 1f);
|
||||
titleRt.pivot = new Vector2(0.5f, 1f);
|
||||
titleRt.anchoredPosition = new Vector2(0f, -30f);
|
||||
titleRt.sizeDelta = new Vector2(600f, 45f);
|
||||
|
||||
Text titleTxt = titleObj.AddComponent<Text>();
|
||||
titleTxt.font = defaultUiFont;
|
||||
titleTxt.fontSize = 32;
|
||||
titleTxt.fontStyle = FontStyle.Bold;
|
||||
titleTxt.alignment = TextAnchor.MiddleCenter;
|
||||
titleTxt.color = new Color(1.0f, 0.85f, 0.1f, 1.0f);
|
||||
titleTxt.text = "УРОВЕНЬ 1 ПРОЙДЕН!";
|
||||
|
||||
GameObject subObj = new GameObject("Subtitle");
|
||||
subObj.transform.SetParent(card.transform, false);
|
||||
RectTransform subRt = subObj.AddComponent<RectTransform>();
|
||||
subRt.anchorMin = new Vector2(0f, 1f);
|
||||
subRt.anchorMax = new Vector2(1f, 1f);
|
||||
subRt.pivot = new Vector2(0.5f, 1f);
|
||||
subRt.anchoredPosition = new Vector2(0f, -85f);
|
||||
subRt.sizeDelta = new Vector2(600f, 30f);
|
||||
|
||||
Text subTxt = subObj.AddComponent<Text>();
|
||||
subTxt.font = defaultUiFont;
|
||||
subTxt.fontSize = 16;
|
||||
subTxt.fontStyle = FontStyle.Bold;
|
||||
subTxt.alignment = TextAnchor.MiddleCenter;
|
||||
subTxt.color = new Color(0.2f, 1.0f, 0.4f, 1.0f);
|
||||
subTxt.text = "ЛИФТ УСПЕШНО АКТИВИРОВАН // СПУСК НА УРОВЕНЬ 2";
|
||||
|
||||
GameObject descObj = new GameObject("Description");
|
||||
descObj.transform.SetParent(card.transform, false);
|
||||
RectTransform descRt = descObj.AddComponent<RectTransform>();
|
||||
descRt.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
descRt.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
descRt.pivot = new Vector2(0.5f, 0.5f);
|
||||
descRt.anchoredPosition = new Vector2(0f, 0f);
|
||||
descRt.sizeDelta = new Vector2(560f, 110f);
|
||||
|
||||
Text descTxt = descObj.AddComponent<Text>();
|
||||
descTxt.font = defaultUiFont;
|
||||
descTxt.fontSize = 16;
|
||||
descTxt.lineSpacing = 1.3f;
|
||||
descTxt.alignment = TextAnchor.MiddleCenter;
|
||||
descTxt.color = new Color(0.85f, 0.85f, 0.85f, 1.0f);
|
||||
descTxt.text = "Вы успешно собрали все 4 цифры защитного кода с записок персонала и запустили гидравлический лифт.\n\nВторой (более сложный) уровень локации находится в разработке!";
|
||||
|
||||
GameObject btn1 = new GameObject("NextLevelButton");
|
||||
btn1.transform.SetParent(card.transform, false);
|
||||
RectTransform btn1Rt = btn1.AddComponent<RectTransform>();
|
||||
btn1Rt.anchorMin = new Vector2(0.5f, 0f);
|
||||
btn1Rt.anchorMax = new Vector2(0.5f, 0f);
|
||||
btn1Rt.pivot = new Vector2(0.5f, 0f);
|
||||
btn1Rt.anchoredPosition = new Vector2(0f, 95f);
|
||||
btn1Rt.sizeDelta = new Vector2(420f, 50f);
|
||||
|
||||
Image btn1Img = btn1.AddComponent<Image>();
|
||||
btn1Img.color = new Color(1.0f, 0.85f, 0.1f, 1.0f);
|
||||
|
||||
Button nextBtn = btn1.AddComponent<Button>();
|
||||
|
||||
GameObject b1Txt = new GameObject("Text");
|
||||
b1Txt.transform.SetParent(btn1.transform, false);
|
||||
RectTransform b1TxtRt = b1Txt.AddComponent<RectTransform>();
|
||||
b1TxtRt.anchorMin = Vector2.zero;
|
||||
b1TxtRt.anchorMax = Vector2.one;
|
||||
b1TxtRt.sizeDelta = Vector2.zero;
|
||||
|
||||
Text t1 = b1Txt.AddComponent<Text>();
|
||||
t1.font = defaultUiFont;
|
||||
t1.fontSize = 16;
|
||||
t1.fontStyle = FontStyle.Bold;
|
||||
t1.alignment = TextAnchor.MiddleCenter;
|
||||
t1.color = new Color(0.05f, 0.05f, 0.05f, 1.0f);
|
||||
t1.text = "СЫГРАТЬ СНОВА (НОВЫЙ СЛУЧАЙНЫЙ КОД)";
|
||||
|
||||
GameObject btn2 = new GameObject("MainMenuButton");
|
||||
btn2.transform.SetParent(card.transform, false);
|
||||
RectTransform btn2Rt = btn2.AddComponent<RectTransform>();
|
||||
btn2Rt.anchorMin = new Vector2(0.5f, 0f);
|
||||
btn2Rt.anchorMax = new Vector2(0.5f, 0f);
|
||||
btn2Rt.pivot = new Vector2(0.5f, 0f);
|
||||
btn2Rt.anchoredPosition = new Vector2(0f, 35f);
|
||||
btn2Rt.sizeDelta = new Vector2(420f, 44f);
|
||||
|
||||
Image btn2Img = btn2.AddComponent<Image>();
|
||||
btn2Img.color = new Color(0.12f, 0.12f, 0.12f, 1.0f);
|
||||
|
||||
Outline b2Outline = btn2.AddComponent<Outline>();
|
||||
b2Outline.effectColor = new Color(0.5f, 0.5f, 0.5f, 0.6f);
|
||||
b2Outline.effectDistance = new Vector2(1.5f, -1.5f);
|
||||
|
||||
Button menuBtn = btn2.AddComponent<Button>();
|
||||
|
||||
GameObject b2Txt = new GameObject("Text");
|
||||
b2Txt.transform.SetParent(btn2.transform, false);
|
||||
RectTransform b2TxtRt = b2Txt.AddComponent<RectTransform>();
|
||||
b2TxtRt.anchorMin = Vector2.zero;
|
||||
b2TxtRt.anchorMax = Vector2.one;
|
||||
b2TxtRt.sizeDelta = Vector2.zero;
|
||||
|
||||
Text t2 = b2Txt.AddComponent<Text>();
|
||||
t2.font = defaultUiFont;
|
||||
t2.fontSize = 15;
|
||||
t2.fontStyle = FontStyle.Bold;
|
||||
t2.alignment = TextAnchor.MiddleCenter;
|
||||
t2.color = new Color(0.85f, 0.85f, 0.85f, 1.0f);
|
||||
t2.text = "В ГЛАВНОЕ МЕНЮ";
|
||||
|
||||
var successComp = rootPanel.AddComponent<LevelSuccessUI>();
|
||||
SetField(successComp, "successPanelRoot", rootPanel);
|
||||
SetField(successComp, "nextLevelButton", nextBtn);
|
||||
SetField(successComp, "mainMenuButton", menuBtn);
|
||||
|
||||
rootPanel.SetActive(false);
|
||||
}
|
||||
|
||||
private static void SetField(object target, string fieldName, object value)
|
||||
{
|
||||
if (target == null) return;
|
||||
var field = target.GetType().GetField(fieldName, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
|
||||
if (field != null)
|
||||
{
|
||||
field.SetValue(target, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b954ae689718b0440a44d7a680740cba
|
||||
@@ -16,6 +16,8 @@ public static class PauseMenuBuilder
|
||||
public static string Build()
|
||||
{
|
||||
standardFont = Resources.GetBuiltinResource<Font>("LegacyRuntime.ttf");
|
||||
if (standardFont == null)
|
||||
standardFont = Resources.GetBuiltinResource<Font>("Arial.ttf");
|
||||
|
||||
uiResources = new DefaultControls.Resources
|
||||
{
|
||||
@@ -30,7 +32,7 @@ public static class PauseMenuBuilder
|
||||
// Открываем сцену геймплея
|
||||
Scene gameplayScene = EditorSceneManager.OpenScene("Assets/Scenes/SampleScene.unity", OpenSceneMode.Single);
|
||||
|
||||
// Проверяем, есть ли уже EventSystem
|
||||
// Проверяем EventSystem
|
||||
if (Object.FindAnyObjectByType<EventSystem>() == null)
|
||||
{
|
||||
GameObject esGo = new GameObject("EventSystem");
|
||||
@@ -38,26 +40,15 @@ public static class PauseMenuBuilder
|
||||
esGo.AddComponent<InputSystemUIInputModule>();
|
||||
}
|
||||
|
||||
// Удаляем старый PauseMenu, если был (но сохраняем если есть продвинутый PauseRootPanel)
|
||||
// Пересоздаем PauseCanvas
|
||||
var old = GameObject.Find("PauseCanvas");
|
||||
if (old != null && old.transform.Find("PauseRootPanel") != null)
|
||||
{
|
||||
var existingPm = old.GetComponent<PauseMenu>();
|
||||
if (existingPm == null) existingPm = old.AddComponent<PauseMenu>();
|
||||
existingPm.AutoWireUI();
|
||||
DeathScreenBuilder.Build();
|
||||
EditorSceneManager.SaveScene(gameplayScene);
|
||||
Debug.Log("[PauseMenuBuilder] PauseRootPanel обнаружен и успешно настроен в SampleScene.unity");
|
||||
return "SUCCESS: PauseRootPanel configured!";
|
||||
}
|
||||
|
||||
if (old != null) Object.DestroyImmediate(old);
|
||||
|
||||
// Создаем Canvas паузы
|
||||
GameObject canvasGo = new GameObject("PauseCanvas");
|
||||
Canvas canvas = canvasGo.AddComponent<Canvas>();
|
||||
canvas.renderMode = RenderMode.ScreenSpaceOverlay;
|
||||
canvas.sortingOrder = 100; // Поверх всего
|
||||
canvas.sortingOrder = 100; // Поверх игрового мира
|
||||
|
||||
CanvasScaler scaler = canvasGo.AddComponent<CanvasScaler>();
|
||||
scaler.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize;
|
||||
@@ -69,32 +60,40 @@ public static class PauseMenuBuilder
|
||||
|
||||
PauseMenu pauseMenu = canvasGo.AddComponent<PauseMenu>();
|
||||
|
||||
// 1. Панель паузы (PauseMenuPanel)
|
||||
// Цвета стилистики Главного Меню (Synthesia Minimalist Black & Yellow)
|
||||
Color yellowBtnNormal = new Color(0.95f, 0.78f, 0.12f, 1.00f);
|
||||
Color yellowBtnHover = new Color(1.00f, 0.90f, 0.35f, 1.00f);
|
||||
Color yellowBtnPress = new Color(0.78f, 0.62f, 0.08f, 1.00f);
|
||||
Color blackBtnText = new Color(0.06f, 0.06f, 0.06f, 1.00f);
|
||||
|
||||
// ==========================================
|
||||
// 1. КАРТОЧКА МЕНЮ ПАУЗЫ (PauseMenuPanel)
|
||||
// ==========================================
|
||||
GameObject pausePanel = CreateImage("PauseMenuPanel", canvasGo.transform,
|
||||
new Color(0.02f, 0.035f, 0.055f, 0.88f),
|
||||
new Color(0.0f, 0.0f, 0.0f, 0.88f),
|
||||
Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero);
|
||||
|
||||
GameObject card = CreateImage("Pause_Card", pausePanel.transform,
|
||||
new Color(0.06f, 0.09f, 0.14f, 0.98f),
|
||||
GameObject pauseCard = CreateImage("Pause_Card", pausePanel.transform,
|
||||
new Color(0.04f, 0.04f, 0.04f, 0.98f),
|
||||
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f),
|
||||
new Vector2(460f, 520f), Vector2.zero);
|
||||
new Vector2(480f, 560f), Vector2.zero);
|
||||
|
||||
Outline outline = card.AddComponent<Outline>();
|
||||
outline.effectColor = new Color(0.00f, 0.85f, 0.95f, 0.45f);
|
||||
outline.effectDistance = new Vector2(2f, -2f);
|
||||
Outline cardOutline = pauseCard.AddComponent<Outline>();
|
||||
cardOutline.effectColor = new Color(1.00f, 0.85f, 0.10f, 0.55f);
|
||||
cardOutline.effectDistance = new Vector2(2f, -2f);
|
||||
|
||||
CreateText("Pause_Title", card.transform,
|
||||
CreateText("Pause_Title", pauseCard.transform,
|
||||
"ПАУЗА",
|
||||
34, FontStyle.Bold, TextAnchor.MiddleCenter,
|
||||
new Color(0.92f, 0.97f, 1f, 1f),
|
||||
new Vector2(0.05f, 0.84f), new Vector2(0.95f, 0.96f), Vector2.zero, Vector2.zero);
|
||||
new Color(1.00f, 0.85f, 0.10f, 1.0f),
|
||||
new Vector2(0.05f, 0.86f), new Vector2(0.95f, 0.97f), Vector2.zero, Vector2.zero);
|
||||
|
||||
CreateImage("Pause_Divider", card.transform,
|
||||
new Color(0.00f, 0.85f, 0.95f, 0.40f),
|
||||
new Vector2(0.10f, 0.82f), new Vector2(0.90f, 0.825f), Vector2.zero, Vector2.zero);
|
||||
CreateImage("Pause_Divider", pauseCard.transform,
|
||||
new Color(1.00f, 0.85f, 0.10f, 0.40f),
|
||||
new Vector2(0.08f, 0.84f), new Vector2(0.92f, 0.845f), Vector2.zero, Vector2.zero);
|
||||
|
||||
GameObject btnContainer = CreateEmptyRect("Buttons_Container", card.transform,
|
||||
new Vector2(0.08f, 0.06f), new Vector2(0.92f, 0.78f), Vector2.zero, Vector2.zero);
|
||||
GameObject btnContainer = CreateEmptyRect("Buttons_Container", pauseCard.transform,
|
||||
new Vector2(0.08f, 0.05f), new Vector2(0.92f, 0.81f), Vector2.zero, Vector2.zero);
|
||||
|
||||
VerticalLayoutGroup vLayout = btnContainer.AddComponent<VerticalLayoutGroup>();
|
||||
vLayout.spacing = 16f;
|
||||
@@ -104,139 +103,151 @@ public static class PauseMenuBuilder
|
||||
vLayout.childForceExpandWidth = true;
|
||||
vLayout.childForceExpandHeight = false;
|
||||
|
||||
// Кнопки меню паузы
|
||||
Button resumeBtn = CreateStyledButton("Btn_Resume", btnContainer.transform,
|
||||
"► ПРОДОЛЖИТЬ",
|
||||
new Color(0.08f, 0.22f, 0.32f, 0.95f),
|
||||
new Color(0.00f, 0.65f, 0.85f, 1.0f),
|
||||
new Color(0.04f, 0.14f, 0.22f, 1.0f),
|
||||
new Color(0.90f, 0.98f, 1.0f, 1.0f),
|
||||
60f, 22);
|
||||
yellowBtnNormal, yellowBtnHover, yellowBtnPress, blackBtnText, 62f, 20);
|
||||
|
||||
Button settingsBtn = CreateStyledButton("Btn_Settings", btnContainer.transform,
|
||||
"⚙ НАСТРОЙКИ",
|
||||
new Color(0.07f, 0.12f, 0.18f, 0.90f),
|
||||
new Color(0.18f, 0.38f, 0.52f, 1.0f),
|
||||
new Color(0.04f, 0.08f, 0.12f, 1.0f),
|
||||
new Color(0.85f, 0.92f, 0.98f, 1.0f),
|
||||
56f, 20);
|
||||
yellowBtnNormal, yellowBtnHover, yellowBtnPress, blackBtnText, 62f, 20);
|
||||
|
||||
Button restartBtn = CreateStyledButton("Btn_Restart", btnContainer.transform,
|
||||
"↺ ЗАНОВО",
|
||||
yellowBtnNormal, yellowBtnHover, yellowBtnPress, blackBtnText, 62f, 20);
|
||||
|
||||
Button menuBtn = CreateStyledButton("Btn_MainMenu", btnContainer.transform,
|
||||
"⌂ ГЛАВНОЕ МЕНЮ",
|
||||
new Color(0.07f, 0.12f, 0.18f, 0.90f),
|
||||
new Color(0.18f, 0.38f, 0.52f, 1.0f),
|
||||
new Color(0.04f, 0.08f, 0.12f, 1.0f),
|
||||
new Color(0.85f, 0.92f, 0.98f, 1.0f),
|
||||
56f, 20);
|
||||
yellowBtnNormal, yellowBtnHover, yellowBtnPress, blackBtnText, 62f, 20);
|
||||
|
||||
Button quitBtn = CreateStyledButton("Btn_Quit", btnContainer.transform,
|
||||
"✖ ВЫХОД ИЗ ИГРЫ",
|
||||
new Color(0.18f, 0.08f, 0.10f, 0.90f),
|
||||
new Color(0.55f, 0.16f, 0.22f, 1.0f),
|
||||
new Color(0.10f, 0.04f, 0.06f, 1.0f),
|
||||
new Color(0.95f, 0.85f, 0.85f, 1.0f),
|
||||
56f, 20);
|
||||
new Color(0.35f, 0.15f, 0.15f, 1.0f),
|
||||
new Color(0.50f, 0.20f, 0.20f, 1.0f),
|
||||
new Color(0.65f, 0.25f, 0.25f, 1.0f),
|
||||
Color.white, 62f, 20);
|
||||
|
||||
// 2. Панель настроек (SettingsPanel)
|
||||
// ==========================================
|
||||
// 2. ПАНЕЛЬ НАСТРОЕК (SettingsPanel) - ТОЧНО КАК В ГЛАВНОМ МЕНЮ
|
||||
// ==========================================
|
||||
GameObject settingsPanel = CreateEmptyRect("SettingsPanel", canvasGo.transform,
|
||||
Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero);
|
||||
|
||||
CreateImage("Backdrop_Dim", settingsPanel.transform,
|
||||
new Color(0.01f, 0.02f, 0.03f, 0.80f),
|
||||
new Color(0.0f, 0.0f, 0.0f, 0.92f),
|
||||
Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero);
|
||||
|
||||
GameObject settingsCard = CreateImage("Settings_Card", settingsPanel.transform,
|
||||
new Color(0.05f, 0.08f, 0.12f, 0.98f),
|
||||
new Color(0.04f, 0.04f, 0.04f, 0.98f),
|
||||
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f),
|
||||
new Vector2(880f, 680f), Vector2.zero);
|
||||
new Vector2(920f, 740f), Vector2.zero);
|
||||
|
||||
Outline setOutline = settingsCard.AddComponent<Outline>();
|
||||
setOutline.effectColor = new Color(0.00f, 0.85f, 0.95f, 0.50f);
|
||||
setOutline.effectDistance = new Vector2(2f, -2f);
|
||||
Outline panelOutline = settingsCard.AddComponent<Outline>();
|
||||
panelOutline.effectColor = new Color(1.00f, 0.85f, 0.10f, 0.55f);
|
||||
panelOutline.effectDistance = new Vector2(2f, -2f);
|
||||
|
||||
CreateText("Settings_Header", settingsCard.transform,
|
||||
"НАСТРОЙКИ",
|
||||
28, FontStyle.Bold, TextAnchor.MiddleCenter,
|
||||
new Color(0.90f, 0.97f, 1.0f, 1.0f),
|
||||
new Color(1.00f, 0.85f, 0.10f, 1.0f),
|
||||
new Vector2(0.05f, 0.90f), new Vector2(0.95f, 0.98f), Vector2.zero, Vector2.zero);
|
||||
|
||||
CreateImage("Settings_Divider", settingsCard.transform,
|
||||
new Color(0.00f, 0.85f, 0.95f, 0.35f),
|
||||
new Color(1.00f, 0.85f, 0.10f, 0.40f),
|
||||
new Vector2(0.05f, 0.89f), new Vector2(0.95f, 0.895f), Vector2.zero, Vector2.zero);
|
||||
|
||||
GameObject settingsList = CreateEmptyRect("Settings_List", settingsCard.transform,
|
||||
new Vector2(0.06f, 0.14f), new Vector2(0.94f, 0.87f), Vector2.zero, Vector2.zero);
|
||||
|
||||
VerticalLayoutGroup sLayout = settingsList.AddComponent<VerticalLayoutGroup>();
|
||||
sLayout.spacing = 16f;
|
||||
sLayout.childAlignment = TextAnchor.UpperCenter;
|
||||
sLayout.childControlWidth = true;
|
||||
sLayout.childControlHeight = false;
|
||||
sLayout.childForceExpandWidth = true;
|
||||
sLayout.childForceExpandHeight = false;
|
||||
VerticalLayoutGroup settingsLayout = settingsList.AddComponent<VerticalLayoutGroup>();
|
||||
settingsLayout.spacing = 15f;
|
||||
settingsLayout.childAlignment = TextAnchor.UpperCenter;
|
||||
settingsLayout.childControlWidth = true;
|
||||
settingsLayout.childControlHeight = false;
|
||||
settingsLayout.childForceExpandWidth = true;
|
||||
settingsLayout.childForceExpandHeight = false;
|
||||
|
||||
// Разделы
|
||||
CreateCategoryHeader("HEADER_AUDIO", settingsList.transform, "— АУДИО —");
|
||||
var volumeRow = CreateSliderRow("Row_Volume", settingsList.transform, "Общая громкость", 0f, 1f, 1f, "%");
|
||||
Toggle muteToggle = CreateToggleRow("Row_Mute", settingsList.transform, "Отключить звук");
|
||||
// --- Раздел: Звук ---
|
||||
CreateCategoryHeader("HEADER_AUDIO", settingsList.transform, "— ЗВУК И ЭХОЛОКАЦИЯ —");
|
||||
|
||||
var volumeRow = CreateSliderRow("Row_Volume", settingsList.transform, "Громкость звука", 0f, 1f, 1f, "%");
|
||||
Slider volSlider = volumeRow.slider;
|
||||
Text volText = volumeRow.valueText;
|
||||
|
||||
Toggle muteToggle = CreateToggleRow("Row_Mute", settingsList.transform, "Отключить звук (Mute)");
|
||||
|
||||
// --- Раздел: Графика ---
|
||||
CreateCategoryHeader("HEADER_GRAPHICS", settingsList.transform, "— ГРАФИКА —");
|
||||
|
||||
Dropdown qualityDropdown = CreateDropdownRow("Row_Quality", settingsList.transform, "Качество графики");
|
||||
Toggle fullscreenToggle = CreateToggleRow("Row_Fullscreen", settingsList.transform, "Полноэкранный режим");
|
||||
Dropdown resolutionDropdown = CreateDropdownRow("Row_Resolution", settingsList.transform, "Разрешение экрана");
|
||||
|
||||
// --- Раздел: Управление ---
|
||||
CreateCategoryHeader("HEADER_CONTROLS", settingsList.transform, "— УПРАВЛЕНИЕ —");
|
||||
var sensRow = CreateSliderRow("Row_Sensitivity", settingsList.transform, "Чувствительность мыши", 0.2f, 3.0f, 1.0f, "x");
|
||||
|
||||
GameObject botRow = CreateEmptyRect("Settings_BottomButtons", settingsCard.transform,
|
||||
var sensRow = CreateSliderRow("Row_Sensitivity", settingsList.transform, "Чувствительность мыши", 0.2f, 3.0f, 1.0f, "x");
|
||||
Slider sensSlider = sensRow.slider;
|
||||
Text sensText = sensRow.valueText;
|
||||
|
||||
// Нижняя строка кнопок в панели настроек
|
||||
GameObject bottomButtonsRow = CreateEmptyRect("Settings_BottomButtons", settingsCard.transform,
|
||||
new Vector2(0.06f, 0.03f), new Vector2(0.94f, 0.12f), Vector2.zero, Vector2.zero);
|
||||
|
||||
HorizontalLayoutGroup bLayout = botRow.AddComponent<HorizontalLayoutGroup>();
|
||||
bLayout.spacing = 30f;
|
||||
bLayout.childAlignment = TextAnchor.MiddleCenter;
|
||||
bLayout.childControlWidth = true;
|
||||
bLayout.childControlHeight = true;
|
||||
HorizontalLayoutGroup bottomLayout = bottomButtonsRow.AddComponent<HorizontalLayoutGroup>();
|
||||
bottomLayout.spacing = 30f;
|
||||
bottomLayout.childAlignment = TextAnchor.MiddleCenter;
|
||||
bottomLayout.childControlWidth = true;
|
||||
bottomLayout.childControlHeight = true;
|
||||
bottomLayout.childForceExpandWidth = true;
|
||||
bottomLayout.childForceExpandHeight = true;
|
||||
|
||||
Button backBtn = CreateStyledButton("Button_Back", botRow.transform,
|
||||
"✔ НАЗАД В ПАУЗУ",
|
||||
new Color(0.08f, 0.22f, 0.30f, 0.95f),
|
||||
new Color(0.00f, 0.65f, 0.85f, 1.0f),
|
||||
new Color(0.05f, 0.14f, 0.20f, 1.0f),
|
||||
new Color(0.90f, 0.98f, 1.0f, 1.0f),
|
||||
48f, 18);
|
||||
Button resetBtn = CreateStyledButton("Button_ResetDefaults", bottomButtonsRow.transform,
|
||||
"Сброс",
|
||||
new Color(0.35f, 0.15f, 0.15f, 1.0f),
|
||||
new Color(0.50f, 0.20f, 0.20f, 1.0f),
|
||||
new Color(0.65f, 0.25f, 0.25f, 1.0f),
|
||||
Color.white,
|
||||
50f, 18);
|
||||
|
||||
// Привязываем ссылки
|
||||
Button backBtn = CreateStyledButton("Button_Back", bottomButtonsRow.transform,
|
||||
"Применить и выйти",
|
||||
yellowBtnNormal, yellowBtnHover, yellowBtnPress, blackBtnText,
|
||||
50f, 18);
|
||||
|
||||
// ==========================================
|
||||
// 3. ПРИВЯЗКА К СИСТЕМЕ PAUSEMENU
|
||||
// ==========================================
|
||||
pauseMenu.pauseMenuPanel = pausePanel;
|
||||
pauseMenu.settingsPanel = settingsPanel;
|
||||
pauseMenu.resumeButton = resumeBtn;
|
||||
pauseMenu.settingsButton = settingsBtn;
|
||||
pauseMenu.restartButton = restartBtn;
|
||||
pauseMenu.mainMenuButton = menuBtn;
|
||||
pauseMenu.quitButton = quitBtn;
|
||||
pauseMenu.backFromSettingsButton = backBtn;
|
||||
pauseMenu.resetDefaultsButton = resetBtn;
|
||||
|
||||
pauseMenu.volumeSlider = volumeRow.slider;
|
||||
pauseMenu.volumeValueText = volumeRow.valueText;
|
||||
pauseMenu.volumeSlider = volSlider;
|
||||
pauseMenu.volumeValueText = volText;
|
||||
pauseMenu.muteToggle = muteToggle;
|
||||
|
||||
pauseMenu.qualityDropdown = qualityDropdown;
|
||||
pauseMenu.fullscreenToggle = fullscreenToggle;
|
||||
|
||||
pauseMenu.sensitivitySlider = sensRow.slider;
|
||||
pauseMenu.sensitivityValueText = sensRow.valueText;
|
||||
|
||||
UnityEditor.Events.UnityEventTools.AddPersistentListener(resumeBtn.onClick, pauseMenu.ResumeGame);
|
||||
UnityEditor.Events.UnityEventTools.AddPersistentListener(settingsBtn.onClick, pauseMenu.OpenSettings);
|
||||
UnityEditor.Events.UnityEventTools.AddPersistentListener(menuBtn.onClick, pauseMenu.ReturnToMainMenu);
|
||||
UnityEditor.Events.UnityEventTools.AddPersistentListener(quitBtn.onClick, pauseMenu.QuitGame);
|
||||
UnityEditor.Events.UnityEventTools.AddPersistentListener(backBtn.onClick, pauseMenu.CloseSettings);
|
||||
pauseMenu.resolutionDropdown = resolutionDropdown;
|
||||
pauseMenu.sensitivitySlider = sensSlider;
|
||||
pauseMenu.sensitivityValueText = sensText;
|
||||
|
||||
pausePanel.SetActive(false);
|
||||
settingsPanel.SetActive(false);
|
||||
|
||||
// Строим DeathScreenPanel в PauseCanvas
|
||||
// Также гарантируем экран смерти
|
||||
DeathScreenBuilder.Build();
|
||||
|
||||
// Сохраняем сцену геймплея
|
||||
EditorSceneManager.MarkSceneDirty(gameplayScene);
|
||||
EditorSceneManager.SaveScene(gameplayScene);
|
||||
Debug.Log("[PauseMenuBuilder] PauseMenu успешно добавлен в SampleScene.unity");
|
||||
Debug.Log("[PauseMenuBuilder] PauseCanvas в стиле MainMenu успешно создан и сохранен в SampleScene.unity");
|
||||
|
||||
// Открываем обратно сцену MainMenu
|
||||
EditorSceneManager.OpenScene("Assets/Scenes/MainMenu.unity", OpenSceneMode.Single);
|
||||
|
||||
return "SUCCESS: PauseMenu added to SampleScene and MainMenu restored!";
|
||||
return "SUCCESS: PauseMenu rebuilt with separate Settings panel matching MainMenu style!";
|
||||
}
|
||||
|
||||
#region Хелперы UI
|
||||
@@ -258,8 +269,6 @@ public static class PauseMenuBuilder
|
||||
GameObject go = CreateEmptyRect(name, parent, anchorMin, anchorMax, sizeDelta, anchoredPosition);
|
||||
Image img = go.AddComponent<Image>();
|
||||
img.color = color;
|
||||
img.sprite = uiResources.background;
|
||||
img.type = Image.Type.Sliced;
|
||||
return go;
|
||||
}
|
||||
|
||||
@@ -273,7 +282,7 @@ public static class PauseMenuBuilder
|
||||
t.fontStyle = style;
|
||||
t.alignment = alignment;
|
||||
t.color = color;
|
||||
t.horizontalOverflow = HorizontalWrapMode.Wrap;
|
||||
t.horizontalOverflow = HorizontalWrapMode.Overflow;
|
||||
t.verticalOverflow = VerticalWrapMode.Overflow;
|
||||
return go;
|
||||
}
|
||||
@@ -284,6 +293,12 @@ public static class PauseMenuBuilder
|
||||
btnObj.name = name;
|
||||
btnObj.transform.SetParent(parent, false);
|
||||
|
||||
RectTransform rt = btnObj.GetComponent<RectTransform>();
|
||||
if (rt != null)
|
||||
{
|
||||
rt.sizeDelta = new Vector2(rt.sizeDelta.x, height);
|
||||
}
|
||||
|
||||
LayoutElement layout = btnObj.AddComponent<LayoutElement>();
|
||||
layout.minHeight = height;
|
||||
layout.preferredHeight = height;
|
||||
@@ -292,6 +307,14 @@ public static class PauseMenuBuilder
|
||||
img.color = normalColor;
|
||||
img.type = Image.Type.Sliced;
|
||||
|
||||
Outline btnOutline = btnObj.AddComponent<Outline>();
|
||||
btnOutline.effectColor = new Color(1.00f, 0.95f, 0.60f, 0.65f);
|
||||
btnOutline.effectDistance = new Vector2(2f, -2f);
|
||||
|
||||
Shadow btnShadow = btnObj.AddComponent<Shadow>();
|
||||
btnShadow.effectColor = new Color(0.00f, 0.00f, 0.00f, 0.50f);
|
||||
btnShadow.effectDistance = new Vector2(2f, -2f);
|
||||
|
||||
Button btn = btnObj.GetComponent<Button>();
|
||||
ColorBlock colors = btn.colors;
|
||||
colors.normalColor = normalColor;
|
||||
@@ -311,6 +334,8 @@ public static class PauseMenuBuilder
|
||||
text.fontStyle = FontStyle.Bold;
|
||||
text.color = textColor;
|
||||
text.alignment = TextAnchor.MiddleCenter;
|
||||
text.horizontalOverflow = HorizontalWrapMode.Overflow;
|
||||
text.verticalOverflow = VerticalWrapMode.Overflow;
|
||||
}
|
||||
|
||||
return btn;
|
||||
@@ -318,10 +343,10 @@ public static class PauseMenuBuilder
|
||||
|
||||
private static void CreateCategoryHeader(string name, Transform parent, string text)
|
||||
{
|
||||
GameObject go = CreateEmptyRect(name, parent, Vector2.zero, Vector2.one, new Vector2(0f, 30f), Vector2.zero);
|
||||
GameObject go = CreateEmptyRect(name, parent, Vector2.zero, Vector2.one, new Vector2(0f, 32f), Vector2.zero);
|
||||
LayoutElement layout = go.AddComponent<LayoutElement>();
|
||||
layout.minHeight = 30f;
|
||||
layout.preferredHeight = 30f;
|
||||
layout.minHeight = 32f;
|
||||
layout.preferredHeight = 32f;
|
||||
|
||||
Text t = go.AddComponent<Text>();
|
||||
t.font = standardFont;
|
||||
@@ -329,147 +354,96 @@ public static class PauseMenuBuilder
|
||||
t.fontSize = 16;
|
||||
t.fontStyle = FontStyle.Bold;
|
||||
t.alignment = TextAnchor.MiddleLeft;
|
||||
t.color = new Color(0.00f, 0.85f, 0.95f, 0.95f);
|
||||
t.color = new Color(1.00f, 0.85f, 0.10f, 0.95f);
|
||||
}
|
||||
|
||||
private struct SliderRow
|
||||
private static (Slider slider, Text valueText) CreateSliderRow(string name, Transform parent, string label, float min, float max, float def, string unitSuffix)
|
||||
{
|
||||
public Slider slider;
|
||||
public Text valueText;
|
||||
}
|
||||
|
||||
private static SliderRow CreateSliderRow(string name, Transform parent, string label, float min, float max, float def, string unit)
|
||||
{
|
||||
GameObject row = CreateEmptyRect(name, parent, Vector2.zero, Vector2.one, new Vector2(0f, 40f), Vector2.zero);
|
||||
GameObject row = CreateEmptyRect(name, parent, Vector2.zero, Vector2.one, new Vector2(0f, 44f), Vector2.zero);
|
||||
LayoutElement layout = row.AddComponent<LayoutElement>();
|
||||
layout.minHeight = 40f;
|
||||
layout.preferredHeight = 40f;
|
||||
layout.minHeight = 44f;
|
||||
layout.preferredHeight = 44f;
|
||||
|
||||
HorizontalLayoutGroup hLayout = row.AddComponent<HorizontalLayoutGroup>();
|
||||
hLayout.spacing = 18f;
|
||||
hLayout.childAlignment = TextAnchor.MiddleLeft;
|
||||
hLayout.childControlWidth = false;
|
||||
hLayout.childControlHeight = true;
|
||||
hLayout.childForceExpandWidth = false;
|
||||
hLayout.childForceExpandHeight = true;
|
||||
|
||||
GameObject lblGo = CreateEmptyRect("Label", row.transform, Vector2.zero, Vector2.one, new Vector2(260f, 40f), Vector2.zero);
|
||||
LayoutElement lblLayout = lblGo.AddComponent<LayoutElement>();
|
||||
lblLayout.minWidth = 260f;
|
||||
lblLayout.preferredWidth = 260f;
|
||||
Text lbl = lblGo.AddComponent<Text>();
|
||||
lbl.font = standardFont;
|
||||
lbl.text = label;
|
||||
lbl.fontSize = 17;
|
||||
lbl.alignment = TextAnchor.MiddleLeft;
|
||||
lbl.color = new Color(0.85f, 0.92f, 0.98f, 1f);
|
||||
CreateText("Label", row.transform, label, 16, FontStyle.Normal, TextAnchor.MiddleLeft,
|
||||
new Color(0.92f, 0.92f, 0.92f, 1f), new Vector2(0f, 0f), new Vector2(0.40f, 1f), Vector2.zero, Vector2.zero);
|
||||
|
||||
GameObject sliderObj = DefaultControls.CreateSlider(uiResources);
|
||||
sliderObj.name = "Slider";
|
||||
sliderObj.transform.SetParent(row.transform, false);
|
||||
LayoutElement sliderLayout = sliderObj.AddComponent<LayoutElement>();
|
||||
sliderLayout.minWidth = 360f;
|
||||
sliderLayout.preferredWidth = 360f;
|
||||
RectTransform sliderRt = sliderObj.GetComponent<RectTransform>();
|
||||
sliderRt.anchorMin = new Vector2(0.42f, 0.20f);
|
||||
sliderRt.anchorMax = new Vector2(0.82f, 0.80f);
|
||||
sliderRt.offsetMin = Vector2.zero;
|
||||
sliderRt.offsetMax = Vector2.zero;
|
||||
|
||||
Slider slider = sliderObj.GetComponent<Slider>();
|
||||
slider.minValue = min;
|
||||
slider.maxValue = max;
|
||||
slider.value = def;
|
||||
|
||||
GameObject valGo = CreateEmptyRect("ValueText", row.transform, Vector2.zero, Vector2.one, new Vector2(80f, 40f), Vector2.zero);
|
||||
LayoutElement valLayout = valGo.AddComponent<LayoutElement>();
|
||||
valLayout.minWidth = 80f;
|
||||
valLayout.preferredWidth = 80f;
|
||||
Text valText = valGo.AddComponent<Text>();
|
||||
valText.font = standardFont;
|
||||
valText.text = unit == "%" ? $"{Mathf.RoundToInt(def * 100)}%" : $"{def:F1}{unit}";
|
||||
valText.fontSize = 17;
|
||||
valText.fontStyle = FontStyle.Bold;
|
||||
valText.alignment = TextAnchor.MiddleCenter;
|
||||
valText.color = new Color(0.00f, 0.85f, 0.95f, 1f);
|
||||
Transform fill = sliderObj.transform.Find("Fill Area/Fill");
|
||||
if (fill != null)
|
||||
{
|
||||
var img = fill.GetComponent<Image>();
|
||||
if (img != null) img.color = new Color(1.00f, 0.85f, 0.10f, 1f);
|
||||
}
|
||||
|
||||
return new SliderRow { slider = slider, valueText = valText };
|
||||
GameObject valueTextObj = CreateText("ValueText", row.transform,
|
||||
unitSuffix == "%" ? $"{Mathf.RoundToInt(def * 100)}%" : $"{def:F1}{unitSuffix}",
|
||||
15, FontStyle.Bold, TextAnchor.MiddleRight,
|
||||
new Color(1.00f, 0.85f, 0.10f, 1f), new Vector2(0.84f, 0f), new Vector2(1f, 1f), Vector2.zero, Vector2.zero);
|
||||
|
||||
return (slider, valueTextObj.GetComponent<Text>());
|
||||
}
|
||||
|
||||
private static Toggle CreateToggleRow(string name, Transform parent, string label)
|
||||
{
|
||||
GameObject row = CreateEmptyRect(name, parent, Vector2.zero, Vector2.one, new Vector2(0f, 38f), Vector2.zero);
|
||||
GameObject row = CreateEmptyRect(name, parent, Vector2.zero, Vector2.one, new Vector2(0f, 40f), Vector2.zero);
|
||||
LayoutElement layout = row.AddComponent<LayoutElement>();
|
||||
layout.minHeight = 38f;
|
||||
layout.preferredHeight = 38f;
|
||||
layout.minHeight = 40f;
|
||||
layout.preferredHeight = 40f;
|
||||
|
||||
HorizontalLayoutGroup hLayout = row.AddComponent<HorizontalLayoutGroup>();
|
||||
hLayout.spacing = 18f;
|
||||
hLayout.childAlignment = TextAnchor.MiddleLeft;
|
||||
hLayout.childControlWidth = false;
|
||||
hLayout.childControlHeight = true;
|
||||
hLayout.childForceExpandWidth = false;
|
||||
hLayout.childForceExpandHeight = true;
|
||||
|
||||
GameObject lblGo = CreateEmptyRect("Label", row.transform, Vector2.zero, Vector2.one, new Vector2(260f, 38f), Vector2.zero);
|
||||
LayoutElement lblLayout = lblGo.AddComponent<LayoutElement>();
|
||||
lblLayout.minWidth = 260f;
|
||||
lblLayout.preferredWidth = 260f;
|
||||
Text lbl = lblGo.AddComponent<Text>();
|
||||
lbl.font = standardFont;
|
||||
lbl.text = label;
|
||||
lbl.fontSize = 17;
|
||||
lbl.alignment = TextAnchor.MiddleLeft;
|
||||
lbl.color = new Color(0.85f, 0.92f, 0.98f, 1f);
|
||||
CreateText("Label", row.transform, label, 16, FontStyle.Normal, TextAnchor.MiddleLeft,
|
||||
new Color(0.92f, 0.92f, 0.92f, 1f), new Vector2(0f, 0f), new Vector2(0.70f, 1f), Vector2.zero, Vector2.zero);
|
||||
|
||||
GameObject toggleObj = DefaultControls.CreateToggle(uiResources);
|
||||
toggleObj.name = "Toggle";
|
||||
toggleObj.transform.SetParent(row.transform, false);
|
||||
LayoutElement toggleLayout = toggleObj.AddComponent<LayoutElement>();
|
||||
toggleLayout.minWidth = 50f;
|
||||
toggleLayout.preferredWidth = 50f;
|
||||
RectTransform rt = toggleObj.GetComponent<RectTransform>();
|
||||
rt.anchorMin = new Vector2(0.85f, 0.15f);
|
||||
rt.anchorMax = new Vector2(1f, 0.85f);
|
||||
rt.offsetMin = Vector2.zero;
|
||||
rt.offsetMax = Vector2.zero;
|
||||
|
||||
Text toggleLabel = toggleObj.GetComponentInChildren<Text>();
|
||||
if (toggleLabel != null) toggleLabel.text = "";
|
||||
Text defaultLabel = toggleObj.GetComponentInChildren<Text>();
|
||||
if (defaultLabel != null) Object.DestroyImmediate(defaultLabel.gameObject);
|
||||
|
||||
return toggleObj.GetComponent<Toggle>();
|
||||
}
|
||||
|
||||
private static Dropdown CreateDropdownRow(string name, Transform parent, string label)
|
||||
{
|
||||
GameObject row = CreateEmptyRect(name, parent, Vector2.zero, Vector2.one, new Vector2(0f, 42f), Vector2.zero);
|
||||
GameObject row = CreateEmptyRect(name, parent, Vector2.zero, Vector2.one, new Vector2(0f, 44f), Vector2.zero);
|
||||
LayoutElement layout = row.AddComponent<LayoutElement>();
|
||||
layout.minHeight = 42f;
|
||||
layout.preferredHeight = 42f;
|
||||
layout.minHeight = 44f;
|
||||
layout.preferredHeight = 44f;
|
||||
|
||||
HorizontalLayoutGroup hLayout = row.AddComponent<HorizontalLayoutGroup>();
|
||||
hLayout.spacing = 18f;
|
||||
hLayout.childAlignment = TextAnchor.MiddleLeft;
|
||||
hLayout.childControlWidth = false;
|
||||
hLayout.childControlHeight = true;
|
||||
hLayout.childForceExpandWidth = false;
|
||||
hLayout.childForceExpandHeight = true;
|
||||
CreateText("Label", row.transform, label, 16, FontStyle.Normal, TextAnchor.MiddleLeft,
|
||||
new Color(0.92f, 0.92f, 0.92f, 1f), new Vector2(0f, 0f), new Vector2(0.40f, 1f), Vector2.zero, Vector2.zero);
|
||||
|
||||
GameObject lblGo = CreateEmptyRect("Label", row.transform, Vector2.zero, Vector2.one, new Vector2(260f, 42f), Vector2.zero);
|
||||
LayoutElement lblLayout = lblGo.AddComponent<LayoutElement>();
|
||||
lblLayout.minWidth = 260f;
|
||||
lblLayout.preferredWidth = 260f;
|
||||
Text lbl = lblGo.AddComponent<Text>();
|
||||
lbl.font = standardFont;
|
||||
lbl.text = label;
|
||||
lbl.fontSize = 17;
|
||||
lbl.alignment = TextAnchor.MiddleLeft;
|
||||
lbl.color = new Color(0.85f, 0.92f, 0.98f, 1f);
|
||||
GameObject ddObj = DefaultControls.CreateDropdown(uiResources);
|
||||
ddObj.name = "Dropdown";
|
||||
ddObj.transform.SetParent(row.transform, false);
|
||||
RectTransform rt = ddObj.GetComponent<RectTransform>();
|
||||
rt.anchorMin = new Vector2(0.42f, 0.10f);
|
||||
rt.anchorMax = new Vector2(1f, 0.90f);
|
||||
rt.offsetMin = Vector2.zero;
|
||||
rt.offsetMax = Vector2.zero;
|
||||
|
||||
GameObject dropdownObj = DefaultControls.CreateDropdown(uiResources);
|
||||
dropdownObj.name = "Dropdown";
|
||||
dropdownObj.transform.SetParent(row.transform, false);
|
||||
LayoutElement ddLayout = dropdownObj.AddComponent<LayoutElement>();
|
||||
ddLayout.minWidth = 380f;
|
||||
ddLayout.preferredWidth = 380f;
|
||||
Image img = ddObj.GetComponent<Image>();
|
||||
if (img != null) img.color = new Color(0.12f, 0.12f, 0.12f, 1f);
|
||||
|
||||
Dropdown dropdown = dropdownObj.GetComponent<Dropdown>();
|
||||
Text caption = dropdown.captionText;
|
||||
if (caption != null) caption.font = standardFont;
|
||||
Text item = dropdown.itemText;
|
||||
if (item != null) item.font = standardFont;
|
||||
|
||||
return dropdown;
|
||||
return ddObj.GetComponent<Dropdown>();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -0,0 +1,297 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
/// <summary>
|
||||
/// Терминал лифта: ввод 4-значного кода доступа для перехода на 2-й уровень.
|
||||
/// </summary>
|
||||
public class ElevatorKeypadUI : MonoBehaviour
|
||||
{
|
||||
private static ElevatorKeypadUI _instance;
|
||||
public static ElevatorKeypadUI Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = Object.FindAnyObjectByType<ElevatorKeypadUI>(FindObjectsInactive.Include);
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
[Header("Корневая панель")]
|
||||
[SerializeField] private GameObject keypadPanelRoot;
|
||||
|
||||
[Header("Слоты для отображения цифр")]
|
||||
[SerializeField] private Text[] digitSlots = new Text[4];
|
||||
[SerializeField] private Image[] digitSlotBorders = new Image[4];
|
||||
|
||||
[Header("Статусная строка")]
|
||||
[SerializeField] private Text statusText;
|
||||
|
||||
[Header("Кнопки клавиатуры")]
|
||||
[SerializeField] private Button[] numberButtons; // 0..9
|
||||
[SerializeField] private Button clearButton;
|
||||
[SerializeField] private Button enterButton;
|
||||
[SerializeField] private Button exitButton;
|
||||
|
||||
[Header("Цвета статуса")]
|
||||
public Color normalStatusColor = new Color(1.0f, 0.85f, 0.1f, 1.0f);
|
||||
public Color errorStatusColor = new Color(1.0f, 0.25f, 0.25f, 1.0f);
|
||||
public Color successStatusColor = new Color(0.2f, 1.0f, 0.4f, 1.0f);
|
||||
|
||||
private string enteredCode = "";
|
||||
private bool isOpen = false;
|
||||
private bool isLockedSuccess = false;
|
||||
|
||||
public bool IsOpen => isOpen;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_instance = this;
|
||||
if (keypadPanelRoot == null)
|
||||
keypadPanelRoot = gameObject;
|
||||
|
||||
SetupButtons();
|
||||
}
|
||||
|
||||
private void SetupButtons()
|
||||
{
|
||||
if (numberButtons != null)
|
||||
{
|
||||
for (int i = 0; i < numberButtons.Length; i++)
|
||||
{
|
||||
int num = i;
|
||||
if (numberButtons[i] != null)
|
||||
{
|
||||
numberButtons[i].onClick.RemoveAllListeners();
|
||||
numberButtons[i].onClick.AddListener(() => OnNumberPressed(num));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (clearButton != null)
|
||||
{
|
||||
clearButton.onClick.RemoveAllListeners();
|
||||
clearButton.onClick.AddListener(OnClearPressed);
|
||||
}
|
||||
|
||||
if (enterButton != null)
|
||||
{
|
||||
enterButton.onClick.RemoveAllListeners();
|
||||
enterButton.onClick.AddListener(OnEnterPressed);
|
||||
}
|
||||
|
||||
if (exitButton != null)
|
||||
{
|
||||
exitButton.onClick.RemoveAllListeners();
|
||||
exitButton.onClick.AddListener(CloseKeypad);
|
||||
}
|
||||
}
|
||||
|
||||
private int openFrame = -1;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!isOpen) return;
|
||||
if (Time.frameCount == openFrame) return;
|
||||
|
||||
HandleKeyboardInput();
|
||||
}
|
||||
|
||||
private void HandleKeyboardInput()
|
||||
{
|
||||
var keyboard = Keyboard.current;
|
||||
if (keyboard != null)
|
||||
{
|
||||
if (keyboard.escapeKey.wasPressedThisFrame)
|
||||
{
|
||||
CloseKeypad();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isLockedSuccess)
|
||||
{
|
||||
if (keyboard.digit0Key.wasPressedThisFrame || keyboard.numpad0Key.wasPressedThisFrame) OnNumberPressed(0);
|
||||
else if (keyboard.digit1Key.wasPressedThisFrame || keyboard.numpad1Key.wasPressedThisFrame) OnNumberPressed(1);
|
||||
else if (keyboard.digit2Key.wasPressedThisFrame || keyboard.numpad2Key.wasPressedThisFrame) OnNumberPressed(2);
|
||||
else if (keyboard.digit3Key.wasPressedThisFrame || keyboard.numpad3Key.wasPressedThisFrame) OnNumberPressed(3);
|
||||
else if (keyboard.digit4Key.wasPressedThisFrame || keyboard.numpad4Key.wasPressedThisFrame) OnNumberPressed(4);
|
||||
else if (keyboard.digit5Key.wasPressedThisFrame || keyboard.numpad5Key.wasPressedThisFrame) OnNumberPressed(5);
|
||||
else if (keyboard.digit6Key.wasPressedThisFrame || keyboard.numpad6Key.wasPressedThisFrame) OnNumberPressed(6);
|
||||
else if (keyboard.digit7Key.wasPressedThisFrame || keyboard.numpad7Key.wasPressedThisFrame) OnNumberPressed(7);
|
||||
else if (keyboard.digit8Key.wasPressedThisFrame || keyboard.numpad8Key.wasPressedThisFrame) OnNumberPressed(8);
|
||||
else if (keyboard.digit9Key.wasPressedThisFrame || keyboard.numpad9Key.wasPressedThisFrame) OnNumberPressed(9);
|
||||
|
||||
if (keyboard.backspaceKey.wasPressedThisFrame || keyboard.deleteKey.wasPressedThisFrame || keyboard.cKey.wasPressedThisFrame)
|
||||
{
|
||||
OnBackspacePressed();
|
||||
}
|
||||
|
||||
if (keyboard.enterKey.wasPressedThisFrame || keyboard.numpadEnterKey.wasPressedThisFrame)
|
||||
{
|
||||
OnEnterPressed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLE_LEGACY_INPUT_MANAGER
|
||||
if (Input.GetKeyDown(KeyCode.Escape))
|
||||
{
|
||||
CloseKeypad();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public void OpenKeypad()
|
||||
{
|
||||
openFrame = Time.frameCount;
|
||||
|
||||
if (!gameObject.activeSelf) gameObject.SetActive(true);
|
||||
if (keypadPanelRoot != null && !keypadPanelRoot.activeSelf)
|
||||
keypadPanelRoot.SetActive(true);
|
||||
|
||||
isOpen = true;
|
||||
Time.timeScale = 0f;
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
Cursor.visible = true;
|
||||
|
||||
enteredCode = "";
|
||||
UpdateDisplay();
|
||||
SetStatus("ВВЕДИТЕ 4-ЗНАЧНЫЙ КОД ДОСТУПА", normalStatusColor);
|
||||
|
||||
GameAudioSynthesizer.PlayKeypadBeep();
|
||||
}
|
||||
|
||||
public void CloseKeypad()
|
||||
{
|
||||
if (!isOpen) return;
|
||||
|
||||
isOpen = false;
|
||||
if (keypadPanelRoot != null)
|
||||
keypadPanelRoot.SetActive(false);
|
||||
|
||||
Time.timeScale = 1f;
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
Cursor.visible = false;
|
||||
|
||||
GameAudioSynthesizer.PlayKeypadClear();
|
||||
}
|
||||
|
||||
public void OnNumberPressed(int number)
|
||||
{
|
||||
if (isLockedSuccess) return;
|
||||
|
||||
if (enteredCode.Length < 4)
|
||||
{
|
||||
enteredCode += number.ToString();
|
||||
GameAudioSynthesizer.PlayKeypadBeep();
|
||||
UpdateDisplay();
|
||||
|
||||
if (enteredCode.Length == 4)
|
||||
{
|
||||
SetStatus("НАЖМИТЕ [ВВОД / ENTER] ДЛЯ ПРОВЕРКИ", normalStatusColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnBackspacePressed()
|
||||
{
|
||||
if (isLockedSuccess) return;
|
||||
|
||||
if (enteredCode.Length > 0)
|
||||
{
|
||||
enteredCode = enteredCode.Substring(0, enteredCode.Length - 1);
|
||||
GameAudioSynthesizer.PlayKeypadClear();
|
||||
UpdateDisplay();
|
||||
SetStatus("ВВЕДИТЕ 4-ЗНАЧНЫЙ КОД ДОСТУПА", normalStatusColor);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnClearPressed()
|
||||
{
|
||||
if (isLockedSuccess) return;
|
||||
|
||||
enteredCode = "";
|
||||
GameAudioSynthesizer.PlayKeypadClear();
|
||||
UpdateDisplay();
|
||||
SetStatus("КОД СБРОШЕН. ВВЕДИТЕ ЗАНОВО", normalStatusColor);
|
||||
}
|
||||
|
||||
public void OnEnterPressed()
|
||||
{
|
||||
if (isLockedSuccess) return;
|
||||
|
||||
if (enteredCode.Length != 4)
|
||||
{
|
||||
SetStatus("ОШИБКА: ТРЕБУЕТСЯ 4 ЦИФРЫ!", errorStatusColor);
|
||||
GameAudioSynthesizer.PlayErrorCode();
|
||||
return;
|
||||
}
|
||||
|
||||
if (LevelCodeManager.Instance != null && LevelCodeManager.Instance.ValidateCode(enteredCode))
|
||||
{
|
||||
isLockedSuccess = true;
|
||||
SetStatus("ДОСТУП РАЗРЕШЕН! ЗАПУСК ЛИФТА НА УРОВЕНЬ 2...", successStatusColor);
|
||||
GameAudioSynthesizer.PlaySuccessChime();
|
||||
StartCoroutine(RoutineSuccessTransition());
|
||||
}
|
||||
else
|
||||
{
|
||||
SetStatus("ОТКАЗ В ДОСТУПЕ! НЕВЕРНЫЙ КОД", errorStatusColor);
|
||||
GameAudioSynthesizer.PlayErrorCode();
|
||||
StartCoroutine(RoutineWrongCodeShake());
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator RoutineWrongCodeShake()
|
||||
{
|
||||
yield return new WaitForSecondsRealtime(0.8f);
|
||||
enteredCode = "";
|
||||
UpdateDisplay();
|
||||
SetStatus("ВВЕДИТЕ 4-ЗНАЧНЫЙ КОД ДОСТУПА", normalStatusColor);
|
||||
}
|
||||
|
||||
private IEnumerator RoutineSuccessTransition()
|
||||
{
|
||||
yield return new WaitForSecondsRealtime(1.8f);
|
||||
CloseKeypad();
|
||||
|
||||
if (LevelSuccessUI.Instance != null)
|
||||
{
|
||||
LevelSuccessUI.Instance.ShowSuccessScreen();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateDisplay()
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (digitSlots != null && i < digitSlots.Length && digitSlots[i] != null)
|
||||
{
|
||||
if (i < enteredCode.Length)
|
||||
{
|
||||
digitSlots[i].text = enteredCode[i].ToString();
|
||||
digitSlots[i].color = new Color(1.0f, 0.85f, 0.1f, 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
digitSlots[i].text = "_";
|
||||
digitSlots[i].color = new Color(0.4f, 0.4f, 0.4f, 0.7f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetStatus(string text, Color color)
|
||||
{
|
||||
if (statusText != null)
|
||||
{
|
||||
statusText.text = text;
|
||||
statusText.color = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b5ad50222d8ef14448d5a544b3d27998
|
||||
@@ -0,0 +1,163 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
/// <summary>
|
||||
/// Терминал лифта в 3D мире.
|
||||
/// Игрок может подойти, увидеть подсказку и нажать [E] для открытия UI цифрового ввода кода.
|
||||
/// </summary>
|
||||
public class ElevatorTerminal : MonoBehaviour
|
||||
{
|
||||
[Header("Дистанция взаимодействия")]
|
||||
public float interactionDistance = 3.8f;
|
||||
|
||||
[Header("Индикаторы")]
|
||||
public Light statusLight;
|
||||
public MeshRenderer screenRenderer;
|
||||
|
||||
private static Transform cachedPlayerTransform;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
LocatePlayer();
|
||||
UpdateLightColor(false);
|
||||
|
||||
if (LevelCodeManager.Instance != null)
|
||||
{
|
||||
LevelCodeManager.Instance.OnElevatorUnlocked += HandleUnlocked;
|
||||
}
|
||||
|
||||
var col = GetComponent<Collider>();
|
||||
if (col == null)
|
||||
{
|
||||
var sc = gameObject.AddComponent<SphereCollider>();
|
||||
sc.isTrigger = true;
|
||||
sc.radius = interactionDistance;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (LevelCodeManager.Instance != null)
|
||||
{
|
||||
LevelCodeManager.Instance.OnElevatorUnlocked -= HandleUnlocked;
|
||||
}
|
||||
}
|
||||
|
||||
private Transform LocatePlayer()
|
||||
{
|
||||
if (cachedPlayerTransform != null) return cachedPlayerTransform;
|
||||
|
||||
var pm = Object.FindAnyObjectByType<PlayerMovement>();
|
||||
if (pm != null) { cachedPlayerTransform = pm.transform; return cachedPlayerTransform; }
|
||||
|
||||
var ph = Object.FindAnyObjectByType<PlayerHealth>();
|
||||
if (ph != null) { cachedPlayerTransform = ph.transform; return cachedPlayerTransform; }
|
||||
|
||||
var pTag = GameObject.FindWithTag("Player");
|
||||
if (pTag != null) { cachedPlayerTransform = pTag.transform; return cachedPlayerTransform; }
|
||||
|
||||
var pName = GameObject.Find("Player");
|
||||
if (pName != null) { cachedPlayerTransform = pName.transform; return cachedPlayerTransform; }
|
||||
|
||||
if (Camera.main != null) { return Camera.main.transform; }
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void HandleUnlocked()
|
||||
{
|
||||
UpdateLightColor(true);
|
||||
}
|
||||
|
||||
private void UpdateLightColor(bool isUnlocked)
|
||||
{
|
||||
if (statusLight != null)
|
||||
{
|
||||
statusLight.color = isUnlocked ? new Color(0.2f, 1f, 0.4f) : new Color(1f, 0.85f, 0.1f);
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (ElevatorKeypadUI.Instance != null && ElevatorKeypadUI.Instance.IsOpen) return;
|
||||
if (Time.timeScale == 0f) return;
|
||||
|
||||
Transform player = LocatePlayer();
|
||||
if (player == null) return;
|
||||
|
||||
float dist3D = Vector3.Distance(transform.position, player.position);
|
||||
float distXZ = Vector2.Distance(new Vector2(transform.position.x, transform.position.z),
|
||||
new Vector2(player.position.x, player.position.z));
|
||||
|
||||
bool inRange = dist3D <= interactionDistance || distXZ <= (interactionDistance * 0.9f);
|
||||
|
||||
if (inRange)
|
||||
{
|
||||
if (CheckInteractInput())
|
||||
{
|
||||
Interact();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerStay(Collider other)
|
||||
{
|
||||
if (ElevatorKeypadUI.Instance != null && ElevatorKeypadUI.Instance.IsOpen) return;
|
||||
if (Time.timeScale == 0f) return;
|
||||
|
||||
if (other.CompareTag("Player") || other.GetComponentInParent<PlayerMovement>() != null)
|
||||
{
|
||||
if (CheckInteractInput())
|
||||
{
|
||||
Interact();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool CheckInteractInput()
|
||||
{
|
||||
var keyboard = Keyboard.current;
|
||||
if (keyboard != null)
|
||||
{
|
||||
if (keyboard.eKey.wasPressedThisFrame ||
|
||||
keyboard.fKey.wasPressedThisFrame ||
|
||||
keyboard.enterKey.wasPressedThisFrame)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLE_LEGACY_INPUT_MANAGER
|
||||
if (Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.F) || Input.GetKeyDown(KeyCode.Return))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Interact()
|
||||
{
|
||||
bool isUnlocked = LevelCodeManager.Instance != null && LevelCodeManager.Instance.IsElevatorUnlocked;
|
||||
|
||||
if (isUnlocked)
|
||||
{
|
||||
if (LevelSuccessUI.Instance != null)
|
||||
{
|
||||
LevelSuccessUI.Instance.ShowSuccessScreen();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ElevatorKeypadUI.Instance != null)
|
||||
{
|
||||
ElevatorKeypadUI.Instance.OpenKeypad();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("[ElevatorTerminal] ElevatorKeypadUI.Instance is NULL!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b5c633e6b03188a41aa36f163c1061ee
|
||||
@@ -0,0 +1,150 @@
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Процедурный синтезатор звуковых эффектов для интерфейса терминала, кнопок и записок.
|
||||
/// Создает чистые звуки прямо в оперативной памяти (AudioClip.Create) без внешних файлов.
|
||||
/// </summary>
|
||||
public static class GameAudioSynthesizer
|
||||
{
|
||||
private static AudioSource globalAudioSource;
|
||||
|
||||
private static AudioSource GetAudioSource()
|
||||
{
|
||||
if (globalAudioSource == null)
|
||||
{
|
||||
var go = new GameObject("ProceduralUIAudioSource");
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
Object.DontDestroyOnLoad(go);
|
||||
}
|
||||
globalAudioSource = go.AddComponent<AudioSource>();
|
||||
globalAudioSource.playOnAwake = false;
|
||||
globalAudioSource.spatialBlend = 0f; // 2D звук интерфейса
|
||||
globalAudioSource.ignoreListenerPause = true; // Работает даже при Time.timeScale = 0
|
||||
}
|
||||
return globalAudioSource;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Короткий высокий бип нажатия кнопки терминала (1200 Hz)
|
||||
/// </summary>
|
||||
public static void PlayKeypadBeep()
|
||||
{
|
||||
AudioClip clip = CreateToneClip(1200f, 0.05f, 0.25f);
|
||||
PlayOneShot(clip, 0.35f);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Звук сброса/стирания цифры (700 Hz)
|
||||
/// </summary>
|
||||
public static void PlayKeypadClear()
|
||||
{
|
||||
AudioClip clip = CreateToneClip(700f, 0.08f, 0.3f);
|
||||
PlayOneShot(clip, 0.3f);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Звук ошибки ввода (низкий двойной зуммер 160Hz)
|
||||
/// </summary>
|
||||
public static void PlayErrorCode()
|
||||
{
|
||||
int sampleRate = 44100;
|
||||
int samples = (int)(sampleRate * 0.25f);
|
||||
float[] data = new float[samples];
|
||||
for (int i = 0; i < samples; i++)
|
||||
{
|
||||
float t = (float)i / sampleRate;
|
||||
float freq = 160f;
|
||||
float pulse = Mathf.Sin(2f * Mathf.PI * 18f * t) > 0f ? 1f : 0f;
|
||||
data[i] = Mathf.Sin(2f * Mathf.PI * freq * t) * pulse * (1f - (float)i / samples) * 0.4f;
|
||||
}
|
||||
|
||||
AudioClip clip = AudioClip.Create("ErrorCodeTone", samples, 1, sampleRate, false);
|
||||
clip.SetData(data, 0);
|
||||
PlayOneShot(clip, 0.45f);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Торжественный трезвук успеха (C-E-G мажорный перелив)
|
||||
/// </summary>
|
||||
public static void PlaySuccessChime()
|
||||
{
|
||||
int sampleRate = 44100;
|
||||
int samples = (int)(sampleRate * 0.6f);
|
||||
float[] data = new float[samples];
|
||||
|
||||
float[] freqs = new float[] { 523.25f, 659.25f, 783.99f, 1046.50f };
|
||||
for (int i = 0; i < samples; i++)
|
||||
{
|
||||
float t = (float)i / sampleRate;
|
||||
float sampleVal = 0f;
|
||||
|
||||
for (int f = 0; f < freqs.Length; f++)
|
||||
{
|
||||
float startTime = f * 0.1f;
|
||||
if (t >= startTime)
|
||||
{
|
||||
float noteTime = t - startTime;
|
||||
float env = Mathf.Exp(-noteTime * 4.5f);
|
||||
sampleVal += Mathf.Sin(2f * Mathf.PI * freqs[f] * noteTime) * env * 0.2f;
|
||||
}
|
||||
}
|
||||
data[i] = Mathf.Clamp(sampleVal, -0.9f, 0.9f);
|
||||
}
|
||||
|
||||
AudioClip clip = AudioClip.Create("SuccessChime", samples, 1, sampleRate, false);
|
||||
clip.SetData(data, 0);
|
||||
PlayOneShot(clip, 0.5f);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Звук разворачивания/чтения секретной записки (шум бумаги + легкий звон)
|
||||
/// </summary>
|
||||
public static void PlayPaperRustle()
|
||||
{
|
||||
int sampleRate = 44100;
|
||||
int samples = (int)(sampleRate * 0.18f);
|
||||
float[] data = new float[samples];
|
||||
|
||||
System.Random rnd = new System.Random(42);
|
||||
for (int i = 0; i < samples; i++)
|
||||
{
|
||||
float env = 1f - (float)i / samples;
|
||||
float noise = ((float)rnd.NextDouble() * 2f - 1f) * 0.15f;
|
||||
float chime = Mathf.Sin(2f * Mathf.PI * 1400f * ((float)i / sampleRate)) * 0.12f;
|
||||
data[i] = (noise + chime) * env;
|
||||
}
|
||||
|
||||
AudioClip clip = AudioClip.Create("PaperRustle", samples, 1, sampleRate, false);
|
||||
clip.SetData(data, 0);
|
||||
PlayOneShot(clip, 0.4f);
|
||||
}
|
||||
|
||||
private static AudioClip CreateToneClip(float frequency, float duration, float volume)
|
||||
{
|
||||
int sampleRate = 44100;
|
||||
int samples = (int)(sampleRate * duration);
|
||||
float[] data = new float[samples];
|
||||
|
||||
for (int i = 0; i < samples; i++)
|
||||
{
|
||||
float t = (float)i / sampleRate;
|
||||
float env = 1f - ((float)i / samples);
|
||||
data[i] = Mathf.Sin(2f * Mathf.PI * frequency * t) * env * volume;
|
||||
}
|
||||
|
||||
AudioClip clip = AudioClip.Create($"Tone_{frequency}", samples, 1, sampleRate, false);
|
||||
clip.SetData(data, 0);
|
||||
return clip;
|
||||
}
|
||||
|
||||
private static void PlayOneShot(AudioClip clip, float volumeScale)
|
||||
{
|
||||
if (clip == null) return;
|
||||
var src = GetAudioSource();
|
||||
if (src != null)
|
||||
{
|
||||
src.PlayOneShot(clip, volumeScale);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe4a4f53134c5634da9ed6ae233002a9
|
||||
@@ -0,0 +1,76 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
/// Плашка подсказки взаимодействия (например "[E] ПРОЧЕСТЬ ЗАПИСКУ"),
|
||||
/// отображаемая по центру экрана под прицелом, когда игрок подходит к интерактивному объекту.
|
||||
/// </summary>
|
||||
public class InteractionPromptUI : MonoBehaviour
|
||||
{
|
||||
private static InteractionPromptUI _instance;
|
||||
public static InteractionPromptUI Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = Object.FindAnyObjectByType<InteractionPromptUI>(FindObjectsInactive.Include);
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField] private GameObject promptRoot;
|
||||
[SerializeField] private Text promptText;
|
||||
|
||||
private float hideTimer = 0f;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_instance = this;
|
||||
if (promptRoot == null)
|
||||
{
|
||||
promptRoot = transform.childCount > 0 ? transform.GetChild(0).gameObject : gameObject;
|
||||
}
|
||||
HidePromptImmediate();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (hideTimer > 0f)
|
||||
{
|
||||
hideTimer -= Time.unscaledDeltaTime;
|
||||
if (hideTimer <= 0f)
|
||||
{
|
||||
HidePromptImmediate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowPrompt(string message, float duration = 0.25f)
|
||||
{
|
||||
if (promptRoot != null)
|
||||
{
|
||||
if (!promptRoot.activeSelf) promptRoot.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!gameObject.activeSelf) gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
if (promptText != null)
|
||||
{
|
||||
promptText.text = message;
|
||||
}
|
||||
hideTimer = duration;
|
||||
}
|
||||
|
||||
public void HidePromptImmediate()
|
||||
{
|
||||
if (promptRoot != null && promptRoot != gameObject)
|
||||
{
|
||||
promptRoot.SetActive(false);
|
||||
}
|
||||
hideTimer = 0f;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f61a9d28815bc26489b75c6e880ac4d2
|
||||
@@ -0,0 +1,109 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Менеджер сюжета и 4-значного случайного кода доступа к лифту на 2-й уровень.
|
||||
/// Генерирует уникальный случайный код при каждом старте игры и отслеживает найденные записки.
|
||||
/// </summary>
|
||||
public class LevelCodeManager : MonoBehaviour
|
||||
{
|
||||
private static LevelCodeManager _instance;
|
||||
public static LevelCodeManager Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = UnityEngine.Object.FindAnyObjectByType<LevelCodeManager>(FindObjectsInactive.Include);
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
[Header("Сгенерированный код (4 цифры)")]
|
||||
[SerializeField] private int[] secretDigits = new int[4];
|
||||
[SerializeField] private bool[] discoveredDigits = new bool[4];
|
||||
|
||||
public event Action<int, int> OnDigitDiscovered; // (позиция 0..3, значение 0..9)
|
||||
public event Action OnElevatorUnlocked;
|
||||
|
||||
public bool IsElevatorUnlocked { get; private set; } = false;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_instance = this;
|
||||
GenerateSecretCode();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Генерирует новый 4-значный случайный код (например, 7-2-4-9)
|
||||
/// </summary>
|
||||
public void GenerateSecretCode()
|
||||
{
|
||||
IsElevatorUnlocked = false;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
secretDigits[i] = UnityEngine.Random.Range(0, 10);
|
||||
discoveredDigits[i] = false;
|
||||
}
|
||||
|
||||
Debug.Log($"<color=yellow>[LevelCodeManager] Сгенерирован код лифта для Уровня 1: " +
|
||||
$"{secretDigits[0]} - {secretDigits[1]} - {secretDigits[2]} - {secretDigits[3]}</color>");
|
||||
}
|
||||
|
||||
public int GetDigit(int position)
|
||||
{
|
||||
if (position >= 0 && position < 4)
|
||||
return secretDigits[position];
|
||||
return 0;
|
||||
}
|
||||
|
||||
public bool IsDigitDiscovered(int position)
|
||||
{
|
||||
if (position >= 0 && position < 4)
|
||||
return discoveredDigits[position];
|
||||
return false;
|
||||
}
|
||||
|
||||
public void DiscoverDigit(int position)
|
||||
{
|
||||
if (position >= 0 && position < 4)
|
||||
{
|
||||
bool wasDiscovered = discoveredDigits[position];
|
||||
discoveredDigits[position] = true;
|
||||
|
||||
if (!wasDiscovered)
|
||||
{
|
||||
OnDigitDiscovered?.Invoke(position, secretDigits[position]);
|
||||
Debug.Log($"<color=yellow>[LevelCodeManager] Открыта цифра #{position + 1}: {secretDigits[position]}</color>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool ValidateCode(string enteredCode)
|
||||
{
|
||||
if (string.IsNullOrEmpty(enteredCode) || enteredCode.Length != 4)
|
||||
return false;
|
||||
|
||||
string correctCode = $"{secretDigits[0]}{secretDigits[1]}{secretDigits[2]}{secretDigits[3]}";
|
||||
bool isCorrect = enteredCode.Trim().Equals(correctCode, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
if (isCorrect)
|
||||
{
|
||||
IsElevatorUnlocked = true;
|
||||
OnElevatorUnlocked?.Invoke();
|
||||
Debug.Log("<color=green>[LevelCodeManager] Код лифта введен ВЕРНО! Доступ к Уровню 2 открыт.</color>");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"<color=red>[LevelCodeManager] Неверный код: '{enteredCode}' (ожидался '{correctCode}')</color>");
|
||||
}
|
||||
|
||||
return isCorrect;
|
||||
}
|
||||
|
||||
public string GetFullCodeString()
|
||||
{
|
||||
return $"{secretDigits[0]}{secretDigits[1]}{secretDigits[2]}{secretDigits[3]}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c568b40c5574cc4a8974aa8313013ce
|
||||
@@ -0,0 +1,75 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
/// <summary>
|
||||
/// Экран завершения первого уровня при успешном вводе кода лифта.
|
||||
/// </summary>
|
||||
public class LevelSuccessUI : MonoBehaviour
|
||||
{
|
||||
private static LevelSuccessUI _instance;
|
||||
public static LevelSuccessUI Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = Object.FindAnyObjectByType<LevelSuccessUI>(FindObjectsInactive.Include);
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
[Header("Корневая панель")]
|
||||
[SerializeField] private GameObject successPanelRoot;
|
||||
|
||||
public bool IsOpen => successPanelRoot != null && successPanelRoot.activeInHierarchy;
|
||||
|
||||
[Header("Кнопки")]
|
||||
[SerializeField] private Button nextLevelButton;
|
||||
[SerializeField] private Button mainMenuButton;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_instance = this;
|
||||
if (successPanelRoot == null)
|
||||
successPanelRoot = gameObject;
|
||||
|
||||
if (nextLevelButton != null)
|
||||
{
|
||||
nextLevelButton.onClick.RemoveAllListeners();
|
||||
nextLevelButton.onClick.AddListener(OnNextLevelClicked);
|
||||
}
|
||||
|
||||
if (mainMenuButton != null)
|
||||
{
|
||||
mainMenuButton.onClick.RemoveAllListeners();
|
||||
mainMenuButton.onClick.AddListener(OnMainMenuClicked);
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowSuccessScreen()
|
||||
{
|
||||
if (!gameObject.activeSelf) gameObject.SetActive(true);
|
||||
if (successPanelRoot != null)
|
||||
successPanelRoot.SetActive(true);
|
||||
|
||||
Time.timeScale = 0f;
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
Cursor.visible = true;
|
||||
|
||||
GameAudioSynthesizer.PlaySuccessChime();
|
||||
}
|
||||
|
||||
private void OnNextLevelClicked()
|
||||
{
|
||||
Time.timeScale = 1f;
|
||||
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
|
||||
}
|
||||
|
||||
private void OnMainMenuClicked()
|
||||
{
|
||||
Time.timeScale = 1f;
|
||||
SceneManager.LoadScene("MainMenu");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 55bca2c832af0a746b24103bb27a44cd
|
||||
@@ -0,0 +1,149 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
/// <summary>
|
||||
/// Интерактивная сюжетная записка в 3D мире.
|
||||
/// Игрок может подойти, увидеть подсказку и нажать [E] для открытия полноэкранного документа.
|
||||
/// </summary>
|
||||
public class NotePickup : MonoBehaviour
|
||||
{
|
||||
[Header("Настройки кода лифта")]
|
||||
[Tooltip("Порядковый номер в коде: 0 = 1-я цифра, 1 = 2-я цифра, 2 = 3-я цифра, 3 = 4-я цифра")]
|
||||
public int digitPosition = 0;
|
||||
|
||||
[Header("Сюжетное описание")]
|
||||
public string noteTitle = "ЗАПИСКА ИССЛЕДОВАТЕЛЯ";
|
||||
public string sectorName = "СЕКТОР АРХИВА";
|
||||
[TextArea(3, 8)]
|
||||
public string storyText = "Мы заблокировали лифт в нижний уровень, чтобы задержать биомассу. Если кто-то выжил, введите код в терминал...";
|
||||
|
||||
[Header("Дистанция взаимодействия")]
|
||||
public float interactionDistance = 3.6f;
|
||||
|
||||
[Header("Визуальное покачивание и свечение")]
|
||||
public bool animateHover = true;
|
||||
public float hoverSpeed = 2.0f;
|
||||
public float hoverHeight = 0.05f;
|
||||
|
||||
private Vector3 initialPos;
|
||||
private static Transform cachedPlayerTransform;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
initialPos = transform.position;
|
||||
LocatePlayer();
|
||||
|
||||
var col = GetComponent<Collider>();
|
||||
if (col == null)
|
||||
{
|
||||
var sc = gameObject.AddComponent<SphereCollider>();
|
||||
sc.isTrigger = true;
|
||||
sc.radius = interactionDistance;
|
||||
}
|
||||
}
|
||||
|
||||
private Transform LocatePlayer()
|
||||
{
|
||||
if (cachedPlayerTransform != null) return cachedPlayerTransform;
|
||||
|
||||
var pm = Object.FindAnyObjectByType<PlayerMovement>();
|
||||
if (pm != null) { cachedPlayerTransform = pm.transform; return cachedPlayerTransform; }
|
||||
|
||||
var ph = Object.FindAnyObjectByType<PlayerHealth>();
|
||||
if (ph != null) { cachedPlayerTransform = ph.transform; return cachedPlayerTransform; }
|
||||
|
||||
var pTag = GameObject.FindWithTag("Player");
|
||||
if (pTag != null) { cachedPlayerTransform = pTag.transform; return cachedPlayerTransform; }
|
||||
|
||||
var pName = GameObject.Find("Player");
|
||||
if (pName != null) { cachedPlayerTransform = pName.transform; return cachedPlayerTransform; }
|
||||
|
||||
if (Camera.main != null) { return Camera.main.transform; }
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (animateHover)
|
||||
{
|
||||
float newY = initialPos.y + Mathf.Sin(Time.time * hoverSpeed) * hoverHeight;
|
||||
transform.position = new Vector3(initialPos.x, newY, initialPos.z);
|
||||
}
|
||||
|
||||
if (NoteViewerUI.Instance != null && NoteViewerUI.Instance.IsOpen) return;
|
||||
if (Time.timeScale == 0f) return;
|
||||
|
||||
Transform player = LocatePlayer();
|
||||
if (player == null) return;
|
||||
|
||||
float dist3D = Vector3.Distance(transform.position, player.position);
|
||||
float distXZ = Vector2.Distance(new Vector2(transform.position.x, transform.position.z),
|
||||
new Vector2(player.position.x, player.position.z));
|
||||
|
||||
bool inRange = dist3D <= interactionDistance || distXZ <= (interactionDistance * 0.9f);
|
||||
|
||||
if (inRange)
|
||||
{
|
||||
if (CheckInteractInput())
|
||||
{
|
||||
Interact();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerStay(Collider other)
|
||||
{
|
||||
if (NoteViewerUI.Instance != null && NoteViewerUI.Instance.IsOpen) return;
|
||||
if (Time.timeScale == 0f) return;
|
||||
|
||||
if (other.CompareTag("Player") || other.GetComponentInParent<PlayerMovement>() != null)
|
||||
{
|
||||
if (CheckInteractInput())
|
||||
{
|
||||
Interact();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool CheckInteractInput()
|
||||
{
|
||||
var keyboard = Keyboard.current;
|
||||
if (keyboard != null)
|
||||
{
|
||||
if (keyboard.eKey.wasPressedThisFrame ||
|
||||
keyboard.fKey.wasPressedThisFrame ||
|
||||
keyboard.enterKey.wasPressedThisFrame)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLE_LEGACY_INPUT_MANAGER
|
||||
if (Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.F) || Input.GetKeyDown(KeyCode.Return))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Interact()
|
||||
{
|
||||
int digit = 0;
|
||||
if (LevelCodeManager.Instance != null)
|
||||
{
|
||||
digit = LevelCodeManager.Instance.GetDigit(digitPosition);
|
||||
}
|
||||
|
||||
if (NoteViewerUI.Instance != null)
|
||||
{
|
||||
NoteViewerUI.Instance.OpenNote(digitPosition, digit, sectorName, noteTitle, storyText);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("[NotePickup] NoteViewerUI.Instance is NULL!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d945ca331500b1343943e3cb838ecfe7
|
||||
@@ -0,0 +1,145 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
/// <summary>
|
||||
/// Полноэкранный просмотрщик найденных записок.
|
||||
/// Отрисовывает крупную цифру на бумажке, её позицию в терминале лифта (1-я, 2-я, 3-я или 4-я),
|
||||
/// гриф секретности и атмосферный сюжетный текст.
|
||||
/// </summary>
|
||||
public class NoteViewerUI : MonoBehaviour
|
||||
{
|
||||
private static NoteViewerUI _instance;
|
||||
public static NoteViewerUI Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = Object.FindAnyObjectByType<NoteViewerUI>(FindObjectsInactive.Include);
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
[Header("Корневая панель")]
|
||||
[SerializeField] private GameObject notePanelRoot;
|
||||
|
||||
[Header("Элементы документа")]
|
||||
[SerializeField] private Text documentHeader;
|
||||
[SerializeField] private Text sectorText;
|
||||
[SerializeField] private Text positionNoticeText;
|
||||
[SerializeField] private Text bigDigitText;
|
||||
[SerializeField] private Text flavorBodyText;
|
||||
[SerializeField] private Button closeButton;
|
||||
|
||||
private bool isOpen = false;
|
||||
public bool IsOpen => isOpen;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_instance = this;
|
||||
if (notePanelRoot == null)
|
||||
notePanelRoot = gameObject;
|
||||
|
||||
if (closeButton != null)
|
||||
{
|
||||
closeButton.onClick.RemoveAllListeners();
|
||||
closeButton.onClick.AddListener(CloseNote);
|
||||
}
|
||||
}
|
||||
|
||||
private int openFrame = -1;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!isOpen) return;
|
||||
if (Time.frameCount == openFrame) return;
|
||||
|
||||
bool closePressed = false;
|
||||
|
||||
var keyboard = Keyboard.current;
|
||||
if (keyboard != null)
|
||||
{
|
||||
if (keyboard.escapeKey.wasPressedThisFrame ||
|
||||
keyboard.eKey.wasPressedThisFrame ||
|
||||
keyboard.spaceKey.wasPressedThisFrame ||
|
||||
keyboard.enterKey.wasPressedThisFrame)
|
||||
{
|
||||
closePressed = true;
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLE_LEGACY_INPUT_MANAGER
|
||||
if (Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.Space))
|
||||
{
|
||||
closePressed = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (closePressed)
|
||||
{
|
||||
CloseNote();
|
||||
}
|
||||
}
|
||||
|
||||
public void OpenNote(int positionIndex, int digit, string sector, string noteTitle, string storyText)
|
||||
{
|
||||
openFrame = Time.frameCount;
|
||||
|
||||
if (!gameObject.activeSelf) gameObject.SetActive(true);
|
||||
if (notePanelRoot != null && !notePanelRoot.activeSelf)
|
||||
notePanelRoot.SetActive(true);
|
||||
|
||||
isOpen = true;
|
||||
Time.timeScale = 0f;
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
Cursor.visible = true;
|
||||
|
||||
if (documentHeader != null)
|
||||
documentHeader.text = "Секретный протокол";
|
||||
|
||||
if (sectorText != null)
|
||||
sectorText.text = $"Отсек: {sector.ToUpper()}";
|
||||
|
||||
string posStr = positionIndex switch
|
||||
{
|
||||
0 => "1-я цифра [ _ * * * ]",
|
||||
1 => "2-я цифра [ * _ * * ]",
|
||||
2 => "3-я цифра [ * * _ * ]",
|
||||
3 => "4-я цифра [ * * * _ ]",
|
||||
_ => $"{positionIndex + 1}-я цифра"
|
||||
};
|
||||
|
||||
if (positionNoticeText != null)
|
||||
positionNoticeText.text = $"КОД ЛИФТА: {posStr}";
|
||||
|
||||
if (bigDigitText != null)
|
||||
bigDigitText.text = digit.ToString();
|
||||
|
||||
if (flavorBodyText != null)
|
||||
flavorBodyText.text = storyText;
|
||||
|
||||
GameAudioSynthesizer.PlayPaperRustle();
|
||||
|
||||
if (LevelCodeManager.Instance != null)
|
||||
{
|
||||
LevelCodeManager.Instance.DiscoverDigit(positionIndex);
|
||||
}
|
||||
}
|
||||
|
||||
public void CloseNote()
|
||||
{
|
||||
if (!isOpen) return;
|
||||
|
||||
isOpen = false;
|
||||
if (notePanelRoot != null)
|
||||
notePanelRoot.SetActive(false);
|
||||
|
||||
Time.timeScale = 1f;
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
Cursor.visible = false;
|
||||
|
||||
GameAudioSynthesizer.PlayKeypadClear();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3b4c1b816e1241448a3a858ceaf38105
|
||||
@@ -1,4 +1,4 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
// Обязательно добавляем библиотеку новой системы ввода
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
@@ -25,6 +25,7 @@ public class ObjectThrower : MonoBehaviour
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Time.timeScale == 0f) return;
|
||||
// Защита от ошибок, если клавиатура не подключена
|
||||
if (Keyboard.current == null) return;
|
||||
|
||||
|
||||
+124
-75
@@ -12,9 +12,12 @@ public class PauseMenu : MonoBehaviour
|
||||
|
||||
[Header("Кнопки панели действий")]
|
||||
public Button resumeButton;
|
||||
public Button settingsButton;
|
||||
public Button restartButton;
|
||||
public Button mainMenuButton;
|
||||
public Button quitButton;
|
||||
public Button backFromSettingsButton;
|
||||
public Button resetDefaultsButton;
|
||||
|
||||
[Header("Вкладки")]
|
||||
public Button[] tabButtons;
|
||||
@@ -38,7 +41,6 @@ public class PauseMenu : MonoBehaviour
|
||||
|
||||
private bool isPaused = false;
|
||||
private bool isInitializing = false;
|
||||
private bool wasCursorLocked = false;
|
||||
private List<Resolution> filteredResolutions = new List<Resolution>();
|
||||
|
||||
public bool IsPaused => isPaused;
|
||||
@@ -58,14 +60,15 @@ public class PauseMenu : MonoBehaviour
|
||||
SetupActionButtons();
|
||||
SetupTabs();
|
||||
InitializeSettingsUI();
|
||||
|
||||
wasCursorLocked = (Cursor.lockState == CursorLockMode.Locked);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
// Не открываем меню паузы, если активен экран смерти
|
||||
// Не открываем меню паузы, если активен экран смерти, просмотр записки, клавиатура лифта или экран победы
|
||||
if (DeathScreenUI.Instance != null && DeathScreenUI.Instance.IsShown) return;
|
||||
if (NoteViewerUI.Instance != null && NoteViewerUI.Instance.IsOpen) return;
|
||||
if (ElevatorKeypadUI.Instance != null && ElevatorKeypadUI.Instance.IsOpen) return;
|
||||
if (LevelSuccessUI.Instance != null && LevelSuccessUI.Instance.IsOpen) return;
|
||||
|
||||
bool togglePause = false;
|
||||
var keyboard = Keyboard.current;
|
||||
@@ -73,30 +76,25 @@ public class PauseMenu : MonoBehaviour
|
||||
{
|
||||
if (keyboard.escapeKey.wasPressedThisFrame ||
|
||||
keyboard.pKey.wasPressedThisFrame ||
|
||||
keyboard.tabKey.wasPressedThisFrame ||
|
||||
keyboard.pauseKey.wasPressedThisFrame)
|
||||
{
|
||||
togglePause = true;
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLE_LEGACY_INPUT_MANAGER
|
||||
if (Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.P))
|
||||
{
|
||||
togglePause = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
var gamepad = Gamepad.current;
|
||||
if (gamepad != null && gamepad.startButton.wasPressedThisFrame)
|
||||
{
|
||||
togglePause = true;
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
// В Unity Editor при заблокированном курсоре нажатие Escape перехватывается редактором
|
||||
// для снятия блокировки курсора (Cursor.lockState переключается в None) и не передается в Update().
|
||||
// Поэтому в редакторе переключение lockState из Locked в None трактуется как нажатие Escape!
|
||||
if (!isPaused && wasCursorLocked && Cursor.lockState != CursorLockMode.Locked)
|
||||
{
|
||||
togglePause = true;
|
||||
}
|
||||
wasCursorLocked = (Cursor.lockState == CursorLockMode.Locked);
|
||||
#endif
|
||||
|
||||
if (togglePause)
|
||||
{
|
||||
if (isPaused)
|
||||
@@ -123,7 +121,6 @@ public class PauseMenu : MonoBehaviour
|
||||
Time.timeScale = 0f;
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
Cursor.visible = true;
|
||||
wasCursorLocked = false;
|
||||
|
||||
if (pauseMenuPanel != null)
|
||||
{
|
||||
@@ -145,7 +142,6 @@ public class PauseMenu : MonoBehaviour
|
||||
Time.timeScale = 1f;
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
Cursor.visible = false;
|
||||
wasCursorLocked = true;
|
||||
|
||||
if (pauseMenuPanel != null) pauseMenuPanel.SetActive(false);
|
||||
if (settingsPanel != null) settingsPanel.SetActive(false);
|
||||
@@ -163,7 +159,12 @@ public class PauseMenu : MonoBehaviour
|
||||
public void OpenSettings()
|
||||
{
|
||||
if (pauseMenuPanel != null) pauseMenuPanel.SetActive(false);
|
||||
if (settingsPanel != null) settingsPanel.SetActive(true);
|
||||
if (settingsPanel != null)
|
||||
{
|
||||
settingsPanel.SetActive(true);
|
||||
InitializeSettingsUI();
|
||||
SwitchTab(0);
|
||||
}
|
||||
}
|
||||
|
||||
public void CloseSettings()
|
||||
@@ -173,6 +174,50 @@ public class PauseMenu : MonoBehaviour
|
||||
if (pauseMenuPanel != null) pauseMenuPanel.SetActive(true);
|
||||
}
|
||||
|
||||
public void ResetToDefaults()
|
||||
{
|
||||
isInitializing = true;
|
||||
|
||||
if (volumeSlider != null) volumeSlider.value = 1.0f;
|
||||
if (muteToggle != null) muteToggle.isOn = false;
|
||||
PlayerPrefs.SetFloat(GameSettings.KeyMasterVolume, 1.0f);
|
||||
PlayerPrefs.SetInt(GameSettings.KeyIsMuted, 0);
|
||||
AudioListener.volume = 1.0f;
|
||||
UpdateVolumeLabel(1.0f, false);
|
||||
|
||||
int defQuality = Mathf.Clamp(QualitySettings.names.Length - 1, 0, QualitySettings.names.Length - 1);
|
||||
if (qualityDropdown != null)
|
||||
{
|
||||
qualityDropdown.value = defQuality;
|
||||
qualityDropdown.RefreshShownValue();
|
||||
}
|
||||
QualitySettings.SetQualityLevel(defQuality, true);
|
||||
PlayerPrefs.SetInt(GameSettings.KeyQualityLevel, defQuality);
|
||||
|
||||
if (fullscreenToggle != null) fullscreenToggle.isOn = true;
|
||||
Screen.fullScreen = true;
|
||||
PlayerPrefs.SetInt(GameSettings.KeyFullscreen, 1);
|
||||
|
||||
if (resolutionDropdown != null && filteredResolutions.Count > 0)
|
||||
{
|
||||
int lastIndex = filteredResolutions.Count - 1;
|
||||
resolutionDropdown.value = lastIndex;
|
||||
resolutionDropdown.RefreshShownValue();
|
||||
var res = filteredResolutions[lastIndex];
|
||||
Screen.SetResolution(res.width, res.height, FullScreenMode.FullScreenWindow);
|
||||
PlayerPrefs.SetInt(GameSettings.KeyResolutionWidth, res.width);
|
||||
PlayerPrefs.SetInt(GameSettings.KeyResolutionHeight, res.height);
|
||||
}
|
||||
|
||||
if (sensitivitySlider != null) sensitivitySlider.value = 1.0f;
|
||||
PlayerPrefs.SetFloat(GameSettings.KeyMouseSensitivity, 1.0f);
|
||||
UpdateSensitivityLabel(1.0f);
|
||||
|
||||
PlayerPrefs.Save();
|
||||
isInitializing = false;
|
||||
Debug.Log("[PauseMenu] Настройки сброшены на значения по умолчанию.");
|
||||
}
|
||||
|
||||
public void ReturnToMainMenu()
|
||||
{
|
||||
Time.timeScale = 1f;
|
||||
@@ -214,16 +259,16 @@ public class PauseMenu : MonoBehaviour
|
||||
if (img != null)
|
||||
{
|
||||
img.color = isActive
|
||||
? new Color(0.00f, 0.65f, 0.85f, 0.95f) // Неоновый бирюзовый акцент
|
||||
: new Color(0.06f, 0.10f, 0.16f, 0.85f); // Темный фон неактивной вкладки
|
||||
? new Color(0.95f, 0.78f, 0.12f, 1.0f) // Золотистый активный
|
||||
: new Color(0.08f, 0.08f, 0.08f, 0.85f);
|
||||
}
|
||||
|
||||
var text = tabButtons[i].GetComponentInChildren<Text>();
|
||||
if (text != null)
|
||||
{
|
||||
text.color = isActive
|
||||
? Color.white
|
||||
: new Color(0.40f, 0.55f, 0.65f, 0.80f);
|
||||
? new Color(0.06f, 0.06f, 0.06f, 1.0f)
|
||||
: new Color(0.6f, 0.6f, 0.6f, 0.8f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -237,11 +282,14 @@ public class PauseMenu : MonoBehaviour
|
||||
for (int i = 0; i < tabButtons.Length; i++)
|
||||
{
|
||||
int index = i;
|
||||
if (tabButtons[i] != null)
|
||||
{
|
||||
tabButtons[i].onClick.RemoveAllListeners();
|
||||
tabButtons[i].onClick.AddListener(() => SwitchTab(index));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupActionButtons()
|
||||
{
|
||||
@@ -251,6 +299,12 @@ public class PauseMenu : MonoBehaviour
|
||||
resumeButton.onClick.AddListener(ResumeGame);
|
||||
}
|
||||
|
||||
if (settingsButton != null)
|
||||
{
|
||||
settingsButton.onClick.RemoveAllListeners();
|
||||
settingsButton.onClick.AddListener(OpenSettings);
|
||||
}
|
||||
|
||||
if (restartButton != null)
|
||||
{
|
||||
restartButton.onClick.RemoveAllListeners();
|
||||
@@ -268,81 +322,76 @@ public class PauseMenu : MonoBehaviour
|
||||
quitButton.onClick.RemoveAllListeners();
|
||||
quitButton.onClick.AddListener(QuitGame);
|
||||
}
|
||||
|
||||
if (backFromSettingsButton != null)
|
||||
{
|
||||
backFromSettingsButton.onClick.RemoveAllListeners();
|
||||
backFromSettingsButton.onClick.AddListener(CloseSettings);
|
||||
}
|
||||
|
||||
if (resetDefaultsButton != null)
|
||||
{
|
||||
resetDefaultsButton.onClick.RemoveAllListeners();
|
||||
resetDefaultsButton.onClick.AddListener(ResetToDefaults);
|
||||
}
|
||||
}
|
||||
|
||||
public void AutoWireUI()
|
||||
{
|
||||
if (pauseMenuPanel == null)
|
||||
{
|
||||
var root = transform.Find("PauseRootPanel");
|
||||
if (root != null)
|
||||
{
|
||||
pauseMenuPanel = root.gameObject;
|
||||
}
|
||||
var pPanel = transform.Find("PauseMenuPanel");
|
||||
if (pPanel != null) pauseMenuPanel = pPanel.gameObject;
|
||||
else
|
||||
{
|
||||
var panel = transform.Find("PauseMenuPanel");
|
||||
if (panel != null) pauseMenuPanel = panel.gameObject;
|
||||
var root = transform.Find("PauseRootPanel");
|
||||
if (root != null) pauseMenuPanel = root.gameObject;
|
||||
}
|
||||
}
|
||||
|
||||
Transform window = transform.Find("PauseRootPanel/Settings_Window");
|
||||
if (window != null)
|
||||
if (settingsPanel == null)
|
||||
{
|
||||
var winRt = window.GetComponent<RectTransform>();
|
||||
if (winRt != null && (winRt.sizeDelta.x <= 0f || winRt.sizeDelta.y <= 0f))
|
||||
{
|
||||
winRt.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
winRt.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
winRt.pivot = new Vector2(0.5f, 0.5f);
|
||||
winRt.anchoredPosition = Vector2.zero;
|
||||
winRt.sizeDelta = new Vector2(1100f, 720f);
|
||||
var sPanel = transform.Find("SettingsPanel");
|
||||
if (sPanel != null) settingsPanel = sPanel.gameObject;
|
||||
}
|
||||
|
||||
Transform dock = window.Find("Bottom_Action_Dock");
|
||||
if (dock != null)
|
||||
// Кнопки в карточке паузы
|
||||
Transform pauseCard = transform.Find("PauseMenuPanel/Pause_Card") ?? transform.Find("PauseMenuPanel");
|
||||
if (pauseCard != null)
|
||||
{
|
||||
if (resumeButton == null) resumeButton = dock.Find("Btn_Resume")?.GetComponent<Button>();
|
||||
if (restartButton == null) restartButton = dock.Find("Btn_Restart")?.GetComponent<Button>();
|
||||
if (mainMenuButton == null) mainMenuButton = dock.Find("Btn_MainMenu")?.GetComponent<Button>();
|
||||
if (quitButton == null) quitButton = dock.Find("Btn_Quit")?.GetComponent<Button>();
|
||||
Transform btnBox = pauseCard.Find("Buttons_Container") ?? pauseCard;
|
||||
if (resumeButton == null) resumeButton = btnBox.Find("Btn_Resume")?.GetComponent<Button>();
|
||||
if (settingsButton == null) settingsButton = btnBox.Find("Btn_Settings")?.GetComponent<Button>();
|
||||
if (restartButton == null) restartButton = btnBox.Find("Btn_Restart")?.GetComponent<Button>();
|
||||
if (mainMenuButton == null) mainMenuButton = btnBox.Find("Btn_MainMenu")?.GetComponent<Button>();
|
||||
if (quitButton == null) quitButton = btnBox.Find("Btn_Quit")?.GetComponent<Button>();
|
||||
}
|
||||
|
||||
Transform tabBar = window.Find("Tab_Bar");
|
||||
Transform content = window.Find("Content_Area");
|
||||
|
||||
if (tabBar != null && (tabButtons == null || tabButtons.Length == 0))
|
||||
// Кнопки и контролы в SettingsPanel
|
||||
Transform sCard = transform.Find("SettingsPanel/Settings_Card");
|
||||
if (sCard != null)
|
||||
{
|
||||
tabButtons = new Button[tabBar.childCount];
|
||||
for (int i = 0; i < tabBar.childCount; i++)
|
||||
Transform bottomBtns = sCard.Find("Settings_BottomButtons");
|
||||
if (bottomBtns != null)
|
||||
{
|
||||
tabButtons[i] = tabBar.GetChild(i).GetComponent<Button>();
|
||||
}
|
||||
if (resetDefaultsButton == null) resetDefaultsButton = bottomBtns.Find("Button_ResetDefaults")?.GetComponent<Button>();
|
||||
if (backFromSettingsButton == null) backFromSettingsButton = bottomBtns.Find("Button_Back")?.GetComponent<Button>();
|
||||
}
|
||||
|
||||
if (content != null && (tabPanels == null || tabPanels.Length == 0))
|
||||
Transform sList = sCard.Find("Settings_List");
|
||||
if (sList != null)
|
||||
{
|
||||
tabPanels = new GameObject[]
|
||||
{
|
||||
content.Find("Panel_Audio")?.gameObject,
|
||||
content.Find("Panel_Graphics")?.gameObject,
|
||||
content.Find("Panel_Controls")?.gameObject,
|
||||
content.Find("Panel_Briefing")?.gameObject
|
||||
};
|
||||
if (volumeSlider == null) volumeSlider = sList.Find("Row_Volume/Slider")?.GetComponent<Slider>();
|
||||
if (volumeValueText == null) volumeValueText = sList.Find("Row_Volume/ValueText")?.GetComponent<Text>();
|
||||
if (muteToggle == null) muteToggle = sList.Find("Row_Mute/Toggle")?.GetComponent<Toggle>();
|
||||
|
||||
if (qualityDropdown == null) qualityDropdown = sList.Find("Row_Quality/Dropdown")?.GetComponent<Dropdown>();
|
||||
if (fullscreenToggle == null) fullscreenToggle = sList.Find("Row_Fullscreen/Toggle")?.GetComponent<Toggle>();
|
||||
if (resolutionDropdown == null) resolutionDropdown = sList.Find("Row_Resolution/Dropdown")?.GetComponent<Dropdown>();
|
||||
|
||||
if (sensitivitySlider == null) sensitivitySlider = sList.Find("Row_Sensitivity/Slider")?.GetComponent<Slider>();
|
||||
if (sensitivityValueText == null) sensitivityValueText = sList.Find("Row_Sensitivity/ValueText")?.GetComponent<Text>();
|
||||
}
|
||||
|
||||
if (volumeSlider == null) volumeSlider = content?.Find("Panel_Audio/Row_Volume/Slider")?.GetComponent<Slider>();
|
||||
if (volumeValueText == null) volumeValueText = content?.Find("Panel_Audio/Row_Volume/ValueText")?.GetComponent<Text>();
|
||||
if (muteToggle == null) muteToggle = content?.Find("Panel_Audio/Row_Mute/Toggle")?.GetComponent<Toggle>();
|
||||
|
||||
if (qualityDropdown == null) qualityDropdown = content?.Find("Panel_Graphics/Row_Quality/Dropdown")?.GetComponent<Dropdown>();
|
||||
if (fullscreenToggle == null) fullscreenToggle = content?.Find("Panel_Graphics/Row_Fullscreen/Toggle")?.GetComponent<Toggle>();
|
||||
if (resolutionDropdown == null) resolutionDropdown = content?.Find("Panel_Graphics/Row_Resolution/Dropdown")?.GetComponent<Dropdown>();
|
||||
if (vsyncToggle == null) vsyncToggle = content?.Find("Panel_Graphics/Row_Vsync/Toggle")?.GetComponent<Toggle>();
|
||||
|
||||
if (sensitivitySlider == null) sensitivitySlider = content?.Find("Panel_Controls/Row_Sensitivity/Slider")?.GetComponent<Slider>();
|
||||
if (sensitivityValueText == null) sensitivityValueText = content?.Find("Panel_Controls/Row_Sensitivity/ValueText")?.GetComponent<Text>();
|
||||
if (invertYToggle == null) invertYToggle = content?.Find("Panel_Controls/Row_InvertY/Toggle")?.GetComponent<Toggle>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 04fa2d49319ab014594033997cfc4a0d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,144 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 07bdb058341eaf64fbfadca21c57cf6f
|
||||
TextureImporter:
|
||||
internalIDToNameTable:
|
||||
- first:
|
||||
213: 6475078783708840200
|
||||
second: TornPaper_Sprite_0
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationMethod: 0
|
||||
spriteTessellationDetail: -1
|
||||
spriteGeometrySubdivision: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 4
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites:
|
||||
- serializedVersion: 2
|
||||
name: TornPaper_Sprite_0
|
||||
rect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1024
|
||||
height: 1024
|
||||
alignment: 0
|
||||
pivot: {x: 0, y: 0}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
customData:
|
||||
outline: []
|
||||
physicsShape: []
|
||||
tessellationDetail: -1
|
||||
bones: []
|
||||
spriteID: 80142abe8d91cd950800000000000000
|
||||
internalID: 6475078783708840200
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -100,11 +100,11 @@ Material:
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _DstBlendAlpha: 0
|
||||
- _EchoOpacity1: 0.5927114
|
||||
- _EchoOpacity2: 0
|
||||
- _EchoOpacity1: 0
|
||||
- _EchoOpacity2: 0.3193835
|
||||
- _EchoOpacity3: 0
|
||||
- _EchoRadius1: 5.386
|
||||
- _EchoRadius2: 0
|
||||
- _EchoRadius1: 0
|
||||
- _EchoRadius2: 4.493115
|
||||
- _EchoRadius3: 0
|
||||
- _EnvironmentReflections: 1
|
||||
- _FresnelPower: 2.5
|
||||
@@ -143,9 +143,9 @@ Material:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EchoColor: {r: 4, g: 3.026, b: 1.049, a: 1}
|
||||
- _EchoCoreColor: {r: 7.5, g: 5.5, b: 2.2, a: 1}
|
||||
- _EchoPosition1: {r: -43.056625, g: -0.029093798, b: 23.00288, a: 1}
|
||||
- _EchoPosition2: {r: -40.5, g: -0.027898155, b: -6, a: 1}
|
||||
- _EchoPosition3: {r: -35.5, g: -0.027898155, b: -14, a: 1}
|
||||
- _EchoPosition1: {r: -37.285122, g: 0.12999992, b: -36.339718, a: 1}
|
||||
- _EchoPosition2: {r: -36.50726, g: 0.12999992, b: -36.424538, a: 1}
|
||||
- _EchoPosition3: {r: -37.424873, g: 0.13000004, b: -36.465725, a: 1}
|
||||
- _EmissionColor: {r: 0.5849056, g: 0.5849056, b: 0.5849056, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
- _WaveCenter: {r: 0, g: 0, b: 0, a: 0}
|
||||
|
||||
@@ -105,11 +105,11 @@ Material:
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 10
|
||||
- _DstBlendAlpha: 10
|
||||
- _EchoOpacity1: 0.5927114
|
||||
- _EchoOpacity2: 0
|
||||
- _EchoOpacity1: 0
|
||||
- _EchoOpacity2: 0.3193835
|
||||
- _EchoOpacity3: 0
|
||||
- _EchoRadius1: 5.386
|
||||
- _EchoRadius2: 0
|
||||
- _EchoRadius1: 0
|
||||
- _EchoRadius2: 4.493115
|
||||
- _EchoRadius3: 0
|
||||
- _EnvironmentReflections: 1
|
||||
- _FresnelPower: 2.5
|
||||
@@ -158,9 +158,9 @@ Material:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 0.2901961}
|
||||
- _EchoColor: {r: 4, g: 3.026, b: 1.049, a: 1}
|
||||
- _EchoCoreColor: {r: 7.5, g: 5.5, b: 2.2, a: 1}
|
||||
- _EchoPosition1: {r: -43.056625, g: -0.029093798, b: 23.00288, a: 1}
|
||||
- _EchoPosition2: {r: -40.5, g: -0.027898155, b: -6, a: 1}
|
||||
- _EchoPosition3: {r: -35.5, g: -0.027898155, b: -14, a: 1}
|
||||
- _EchoPosition1: {r: -37.285122, g: 0.12999992, b: -36.339718, a: 1}
|
||||
- _EchoPosition2: {r: -36.50726, g: 0.12999992, b: -36.424538, a: 1}
|
||||
- _EchoPosition3: {r: -37.424873, g: 0.13000004, b: -36.465725, a: 1}
|
||||
- _EmissionColor: {r: 0.3018868, g: 0.3018868, b: 0.3018868, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
- _UvOffset: {r: 0, g: 0, b: 0, a: 0}
|
||||
|
||||
@@ -3,7 +3,12 @@
|
||||
--- !u!5 &1
|
||||
TimeManager:
|
||||
m_ObjectHideFlags: 0
|
||||
Fixed Timestep: 0.02
|
||||
serializedVersion: 2
|
||||
Fixed Timestep:
|
||||
m_Count: 2822399
|
||||
m_Rate:
|
||||
m_Denominator: 1
|
||||
m_Numerator: 141120000
|
||||
Maximum Allowed Timestep: 0.33333334
|
||||
m_TimeScale: 1
|
||||
m_TimeScale: 0
|
||||
Maximum Particle Timestep: 0.03
|
||||
Reference in new issue
Block a user