# SVoiceZone

**成员** 23

|      |                                             |                                                 |
| ---- | ------------------------------------------- | ----------------------------------------------- |
| 函数 | [SetOverrideVoice](#setoverridevoice)       | Set voice to override the original voice.       |
| 函数 | [ClearOverrideVoice](#clearoverridevoice)   | Clear the overriding voice.                     |
| 函数 | [SetOverrideVideo](#setoverridevideo)       | –                                               |
| 函数 | [ClearOverrideVideo](#clearoverridevideo)   | –                                               |
| 函数 | [AddAuthVoiceUser](#addauthvoiceuser)       | Add a user to AuthVoiceUser by his ID.          |
| 函数 | [RemoveAuthVoiceUser](#removeauthvoiceuser) | Remove a user from AuthVoiceUser by his ID.     |
| 函数 | [AddAuthVideoUser](#addauthvideouser)       | –                                               |
| 函数 | [RemoveAuthVideoUser](#removeauthvideouser) | Remove a user from AuthVoiceUser by his ID.     |
| 属性 | [Enabled](#enabled)                         | Whether the Voice Zone component is Enabled     |
| 属性 | [AllowVoice](#allowvoice)                   | Whether allows voice.                           |
| 属性 | [AllowVideo](#allowvideo)                   | Whether allows video.                           |
| 属性 | [ConnectVoiceService](#connectvoiceservice) | –                                               |
| 属性 | [ConnectVideoService](#connectvideoservice) | –                                               |
| 属性 | [Priority](#priority)                       | The priority of the voice zone                  |
| 属性 | [AreaName](#areaname)                       | The name of area.                               |
| 属性 | [Spatialized](#spatialized)                 | Whether the voice zone is spatialized.          |
| 属性 | [SpatialDropoff](#spatialdropoff)           | Whether the voice zone is spatialized drop off. |
| 属性 | [SpatialStereo](#spatialstereo)             | Whether the voice zone is spatial stereo.       |
| 属性 | [SpatialDistance](#spatialdistance)         | The spatial distance of the voice zone.         |
| 属性 | [Global](#global)                           | Whether the voice zone is global.               |
| 属性 | [AuthVideoUsers](#authvideousers)           | Return an array of auth video user.             |
| 属性 | [AuthVoiceUsers](#authvoiceusers)           | –                                               |
| 属性 | [GameObject](#gameobject)                   | –                                               |

## 函数

### SetOverrideVoice

void SetOverrideVoice(bool enabled)

Set voice to override the original voice.

参数

| 名称    | 类型 | 默认值 |
| ------- | ---- | ------ |
| enabled | bool | –      |

返回值

`void`

示例

**Lua**

```lua
Space.Host.ExecutingObject.VoiceZone.SetOverrideVoice(true)

```

### ClearOverrideVoice

void ClearOverrideVoice()

Clear the overriding voice.

返回值

`void`

示例

**Lua**

```lua
Space.Host.ExecutingObject.VoiceZone.ClearOverrideVoice()

```

### SetOverrideVideo

void SetOverrideVideo(bool enabled)

参数

| 名称    | 类型 | 默认值 |
| ------- | ---- | ------ |
| enabled | bool | –      |

返回值

`void`

示例

**Lua**

```lua
Space.Host.ExecutingObject.VoiceZone.SetOverrideVideo(true)

```

### ClearOverrideVideo

void ClearOverrideVideo()

返回值

`void`

示例

**Lua**

```lua
Space.Host.ExecutingObject.VoiceZone.SetOverrideVideo(true)

```

### AddAuthVoiceUser

void AddAuthVoiceUser(uint userID)

Add a user to AuthVoiceUser by his ID.

参数

| 名称   | 类型 | 默认值 |
| ------ | ---- | ------ |
| userID | uint | –      |

返回值

`void`

示例

**Lua**

```lua
Space.Host.ExecutingObject.VoiceZone.AddAuthVoiceUser(000000000)

```

### RemoveAuthVoiceUser

void RemoveAuthVoiceUser(uint userID)

Remove a user from AuthVoiceUser by his ID.

参数

| 名称   | 类型 | 默认值 |
| ------ | ---- | ------ |
| userID | uint | –      |

返回值

`void`

示例

**Lua**

```lua
lSpace.Host.ExecutingObject.VoiceZone.RemoveAuthVoiceUser(000000000)

```

### AddAuthVideoUser

void AddAuthVideoUser(uint userID)

参数

| 名称   | 类型 | 默认值 |
| ------ | ---- | ------ |
| userID | uint | –      |

返回值

`void`

示例

**Lua**

```lua
Space.Host.ExecutingObject.VoiceZone.AddAuthVideoUser(000000000)

```

### RemoveAuthVideoUser

void RemoveAuthVideoUser(uint userID)

Remove a user from AuthVoiceUser by his ID.

参数

| 名称   | 类型 | 默认值 |
| ------ | ---- | ------ |
| userID | uint | –      |

返回值

`void`

示例

**Lua**

```lua
Space.Host.ExecutingObject.VoiceZone.RemoveAuthVideoUser(000000000)

```

## 属性

### Enabled

bool Enabled {get; set; }

Whether the Voice Zone component is Enabled

示例

**Lua**

```lua
Space.Host.ExecutingObject.VoiceZone.Enabled = true

```

**Lua**

```lua
--clicking this object will Enable/Disable it's Voice Zone component
thisGameObject = Space.Host.ExecutingObject
component = thisGameObject.VoiceZone

OnClick = function()
component.Enabled =  not component.Enabled
end

thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)

```

### AllowVoice

bool AllowVoice {get; set; }

Whether allows voice.

示例

**Lua**

```lua
Space.Host.ExecutingObject.VoiceZone.AllowVoice = true

```

### AllowVideo

bool AllowVideo {get; set; }

Whether allows video.

示例

**Lua**

```lua
Space.Host.ExecutingObject.VoiceZone.AllowVideo = true

```

### ConnectVoiceService

bool ConnectVoiceService {get; set; }

示例

**Lua**

```lua
Space.Host.ExecutingObject.VoiceZone.ConnectVoiceService = true

```

### ConnectVideoService

bool ConnectVideoService {get; set; }

示例

**Lua**

```lua
Space.Host.ExecutingObject.VoiceZone.ConnectVideoService = true

```

### Priority

int Priority {get; }

The priority of the voice zone

示例

**Lua**

```lua
priority = Space.Host.ExecutingObject.VoiceZone.Priority

```

### AreaName

string AreaName {get; }

The name of area.

示例

**Lua**

```lua
priority = Space.Host.ExecutingObject.VoiceZone.AreaName

```

### Spatialized

bool Spatialized {get; }

Whether the voice zone is spatialized.

示例

**Lua**

```lua
isSpatialized = Space.Host.ExecutingObject.VoiceZone.Spatialized

```

### SpatialDropoff

bool SpatialDropoff {get; }

Whether the voice zone is spatialized drop off.

示例

**Lua**

```lua
spatialDropoff = Space.Host.ExecutingObject.VoiceZone.SpatialDropoff

```

### SpatialStereo

bool SpatialStereo {get; }

Whether the voice zone is spatial stereo.

示例

**Lua**

```lua
spatialStereo = Space.Host.ExecutingObject.VoiceZone.SpatialStereo

```

### SpatialDistance

float SpatialDistance {get; }

The spatial distance of the voice zone.

示例

**Lua**

```lua
floatDistance = Space.Host.ExecutingObject.VoiceZone.SpatialDistance

```

### Global

bool Global {get; }

Whether the voice zone is global.

示例

**Lua**

```lua
isGlobal = Space.Host.ExecutingObject.VoiceZone.Global

```

### AuthVideoUsers

uint\[] AuthVideoUsers {get; }

Return an array of auth video user.

示例

**Lua**

```lua
tableAuthVideoUsers = Space.Host.ExecutingObject.VoiceZone.AuthVideoUsers

```

### AuthVoiceUsers

uint\[] AuthVoiceUsers {get; }

示例

**Lua**

```lua
tableAuthVideoUsers = Space.Host.ExecutingObject.VoiceZone.AuthVoiceUsers

```

### GameObject

[SGameObject](/docs/zh-Hans/scripting/client-scripting-api-reference/types/sgameobject.md) GameObject {get; }

示例

**Lua**

```lua
theGameObject = Space.Host.ExecutingObject.VoiceZone.GameObject

```
