public override Playable CreatePlayable(PlayableGraph graph, GameObject myGameObject)
    {
        GetWeapon playableBehaviour = new GetWeapon();

        //playableBehaviour.mySceneObject = mySceneObject.Resolve(graph.GetResolver());
        // playableBehaviour.sceneObjectVelocity = sceneObjectVelocity;
        return(ScriptPlayable <GetWeapon> .Create(graph, playableBehaviour));
    }
    public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
    {
        GetWeapon playableBehaviour = new GetWeapon();

        playableBehaviour.nodeName = nodeName;
        playableBehaviour.weapon   = weapon;
        playableBehaviour.count    = count;
        return(ScriptPlayable <GetWeapon> .Create(graph, playableBehaviour));
    }
    protected void Awake()
    {
        ttm = GetComponent <TargetTrackingManager>();
        base.Awake();

        actions = new List <Action>();
        startWS = new Ws();
        //set the worlds states for the start of the game
        startWS.SetVal(Wstates.KnowledgeOfTree, true);
        startWS.SetVal(Wstates.KnowledgeOfNails, true);
        startWS.SetVal(Wstates.KnowledgeOfHouse, true);
        startWS.SetVal(Wstates.KnowledgeOfTent, true);
        startWS.SetVal(Wstates.KnowledgeOfWeapon, true);


        // creating all of the actions that the AI will need to complete its neccassary goal. each action will be initilised with the name, cost, object and type of action.
        //Along with its preconditions and effects to the world state.

        //Action being created
        Action GetWood = new GetWood("GetWood", 1, this, TacticalStates.Goto);

        GetWood.SetPreCondition(Wstates.KnowledgeOfTree, true);
        GetWood.SetEffect(Wstates.LocatedAtTree, true);
        GetWood.destination = GameObject.FindGameObjectWithTag("Tree").transform;
        actions.Add(GetWood);
        //Action being created
        Action CutTree = new CutTree("CutTree", 1, this, TacticalStates.Goto);

        CutTree.SetPreCondition(Wstates.KnowledgeOfTree, true);
        CutTree.SetPreCondition(Wstates.LocatedAtTree, true);
        CutTree.SetEffect(Wstates.HasWood, true);
        CutTree.destination = GameObject.FindGameObjectWithTag("Tree").transform;
        actions.Add(CutTree);
        //Action being created
        Action getNails = new GetNails("GoToNails", 1, this, TacticalStates.Goto);

        getNails.SetPreCondition(Wstates.HasWood, true);
        getNails.SetPreCondition(Wstates.KnowledgeOfNails, true);
        getNails.SetEffect(Wstates.LocatedAtNails, true);
        getNails.destination = GameObject.FindGameObjectWithTag("Nails").transform;
        actions.Add(getNails);
        //Action being created
        Action pickUpNails = new PickupNails("Getting nails", 1, this, TacticalStates.Goto);

        pickUpNails.SetPreCondition(Wstates.KnowledgeOfNails, true);
        pickUpNails.SetPreCondition(Wstates.LocatedAtNails, true);
        pickUpNails.SetEffect(Wstates.HasNails, true);
        pickUpNails.destination = GameObject.FindGameObjectWithTag("Nails").transform;
        actions.Add(pickUpNails);
        //Action being created
        Action goHouse = new GoHouse("GoTo House", 1, this, TacticalStates.Goto);

        goHouse.SetPreCondition(Wstates.KnowledgeOfHouse, true);
        goHouse.SetPreCondition(Wstates.HasNails, true);
        goHouse.SetPreCondition(Wstates.HasWood, true);
        goHouse.SetEffect(Wstates.LocatedAtHouse, true);
        goHouse.destination = GameObject.FindGameObjectWithTag("house").transform;
        actions.Add(goHouse);
        //Action being created
        Action BuildHouse = new buildHouse("Build house", 1, this, TacticalStates.Goto);

        goHouse.SetPreCondition(Wstates.KnowledgeOfHouse, true);
        BuildHouse.SetPreCondition(Wstates.HasNails, true);
        BuildHouse.SetPreCondition(Wstates.HasWood, true);
        BuildHouse.SetPreCondition(Wstates.LocatedAtHouse, true);
        BuildHouse.SetEffect(Wstates.HouseIsBuilt, true);
        BuildHouse.destination = GameObject.FindGameObjectWithTag("house").transform;
        actions.Add(BuildHouse);
        //Action being created
        Action GoToTent = new GoToTent("Tent", 1, this, TacticalStates.Goto);

        GoToTent.SetPreCondition(Wstates.KnowledgeOfTent, true);
        GoToTent.SetPreCondition(Wstates.HouseIsBuilt, true);
        GoToTent.SetEffect(Wstates.LocatedAtTent, true);
        GoToTent.destination = GameObject.FindGameObjectWithTag("Tent").transform;
        actions.Add(GoToTent);
        //Action being created
        Action GoToWeapon = new GetWeapon("Weapon", 1, this, TacticalStates.Goto);

        GoToWeapon.SetPreCondition(Wstates.KnowledgeOfWeapon, true);
        GoToWeapon.SetPreCondition(Wstates.CanSeeBear, true);
        GoToWeapon.SetEffect(Wstates.HasWeapon, true);
        GoToWeapon.destination = GameObject.FindGameObjectWithTag("Weapon").transform;
        actions.Add(GoToWeapon);
        //Action being created
        Action GoBear = new GoToBear("GoBear", 1, this, TacticalStates.Goto);

        GoBear.SetPreCondition(Wstates.HasWeapon, true);
        GoBear.SetPreCondition(Wstates.CanSeeBear, true);
        GoBear.SetEffect(Wstates.LocatedAtBear, true);
        GoBear.destination = GameObject.FindGameObjectWithTag("Bear").transform;
        actions.Add(GoBear);
        //Action being created
        Action killBear = new KillBear("killing", 1, this, TacticalStates.Goto);

        killBear.SetPreCondition(Wstates.CanSeeBear, true);
        killBear.SetPreCondition(Wstates.LocatedAtBear, true);
        killBear.SetEffect(Wstates.BearDead, true);
        actions.Add(killBear);

        goals = new List <Goal>();

        //creating the goals for the AI, each goal will be initilised with a priotity and the world state conditions that will need to be met, for the AI to complete the goal
        //Goal being created
        Goal BuildGoal = new Goal(10);

        BuildGoal.condition.SetVal(Wstates.LocatedAtTree, true);
        BuildGoal.condition.SetVal(Wstates.HasWood, true);
        BuildGoal.condition.SetVal(Wstates.LocatedAtNails, true);
        BuildGoal.condition.SetVal(Wstates.HasNails, true);
        BuildGoal.condition.SetVal(Wstates.LocatedAtHouse, true);
        BuildGoal.condition.SetVal(Wstates.HouseIsBuilt, true);
        BuildGoal.condition.SetVal(Wstates.LocatedAtTent, true);
        goals.Add(BuildGoal);
        //Goal being created
        Goal KillBear = new Goal(9);

        KillBear.condition.SetVal(Wstates.CanSeeBear, true);
        KillBear.condition.SetVal(Wstates.HasWeapon, true);
        KillBear.condition.SetVal(Wstates.BearDead, true);
        goals.Add(KillBear);



        // Build the Finite State Machine
        tacticalStateMachine = new FSM <TacticalStates>(displayFSMTransitions);
        tacticalStateMachine.AddState(new Goto <TacticalStates>(TacticalStates.Goto, this, 0f));
        tacticalStateMachine.AddState(new Animate <TacticalStates>(TacticalStates.Animate, this, 0f));
        tacticalStateMachine.AddState(new UseSmartObject <TacticalStates>(TacticalStates.UseSmartObject, this, 0f));

        tacticalStateMachine.AddTransition(TacticalStates.Goto, TacticalStates.Animate);
        tacticalStateMachine.AddTransition(TacticalStates.Goto, TacticalStates.UseSmartObject);
        tacticalStateMachine.AddTransition(TacticalStates.Goto, TacticalStates.Goto);
        tacticalStateMachine.AddTransition(TacticalStates.Animate, TacticalStates.Goto);
        tacticalStateMachine.AddTransition(TacticalStates.Animate, TacticalStates.UseSmartObject);
        tacticalStateMachine.AddTransition(TacticalStates.Animate, TacticalStates.Animate);
        tacticalStateMachine.AddTransition(TacticalStates.UseSmartObject, TacticalStates.Goto);
        tacticalStateMachine.AddTransition(TacticalStates.UseSmartObject, TacticalStates.Animate);
        tacticalStateMachine.AddTransition(TacticalStates.UseSmartObject, TacticalStates.UseSmartObject);
    }