public int DistanceFromGround(StabilityEntity ignoreEntity = null)
    {
        if (this.grounded)
        {
            return(1);
        }
        if (this.supports == null)
        {
            return(1);
        }
        if (ignoreEntity == null)
        {
            ignoreEntity = this;
        }
        int num = 2147483647;

        for (int i = 0; i < this.supports.Count; i++)
        {
            StabilityEntity stabilityEntity = this.supports[i].SupportEntity(ignoreEntity);
            if (stabilityEntity != null)
            {
                int num1 = stabilityEntity.CachedDistanceFromGround(ignoreEntity);
                if (num1 != 2147483647)
                {
                    num = Mathf.Min(num, num1 + 1);
                }
            }
        }
        return(num);
    }
예제 #2
0
    public int DistanceFromGround(StabilityEntity ignoreEntity = null)
    {
        if (this.grounded || this.supports == null)
        {
            return(1);
        }
        if (Object.op_Equality((Object)ignoreEntity, (Object)null))
        {
            ignoreEntity = this;
        }
        int num1 = int.MaxValue;

        for (int index = 0; index < this.supports.Count; ++index)
        {
            StabilityEntity stabilityEntity = this.supports[index].SupportEntity(ignoreEntity);
            if (!Object.op_Equality((Object)stabilityEntity, (Object)null))
            {
                int num2 = stabilityEntity.CachedDistanceFromGround(ignoreEntity);
                if (num2 != int.MaxValue)
                {
                    num1 = Mathf.Min(num1, num2 + 1);
                }
            }
        }
        return(num1);
    }