Example #1
0
    bool CheckCover(Cover c, Cover[] allObjects)
    {
        bool   result    = true;
        string resString = "";

        if (c.TestFlags(Cover.E_CoverFlags.LeftStand) || c.TestFlags(Cover.E_CoverFlags.LeftCrouch))
        {
            if (!CheckCapsule(c, AgentActionCoverLeave.E_Type.Left))
            {
                resString += "LEFT";
                result     = false;
            }
        }

        if (c.TestFlags(Cover.E_CoverFlags.RightStand) || c.TestFlags(Cover.E_CoverFlags.RightCrouch))
        {
            if (!CheckCapsule(c, AgentActionCoverLeave.E_Type.Right))
            {
                Debug.LogWarning("Cover " + c.name + " leaving position in collision : direction RIGHT");

                resString += result ? "RIGHT" : ", RIGHT";
                result     = false;
            }
        }

        if (c.CanJumpUp)
        {
            if (!CheckCapsule(c, AgentActionCoverLeave.E_Type.JumpUp))
            {
                Debug.LogWarning("Cover " + c.name + " leaving position in collision : direction JUMPUP");

                resString += result ? "JUMPUP" : ", JUMPUP";
                result     = false;
            }
        }

        if (!CheckCapsule(c, AgentActionCoverLeave.E_Type.Back))
        {
            Debug.LogWarning("Cover " + c.name + " leaving position in collision : direction BACK");
            resString += result ? "BACK" : ", BACK";
            result     = false;
        }

        if (!result)
        {
            Debug.LogWarning(" Cover " + c.GetFullName() + " wrong dirrections : " + resString);
        }
        else
        {
            /*result = CheckLowEdgeOfCover( c );
             * if( !result )
             * {
             *      Debug.LogWarning(" Cover " + c.GetFullName() + " with bottom edge under the terrain.");
             * }*/
        }

        return(result);
    }