Пример #1
0
    public override void generateTransitions(ref DefaultState currentState, ref DefaultState previousState, ref DefaultState idealGoalState, ref List <DefaultAction> transitions)
    {
        List <Vector3> moves = new List <Vector3>();

        moves.Add(new Vector3(1.0f, 0.0f, 0.0f));
        moves.Add(new Vector3(-1.0f, 0.0f, 0.0f));
        moves.Add(new Vector3(0.0f, 0.0f, 1.0f));
        moves.Add(new Vector3(0.0f, 0.0f, -1.0f));

        FringePlanningState curState = currentState as FringePlanningState;

        foreach (Vector3 move in moves)
        {
            if ((move + curState.state).x < x_max && (move + curState.state).x >= x_min &&
                (move + curState.state).z < z_max && (move + curState.state).z >= z_min)
            {
                FringePlanningAction action = new FringePlanningAction();
                action.cost      = 1;
                action.direction = move;
                FringePlanningState st = new FringePlanningState(curState.state + move);
                action.state = st;
                transitions.Add(action);
            }
        }
    }
Пример #2
0
    public override void generateTransitions(ref DefaultState currentState, ref DefaultState previousState, ref DefaultState idealGoalState, ref List<DefaultAction> transitions)
    {
        List<Vector3> moves = new List<Vector3>();
        moves.Add(new Vector3(1.0f, 0.0f, 0.0f));
        moves.Add(new Vector3(-1.0f, 0.0f, 0.0f));
        moves.Add(new Vector3(0.0f, 0.0f, 1.0f));
        moves.Add(new Vector3(0.0f, 0.0f, -1.0f));

        FringePlanningState curState = currentState as FringePlanningState;

        foreach(Vector3 move in moves)
        {
            if((move + curState.state).x < x_max && (move + curState.state).x >= x_min &&
               (move + curState.state).z < z_max && (move + curState.state).z >= z_min)
            {
                FringePlanningAction action =  new FringePlanningAction();
                action.cost = 1;
                action.direction = move;
                FringePlanningState st = new FringePlanningState(curState.state + move);
                action.state = st;
                transitions.Add(action);
            }
        }
    }