示例#1
0
    public AlarmState(Guard guard) : base(guard)
    {
        this.guard  = guard;
        this.action = "alarm";
        // Alarm Decision Tree

        /*BackupDecision d = new BackupDecision(guard);
        *  d.trueNode = new TargetState(guard, "attack");
        *  d.falseNode = new TargetState(guard, "wait");*/
        AlarmDecision e = new AlarmDecision(guard);

        e.trueNode  = new TargetState(guard, "attack");
        e.falseNode = null;

        Decision tree = e;

        this.transition = new Transition(tree);
    }
示例#2
0
    public PatrolState(Guard guard) : base(guard)
    {
        this.guard  = guard;
        this.action = "patrol";

        // Patrol Decision Tree
        AggressiveDecision a = new AggressiveDecision(guard);

        a.trueNode  = new TargetState(guard, "alarm");
        a.falseNode = new TargetState(guard, "attack");

        NearbyDecision b = new NearbyDecision(guard);

        b.trueNode  = a;
        b.falseNode = new TargetState(guard, "alarm");
        //Debug.Log(((TargetState) b.falseNode).state);

        SpottedDecision c = new SpottedDecision(guard);

        c.trueNode  = b;
        c.falseNode = null;

        AlarmDecision d = new AlarmDecision(guard);

        d.trueNode  = new TargetState(guard, "attack");
        d.falseNode = c;

        LaserDecision e = new LaserDecision(guard);

        e.trueNode  = new TargetState(guard, "investigate");
        e.falseNode = d;

        Decision tree = e;

        this.transition = new Transition(tree);
    }