Example #1
0
 private void Update()
 {
     curTarget = findNewTarget;
     while (curTarget.MakeDecision() != null)
     {
         curTarget = curTarget.MakeDecision();
     }
 }
Example #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();
     }
 }
Example #4
0
    void Update()
    {
        IDecision currentDecision = decisionTreeRoot;

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

        IDecision current = start;

        while (null != current)
        {
            current = current.MakeDecision();
        }
    }
Example #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);
    }
Example #7
0
 void Update()
 {
     if (startNode != null)
     {
         currentNode = startNode;
         while (currentNode != null)
         {
             currentNode.MakeDecision();
             currentNode = currentNode.GetNode();
         }
     }
 }
Example #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();
        }
    }
Example #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();
        }
    }
Example #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();
        }
    }
Example #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();
        }
    }
Example #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);
        }
    }
Example #13
0
 // Update is called once per frame
 void FixedUpdate()
 {
     seesPlayer.MakeDecision();
 }
Example #14
0
 public IDecision MakeDecision()
 {
     flee.MakeDecision();
     return(flee);
 }
Example #15
0
 public IDecision MakeDecision()
 {
     return(Value ? trueBranch.MakeDecision() : falseBranch.MakeDecision());
 }
Example #16
0
        void Start()
        {
            decisionTreeRoot = new PrintDecision(true);

            decisionTreeRoot.MakeDecision();
        }