示例#1
0
    public bool CheckAndReact()
    {
        bool condNotNull = (boolCondition != null);
        bool compNotNull = (compCondition != null);
        bool condResult  = !condNotNull;
        bool compResult  = !compNotNull;

        if (!compNotNull && !condNotNull)
        {
            Debug.Log("This interaction doesn't contain any condition, so it will trigger successful. ");
        }
        else
        {
            if (condNotNull)
            {
                condResult = boolCondition.IsSatisfied();
            }
            if (compNotNull)
            {
                compResult = compCondition.IsSatisfied();
            }
        }

        if (condResult && compResult)
        {
            action.Invoke();
            return(true);
        }

        return(false);
    }