visual-studio-2019 - 如何控制 Visual Studio 2019 中哪些花括号链接到哪些?
问题描述
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SpawnManagerX : MonoBehaviour
{
public GameObject[] ballPrefabs;
private float spawnLimitXLeft = -22;
private float spawnLimitXRight = 7;
private float spawnPosY = 30;
private float startDelay = 1.0f;
void Start()
{
InvokeRepeating("SpawnRandomBall", startDelay, spawnInterval);
InvokeRepeating("IntervalRandomiser", startDelay, spawnInterval);
}
void SpawnRandomBall()
{
Vector3 spawnPos = new Vector3(Random.Range(spawnLimitXLeft,
spawnLimitXRight), spawnPosY, 0);
Instantiate(ballPrefabs[Random.Range(0, 3)], spawnPos,
ballPrefabs[Random.Range(0, 3)].transform.rotation);
}
void IntervalRandomiser() {
public int spawnInterval = Random.Range(3, 6);
}
我在“ public int spawnInterval = Random.Range(3, 6); ”(倒数第二行)下插入一个新行,并添加一个花括号来关闭 IntervalRandomiser 方法,但花括号会关闭该类。所以,我希望括号关闭 IntervalRandomiser 但它关闭了更大的类。我如何选择括号关闭的方法或类?
解决方案
推荐阅读
- android - D-PAD TV 焦点上每个视图元素的默认轮廓
- javascript - 如何使用 JS 从 JSON 中提取数据
- python - 如何将熊猫数据框转换为具有聚合级别的嵌套命名元组
- r - 在 r 中使用循环基于正则表达式创建变量
- python - 在 Windows 10 上从源代码安装旧版 python
- perl - 使用 Mojolicious 重定向到不同的域
- javascript - 如果页面正在加载,使用 javascript 或 jQuery 的最佳监听方式是什么?
- python - 错误:OID 未增加:SNMPv2-SMI::dod,如何增加 OID?
- swift - IGListKitSections 没有被释放
- jmeter - 如何使用 Jmeter 为 Web 应用程序设置基线