//public int run_status; //updated by behavior tree.
 void Start()
 {
     current_story_status = story_status.Meeting_One_Point;
     update_current_story_status = story_status.Meeting_One_Point;
     previous_status = story_status.Meeting_One_Point;
     user_status = user_input_status.None_input;
     box_move_flag = false;
     soccer_play_flag = false;
 }
    public virtual RunStatus current_story_arc(story_status story)
    {
        //print (" character behavior problem");
        //return RunStatus.Failure;

        if (this.Behavior_tree_state.current_story_status != story) {
        print ("success");

            return RunStatus.Success;
        }
        else
        { print ("fail");
            return RunStatus.Failure;
        }
    }
    // State Machine operate on only user input.
    void Update()
    {
        /*user_input_controller*/
        if(Input.GetKey("up")) //moving box.
            user_status = user_input_status.Box_Move;
        if(Input.GetKey("down")) //soccer play.
            user_status= user_input_status.Soccer_Play;
        else //for other input key ignore now. but probably enxtended to others.
            user_status= user_input_status.None_input;

        switch(current_story_status)
        {
            case story_status.Meeting_One_Point:
                if (user_status ==user_input_status.Box_Move) {
                    if (meet_one_point) {
                        update_current_story_status = story_status.Box_Moving;
                        print ("current state is meeting one point");
                    }
                }
                break;
            case story_status.Box_Moving:
                if (user_status==user_input_status.Soccer_Play) {
                    update_current_story_status=story_status.Soccer_Playing;
                    if(!box_move_flag) // box not yet moved all.
                        previous_status=story_status.Box_Moving;

                    //update_current_story_status=story_status.Soccer_Playing;
                }
                break;
            case story_status.Soccer_Playing:
                if (soccer_play_flag==true) {
                    if (previous_status==story_status.Box_Moving)
                        update_current_story_status=story_status.Box_Moving;
                    else
                        update_current_story_status=story_status.Shaking_hands_and_Bye;
                }
                break;
            case story_status.Shaking_hands_and_Bye:
                update_current_story_status=story_status.The_End;
                break;
        }

        // update current story state. ? how the sync with node.
        current_story_status = update_current_story_status;
    }
 protected Node ST_check_status(story_status story)
 {
     return new DecoratorLoop (new Sequence(Daniel.GetComponent<BehaviorMecanim> ().ST_checking_status(story), new LeafWait (1000)));
 }
 public Node ST_checking_status(story_status story)
 {
     print (" do you have a problem here");
     return new LeafInvoke (() => this.Character.current_story_arc(story));
 }