Пример #1
0
    public InvestigateState(Guard guard) : base(guard)
    {
        this.guard  = guard;
        this.action = "investigate";

        // Investigate 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 = new TargetState(guard, "patrol");

        //If player spotted during travel to room
        SpottedDecision d = new SpottedDecision(guard);

        d.trueNode  = b;
        d.falseNode = null;

        RoomDecision e = new RoomDecision(guard);

        e.trueNode  = c;
        e.falseNode = d;

        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);
    }