//---------------------[[buildDecision: ]]----------------------------------//

    /**
     * DecisionTree():
     *
     * builds the choice that this AI has when certian events happen in game.
     * the AI can choose to stay still if no enemy is near by. else if there is check to see if
     * that player is to close to the AI, if so Move away. Else attack the player.
     *
     * return: nothing.
     */
    public void DecisionTree()
    {
        decisionTree inRange = new decisionTree();

        inRange.buildDecision(enemySpottedAndShoot);

        decisionTree ply2Close = new decisionTree();

        ply2Close.buildDecision(plyToClose);

        decisionTree attack = new decisionTree();

        attack.buildAction(Attack);

        decisionTree move = new decisionTree();

        move.buildAction(Move);

        decisionTree idle = new decisionTree();

        idle.buildAction(this.idle);



//--------[[build the tree: ]]-----------//

        inRange.Right(ply2Close);
        ply2Close.Right(move);
        ply2Close.Left(attack);
        inRange.Left(idle);


        this.rootOfTree = inRange;
    }
 public decisionTree()
 {
     this.action    = null;
     this.decision  = null;
     this.leftNode  = null;
     this.rightNode = null;
 }
    //---------------------[[buildDecision: ]]----------------------------------//

    /**
     * DecisionTree():
     *  the decision tree controls and managers this AI.
     *
     * return: nothing.
     */
    public void DecisionTree()
    {
        //--------------[[Decisions to build:]]-------------------//
        decisionTree powerType = new decisionTree();

        powerType.buildDecision(changePowerLVL);

        decisionTree needCast = new decisionTree();

        needCast.buildDecision(NeedToCast);

        decisionTree inRange = new decisionTree();

        inRange.buildDecision(enemySpottedAndShoot);

        decisionTree forceCast = new decisionTree();

        forceCast.buildDecision(forceCastSpell);

        //-------------------[[actions to build:]]---------------------------//
        decisionTree changeType = new decisionTree();

        changeType.buildAction(this.changeType);

        decisionTree cast = new decisionTree();

        cast.buildAction(this.castSpell);

        decisionTree basicAtck = new decisionTree();

        basicAtck.buildAction(this.basicAtk);

        decisionTree castSpellAtRandom = new decisionTree();

        castSpellAtRandom.buildAction(this.castSpellAtRandom);



        //--------[[build the tree: ]]-----------//

        powerType.Right(changeType);
        powerType.Left(needCast);

        needCast.Right(cast);
        needCast.Left(inRange);

        inRange.Right(forceCast);
        inRange.Left(castSpellAtRandom);

        forceCast.Right(castSpellAtRandom);
        forceCast.Left(basicAtck);

        rootOfTree = powerType;
    }
    /**
     * void buildDecisionTree():
     *
     * This functions builds the entire AIS decision tree, what ever we want the ai to do we must make a node for it.
     * Each action should have a decision leading behind it. The node of the decision tree has something called a
     * delegate within it. So if the node you are building has a decision assign that decision function to the deleagate.
     *
     * return: Nothing
     *
     */
    public void buildDecisionTree()
    {
        decisionTree inRangeNode = new decisionTree();           // create the root of our tree.

        inRangeNode.buildDecision(enemySpotted);                 // the root of this tree is a Decision it is if the enemy is spotted or not.

        decisionTree MoveTowardsEnemy = new decisionTree();      //the second node is a action.

        MoveTowardsEnemy.buildAction(Movement);                  // assign the node to a action within the Tree.

        decisionTree idle = new decisionTree();                  // the third node is a Action.

        idle.buildAction(this.idle);                             // assign the node to a action.



        inRangeNode.Left(idle);                                 // the root is now in need of its children. Assign the false choice to idle.
        inRangeNode.Right(MoveTowardsEnemy);                    // true choice is to move towards the enemy.

        rootOfTree = inRangeNode;                               // set the root.
    }
 /**
  * void Right:
  * param: RightNode: The right node of the parent called
  *
  * sets the right Node of the this parent.
  *
  * return Nothing
  *
  */
 public void Right(decisionTree rightNode)
 {
     this.rightNode = rightNode;
 }
    /**
     * void left:
     * param: LeftNode: The left node of the parent called
     *
     * sets the left Node of the this parent.
     *
     * return Nothing
     *
     */


    public void Left(decisionTree leftNode)
    {
        this.leftNode = leftNode;
    }