public float SupportValue(StabilityEntity ignoreEntity = null)
    {
        if (this.grounded)
        {
            return(1f);
        }
        if (this.supports == null)
        {
            return(1f);
        }
        if (ignoreEntity == null)
        {
            ignoreEntity = this;
        }
        float single = 0f;

        for (int i = 0; i < this.supports.Count; i++)
        {
            StabilityEntity.Support item            = this.supports[i];
            StabilityEntity         stabilityEntity = item.SupportEntity(ignoreEntity);
            if (stabilityEntity != null)
            {
                float single1 = stabilityEntity.CachedSupportValue(ignoreEntity);
                if (single1 != 0f)
                {
                    single = single + single1 * item.factor;
                }
            }
        }
        return(Mathf.Clamp01(single));
    }
Example #2
0
    public float SupportValue(StabilityEntity ignoreEntity = null)
    {
        if (this.grounded || this.supports == null)
        {
            return(1f);
        }
        if (Object.op_Equality((Object)ignoreEntity, (Object)null))
        {
            ignoreEntity = this;
        }
        float num1 = 0.0f;

        for (int index = 0; index < this.supports.Count; ++index)
        {
            StabilityEntity.Support support         = this.supports[index];
            StabilityEntity         stabilityEntity = support.SupportEntity(ignoreEntity);
            if (!Object.op_Equality((Object)stabilityEntity, (Object)null))
            {
                float num2 = stabilityEntity.CachedSupportValue(ignoreEntity);
                if ((double)num2 != 0.0)
                {
                    num1 += num2 * support.factor;
                }
            }
        }
        return(Mathf.Clamp01(num1));
    }