示例#1
0
    public DamageStorage GetCurrentOrCreateDamageStorage()
    {
        foreach (var o in Damaged)
        {
            var damageStorage = o.GetComponent <DamageStorage>();
            if (damageStorage.CurrentDamage < 100)
            {
                return(damageStorage);
            }
        }

        var newDamaged = CreateNewDamaged();

        Damaged.Add(newDamaged);

        return(newDamaged.GetComponent <DamageStorage>());
    }