传递类实例后变量未更新

时间:2018-07-06 04:14:54

标签: c# unity3d

我有三个班级,像这样:

父类VeggiesLevel

public partial class VeggiesLevel : Level
{
    private IEnumerator win_cr()
    {
        this.carrotDied = true;
        yield return CupheadTime.WaitForSeconds(this, 1f);
        this.properties.WinInstantly();
        yield break;
    }
    public bool carrotDied;
}

子类VeggiesLevelOnion,此子类稍后会被销毁。它会创建一个孩子VeggiesLevelOnionHomingHeart

public partial class VeggiesLevelOnion : LevelProperties.Veggies.Entity
{
    private void BashfulAnimComplete()
    {
        this.homingHeartPrefab.CreateRadish().level = this.level;
    }
    public VeggiesLevel level;
}

这是孩子VeggiesLevelOnionHomingHeart的孩子。我希望将其在carrotDied的{​​{1}}上的VeggiesLevel

中销毁
true

但是无论我做什么,布尔值都不会在我检查public partial class VeggiesLevelOnionHomingHeart : AbstractProjectile { private IEnumerator checkDeath_cr() { while (!this.level.carrotDied) { yield return null; } this.Death(); yield break; } public VeggiesLevel level; } 时更新。我在做什么错了?

0 个答案:

没有答案