C# 如何设置get;设置来自其他脚本的值

C# 如何设置get;设置来自其他脚本的值,c#,unity3d,C#,Unity3d,我正在制作一个Importor api插件,文件GameOptionsData.cs包含以下内容: /// <summary> /// Gets or sets the Impostor cooldown to kill in seconds. /// </summary> public float KillCooldown { get; set; } if(message[0] == "/cooldown")

我正在制作一个Importor api插件,文件GameOptionsData.cs包含以下内容:

    /// <summary>
    /// Gets or sets the Impostor cooldown to kill in seconds.
    /// </summary>
    public float KillCooldown { get; set; }
if(message[0] == "/cooldown")
        {
            if (message[1] != null)
            {
                int kkd = 0;
                bool CanConvert = int.TryParse(message[1], out kkd);
                if (CanConvert == true)
                {
                    e.PlayerControl.SendChatToPlayerAsync("you would have made the kill cooldown," + kkd + ", but my code is not currently working Sorry!");
                    //Set Cooldown here
                }
                else
                {
                    e.PlayerControl.SendChatToPlayerAsync("This command requires a number \n Example: /cooldown 10");
                }
            }else
            {
                e.PlayerControl.SendChatToPlayerAsync("This command requires a number \n Example: /cooldown 10");
            }
        }
我想改变KillCooldown的值,这里写着//Set Cooldown这里怎么做我对C不太了解,所以如果这是一个愚蠢的问题或者我完全用错误的方式思考这个问题,我道歉。谢谢

您可以简单地使用:

//set the cool down
e.Game.Options.KillCooldown = 10;
//sync the cooldown to all clients
e.Game.SyncSettingsAsync();

GameOptionsData类是否扩展了MonoBehavior?或者它是一个普通的旧类。什么是
e
?这回答了你的问题吗?