示例#1
0
    private bool EnqueueAction(string instruction)
    {
        var enqueueSuccess = true;

        switch (instruction)
        {
        case "WalkForward":
            queuedControl.AddAction(ActionInformation.AgentState.Walking, 1);
            break;

        case "WalkBackward":
            queuedControl.AddAction(ActionInformation.AgentState.Walking, -1);
            break;

        case "RotateLeft":
            queuedControl.AddAction(ActionInformation.AgentState.Turning, -1);
            break;

        case "RotateRight":
            queuedControl.AddAction(ActionInformation.AgentState.Turning, 1);
            break;

        case "Clear":
            queuedControl.StopClearAll();
            break;

        default:
            enqueueSuccess = false;
            break;
        }
        return(enqueueSuccess);
    }
示例#2
0
    //note - not doing the continuous one - highly likely not going to be using that
    public string AddAction(ActionInformation.AgentState state, int dir)
    {
        string ret = "";

        switch (mv.controlType)
        {
        case MovementType.ControlType.DiscreteQueued:
            disQueuedMovement.AddAction(state, dir);
            break;

        case MovementType.ControlType.Discrete:
            discreteMovement.AddAction(state, dir);
            break;

        case MovementType.ControlType.HexQueued:
            hexQueuedMovement.AddAction(state, dir);
            break;

        case MovementType.ControlType.HexToHex:
            hexhexControl.AddAction(state, dir);
            break;

        case MovementType.ControlType.TurnBased:
            turnControl.AddAction(state, dir);
            break;

        case MovementType.ControlType.Simulated:
            ret = simulatedControl.DoAction(state, dir);
            break;
        }
        return(ret);
    }