Ejemplo n.º 1
0
 private void Update()
 {
     curTarget = findNewTarget;
     while (curTarget.MakeDecision() != null)
     {
         curTarget = curTarget.MakeDecision();
     }
 }
Ejemplo n.º 2
0
    private void Update()
    {
        totalBunnies = GameObject.FindGameObjectsWithTag("Bunny");

        for (int i = 0; i < totalBunnies.Length; i++)
        {
            if (!totalBunnies[i].GetComponent <BunnyAI>().healthyBunny)
            {
                infectionMark++;
            }
        }

        if (infectionMark != totalBunnies.Length)
        {
            infectionMark = 0;

            currentDecision = BunnyAi;

            while (currentDecision != null)
            {
                currentDecision = currentDecision.MakeDecision();
            }
        }
        else
        {
            SceneManager.LoadScene("gameover");
        }
    }
 //  Every frame makes a decision on what to do;
 private void Update()
 {
     curDec = enemCheck;
     while (curDec != null)
     {
         curDec = curDec.MakeDecision();
     }
 }
Ejemplo n.º 4
0
    void Update()
    {
        IDecision currentDecision = decisionTreeRoot;

        while (currentDecision != null)
        {
            decisionTreeRoot.MakeDecision();
        }
    }
Ejemplo n.º 5
0
    public override void RunTree(AIAgent agent)
    {
        Update(agent);

        IDecision current = start;

        while (null != current)
        {
            current = current.MakeDecision();
        }
    }
Ejemplo n.º 6
0
    // Update is called once per frame
    void Update()
    {
        //decisionTreeRoot.MakeDecision();

        IDecision currentDecision = decisionTreeRoot;

        while (currentDecision != null)
        {
            currentDecision = currentDecision.MakeDecision();
        }
        //decisionTreeRoot = new PrintDecision(true);
    }
Ejemplo n.º 7
0
 void Update()
 {
     if (startNode != null)
     {
         currentNode = startNode;
         while (currentNode != null)
         {
             currentNode.MakeDecision();
             currentNode = currentNode.GetNode();
         }
     }
 }
Ejemplo n.º 8
0
    void Update()
    {
        // On update, set the current to the root.
        currentDecision = decisionTreeRoot;

        // keep going through the tree until you hit null. null will be at the end
        // of a final decision (like the leaf of a tree).
        while (currentDecision != null)
        {
            currentDecision = currentDecision.MakeDecision();
        }
    }
Ejemplo n.º 9
0
    void Start()
    {
        // var first = new FirstDecision();
        // var botch = new Chaser();
        FirstDecision first = new FirstDecision();

        IDecision test = first;

        while (test != null)
        {
            test = test.MakeDecision();
        }
    }
Ejemplo n.º 10
0
    public abstract void Update(AIAgent agent); // update values

    /// <summary>
    /// make decision
    /// </summary>
    /// <param name="agent">the agent to act upon</param>
    public void RunTree(AIAgent agent)
    {
        if (PauseState.Instance.Paused)
        {
            return;
        }

        current = start;
        while (null != current)
        {
            current = current.MakeDecision();
        }
    }
Ejemplo n.º 11
0
    private void Update()
    {
        AssassinAI = new DoISeePlayer(
            new IsPlayerInBush(
                new WanderAround(this),
                new AmICloseToPlayer(
                    new AttackPlayer(this),
                    new ChasePlayer(this), this), this),
            new WanderAround(this), this);

        currentDecision = AssassinAI;

        while (currentDecision != null)
        {
            currentDecision = currentDecision.MakeDecision();
        }
    }
Ejemplo n.º 12
0
    void Update()
    {
        if (stayingInBush == true)
        {
            if (timeBtwHits <= 0)
            {
                stayingInBush = false;
                timeBtwHits   = startTimeBtwHits;
            }
            else
            {
                timeBtwHits -= Time.deltaTime;
            }
        }

        if (wandererHealth > 0 && stayingInBush == false) // if wanderer has health, then it's alive
        {
            WandererAI = new DoISeeEnemy(
                new AmIInBush(
                    new StayInBush(this),
                    new DoISeeBush(
                        new HideInBush(this),
                        new Panic(this), this), this),
                new ContinuePath(this), this);

            currentDecision = WandererAI;

            while (currentDecision != null)
            {
                currentDecision = currentDecision.MakeDecision();
            }
        }
        else if (wandererHealth <= 0)
        {
            Destroy(gameObject);
        }
    }
Ejemplo n.º 13
0
 // Update is called once per frame
 void FixedUpdate()
 {
     seesPlayer.MakeDecision();
 }
Ejemplo n.º 14
0
 public IDecision MakeDecision()
 {
     flee.MakeDecision();
     return(flee);
 }
Ejemplo n.º 15
0
 public IDecision MakeDecision()
 {
     return(Value ? trueBranch.MakeDecision() : falseBranch.MakeDecision());
 }
Ejemplo n.º 16
0
        void Start()
        {
            decisionTreeRoot = new PrintDecision(true);

            decisionTreeRoot.MakeDecision();
        }