Esempio n. 1
0
        public void TestBool()
        {
            var c1 = new ConditionBool(true, true, false);
            var c2 = new ConditionBool(false, true, true);
            var c3 = new ConditionBool(true, true, true);
            var c4 = new ConditionBool(null, false, null, true);

            var funcTable = new FuncTableBool();

            funcTable[c1] = delegate() { Debug.Log(c1); };
            funcTable[c2] = delegate() { Debug.Log(c2); };
            funcTable[c3] = delegate() { Debug.Log(c3); };
            funcTable[c4] = delegate() { Debug.Log(c4); };

            Debug.Log("Test exact objects ---- >");

            funcTable[c1]();
            funcTable[c2]();
            funcTable[c3]();
            funcTable[c4]();

            Debug.Log("Test ephemeral indices ---- >");

            funcTable[new ConditionBool(true, true, false)]();
            funcTable[new ConditionBool(false, true, true)]();
            funcTable[new ConditionBool(true, true, true)]();
            funcTable[new ConditionBool(null, false, null, true)]();
        }
Esempio n. 2
0
    public override void Awake()
    {
        base.Awake();

        //go to start when called by user
        ConditionBool cb = new ConditionBool();

        cb.valueCondition = agent;
        cb.valueTest      = false;
        State      st         = GetComponent <NextPointState>();
        Transition transition = new Transition();

        transition.condition = cb;
        transition.target    = st;
        transitions.Add(transition);
    }
Esempio n. 3
0
    public override void Awake()
    {
        targetAux = new GameObject();
        targetAux.transform.position = transform.position;

        timer = Random.Range(0.0f, wanderTime / 2);

        base.Awake();

        //go to start when called by user
        ConditionBool cb = new ConditionBool();

        cb.valueCondition = agent;
        cb.valueTest      = true;
        State      st         = GetComponent <ArriveState>();
        Transition transition = new Transition();

        transition.condition = cb;
        transition.target    = st;
        transitions.Add(transition);
    }
Esempio n. 4
0
     public Action this[ConditionBool c]
     {
         get
         {
             Action val;
             if (!conditionDict.TryGetValue(c, out val))
             {
                 if (DefaultAction != null)
                 {
                     return(DefaultAction);
                 }
                 else
                 {
                     return delegate() { Debug.Log("Unimplemented combination: " + c); }
                 };
             }
             return(conditionDict[c]);
         }
         set
         {
             conditionDict[c] = value;
         }
     }
 }