Ejemplo n.º 1
0
    public SpiderJPTree()
    {
        DTBinaryDecision RotatedToSpiderTree = new DTBinaryDecision(RotatedToSpider(), Atack(), Move());
        DTBinaryDecision CloseToWebTree      = new DTBinaryDecision(CloseToWeb(), Run(), Move());
        DTBinaryDecision SpiderEatingTree    = new DTBinaryDecision(SpiderEating(), RotatedToSpiderTree, CloseToWebTree);

        root = new DTBinaryDecision(Eaten(), MoveToSpider(), SpiderEatingTree);
    }
Ejemplo n.º 2
0
    void Update()
    {
        distanceToPlayer = Vector3.Distance(transform.position, target.position);

        //Debug.Log("Distance: " + distanceToPlayer);

        DTBinaryDecision tree = new DTBinaryDecision(() =>
        {
            return(distanceToPlayer < 50f);
        },

                                                     new DTAction(() =>
        {
            Attack();
        }),

                                                     new DTAction(() =>
        {
            Debug.Log("Waiting");
            isClose = false;
        }));

        new DTBinaryDecision(() =>
        {
            return(distanceToPlayer < 10f);
        },

                             new DTAction(() =>
        {
            Debug.Log("You died");
        }),
                             new DTAction(() =>
        {
            Debug.Log("Continue");
        }));

        tree.MakeDecision().Run();
    }