找出自定义 class 中的布尔值
Finding out the value of a boolean in a custom class
我有一个下面给出的自定义 class 脚本,我附上了它在检查器中的外观图像。假设,我想知道 'Apply some pressure' 的 'has Bought' 布尔值是否为真。我怎么知道呢?另外,如何设置另一个 bool 等于它?自定义 class 脚本的代码:
[System.Serializable]
public class Buyables
{
public string name; // A string called as Name
public int price; // An integer called as price
public bool hasBought; // A bool called as has bought
}
I want to know if the 'has Bought' boolean of 'Apply some pressure' is
true
获取您的资金参考 Class。
Money money;
检查布尔值:
money.buyables[1].hasBought == true
how do I set another bool equal to it?
anotherBoolVariable = money.buyables[1].hasBought;
[System.Serializable]
public class Buyables
{
public string name; // A string called as Name
public int price; // An integer called as price
public bool hasBought; // A bool called as has bought
}
I want to know if the 'has Bought' boolean of 'Apply some pressure' is true
获取您的资金参考 Class。
Money money;
检查布尔值:
money.buyables[1].hasBought == true
how do I set another bool equal to it?
anotherBoolVariable = money.buyables[1].hasBought;