Example #1
0
    // this is for initialising the decisions for the tree
    private void Awake()
    {
        // the starting node should be to test if skill three is on cooldown
        TheDecisions    SkillThreeDecision     = new TheDecisions();
        TheDecisionNode SkillThreeDecisionNode = new TheDecisionNode();

        SkillThreeDecisionNode.DecisionType = "SkillThree";
        SkillThreeDecisionNode.SetTheDecision(SkillThreeDecision);

        // if the decision is no then it should be an action node and use the skill three
        // as the question it is asking is... is skill three on cooldown?
        TheActions    SkillThreeAction     = new TheActions();
        TheActionNode SkillThreeActionNode = new TheActionNode();

        SkillThreeActionNode.SetActionName("SkillThree");
        SkillThreeActionNode.SetAction(SkillThreeAction);
        SkillThreeDecisionNode.AddNoNode(SkillThreeActionNode);


        // if the decision is yes then it should be a decsision node for the second skill
        // because if skill three is on cooldown then it needs to check
        TheDecisions    SkillTwoDecision      = new TheDecisions();
        TheDecisionNode SkillTwoDecsisionNode = new TheDecisionNode();

        SkillTwoDecsisionNode.DecisionType = "SkillTwo";
        SkillTwoDecsisionNode.SetTheDecision(SkillTwoDecision);
        SkillThreeDecisionNode.AddYesNode(SkillTwoDecsisionNode);

        // if the decision for the skill two decsision is yes then should be action node to use skill one
        TheActions    SkillOneAction     = new TheActions();
        TheActionNode SkillOneActionNode = new TheActionNode();

        SkillOneActionNode.SetActionName("SkillOne");
        SkillOneActionNode.SetAction(SkillOneAction);
        SkillTwoDecsisionNode.AddYesNode(SkillOneActionNode);

        // if the decsision for the skill two decision is no then should be action node to use skill two
        TheActions    SkillTwoAction     = new TheActions();
        TheActionNode SkillTwoActionNode = new TheActionNode();

        SkillTwoActionNode.SetActionName("SkillTwo");
        SkillTwoActionNode.SetAction(SkillTwoAction);
        SkillTwoDecsisionNode.AddNoNode(SkillTwoActionNode);



        AIScript = new TheAIScript(SkillThreeDecisionNode);
    }
Example #2
0
 // a function to set the action for the action node
 public void SetAction(TheActions Action)
 {
     TheAction = Action;
 }