Exemplo n.º 1
0
 public override void FinishDecision(MAnimalBrain brain, int Index)
 {
     //Reset all variables
     boolListener  = null;
     intListener   = null;
     floatListener = null;
 }
Exemplo n.º 2
0
        public override void PrepareDecision(MAnimalBrain brain, int Index)
        {
            //Reset all variables
            boolListener  = null;
            intListener   = null;
            floatListener = null;

            if (checkOn == Affected.Target)
            {
                var objective = brain.Target;

                switch (varType)
                {
                case VarType.Bool:
                    boolListener = objective.GetComponent <BoolVarListener>();
                    break;

                case VarType.Int:
                    intListener = objective.GetComponent <IntVarListener>();
                    break;

                case VarType.Float:
                    floatListener = objective.GetComponent <FloatVarListener>();
                    break;

                default:
                    break;
                }
            }
            else
            {
                var objective = brain.transform;

                switch (varType)
                {
                case VarType.Bool:
                    boolListener = objective.GetComponent <BoolVarListener>();
                    break;

                case VarType.Int:
                    intListener = objective.GetComponent <IntVarListener>();
                    break;

                case VarType.Float:
                    floatListener = objective.GetComponent <FloatVarListener>();
                    break;

                default:
                    break;
                }
            }
        }