Example #1
0
    private IDataCondition CreateDataCondition(Dictionary <string, object> obj)
    {
        if (obj.ContainsKey("ConditionType") == false)
        {
            UnityEngine.Debug.Log(" Type not specified");
            return(null);
        }


        string condType = obj["ConditionType"] as string;
        var    dataCond = new  AllTrueCondition();

        List <Condition> conditions = new List <Condition>();

        if (obj.ContainsKey("Conditions"))
        {
            IList <object> oList = obj["Conditions"] as IList <object>;
            dataCond.Conditions = LoadConditions(oList);
        }
        else
        {
            UnityEngine.Debug.Log(" no conditions found ");
        }

        dataCond.SuccessAction = LoadAction("SuccessAction", obj);
        dataCond.FailureAction = LoadAction("FailureAction", obj);

        dataCond.SuccessAction.InvokeAction();

        return(dataCond);
    }
Example #2
0
    private List <BaseCondition> CreateConditionList()
    {
        BaseCondition firstTest = new AllTrueCondition();

        firstTest.ConditionType = "ALL";
        //	firstTest.FailureAction = new LogAction( "Failed action" );
        //	firstTest.SuccessAction = new LogAction( " Sucess Action" );

        List <Condition> conditionList = new List <Condition>();
        var cond = new Condition();

        cond.ConditionEvent = new IsGreaterEvent();
        cond.ConditionEvent.SetConditionEventType("IsGreater");
        cond.Parameters = new IsGreaterParameters(7, 5);
        conditionList.Add(cond);

        cond = new Condition();
        cond.ConditionEvent = new IsGreaterEvent();
        cond.Parameters     = new IsGreaterParameters(2, 5);
        conditionList.Add(cond);

        firstTest.Conditions = conditionList;

        List <BaseCondition> testList = new List <BaseCondition>();

        testList.Add(firstTest);
        return(testList);
    }