在 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",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 但它关闭更大的类。我如何选择括号关闭方法或类?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)