Example #1
0
    static public void SetCornerDistanceExt(this Cover cover, float desiredDistance, float testedCollisionDistance)
    {
        if (cover.TestFlags(Cover.E_CoverFlags.RightStand) || cover.TestFlags(Cover.E_CoverFlags.RightCrouch))
        {
            float rightDistance = cover.GetCornerDistanceExt(true, testedCollisionDistance);

            if (rightDistance >= 0)
            {
                // align right corner
                cover.AlignCornersExt(0, rightDistance - desiredDistance);
            }
        }
        // without else

        if (cover.TestFlags(Cover.E_CoverFlags.LeftStand) || cover.TestFlags(Cover.E_CoverFlags.LeftCrouch))
        {
            float leftDistance = cover.GetCornerDistanceExt(false, testedCollisionDistance);

            if (leftDistance >= 0)
            {
                // align left corner
                cover.AlignCornersExt(leftDistance - desiredDistance, 0);
            }
        }
    }
Example #2
0
    private void ProceedOneCoverDistances(Cover cover)
    {
        bool canStandRight = cover.TestFlags(Cover.E_CoverFlags.RightStand);
        bool canStandLeft  = cover.TestFlags(Cover.E_CoverFlags.LeftStand);

        CoverUtils.VisualizationColor = Color.blue;

        if (true == canStandRight || true == canStandLeft)
        {
            m_DistanceToWallStand.Absorb(cover.GetWallDistanceExt(m_TestedCollisonDistance));
        }
        else if (cover.TestFlags(Cover.E_CoverFlags.LeftCrouch) || cover.TestFlags(Cover.E_CoverFlags.RightCrouch))
        {
            m_DistanceToWallCrouch.Absorb(cover.GetWallDistanceExt(m_TestedCollisonDistance));
        }

        CoverUtils.VisualizationColor = Color.yellow;

        if (true == canStandRight)
        {
            m_DistanceStandCorner.Absorb(cover.GetCornerDistanceExt(true, m_TestedCollisonDistance));
        }
        else if (cover.TestFlags(Cover.E_CoverFlags.RightCrouch))
        {
            m_DistanceCrouchCorner.Absorb(cover.GetCornerDistanceExt(true, m_TestedCollisonDistance));
        }
        else
        {
            // right side of cover without special flag
        }

        if (true == canStandLeft)
        {
            m_DistanceStandCorner.Absorb(cover.GetCornerDistanceExt(false, m_TestedCollisonDistance));
        }
        else if (cover.TestFlags(Cover.E_CoverFlags.LeftCrouch))
        {
            m_DistanceStandCorner.Absorb(cover.GetCornerDistanceExt(false, m_TestedCollisonDistance));
        }
        else
        {
            // left side of cover without special flag
        }
    }