Exemplo n.º 1
0
    private string GetStringDirection(ActionInformation.AgentState agentState, int dir)
    {
        var directionStr = "forward";

        if (agentState == ActionInformation.AgentState.Walking)
        {
            if (dir == -1)
            {
                directionStr = "MB";
            }
            else
            {
                directionStr = "MF";
            }
        }
        else if (agentState == ActionInformation.AgentState.Turning)
        {
            if (dir == -1)
            {
                directionStr = "RL";
            }
            else
            {
                directionStr = "RR";
            }
        }
        return(directionStr);
    }
Exemplo n.º 2
0
    public string DoAction(ActionInformation.AgentState state, int dir)
    {
        MainControl mainControl = FindObjectOfType <MainControl>();


        if (!timeKeeper.isPaused && !isMoving)
        {
            if (state == AgentState.Turning && dir == 1)
            {
                RotateTo(1);
            }
            else if (state == AgentState.Turning && dir == -1)
            {
                RotateTo(-1);
            }
            else if (state == AgentState.Walking && dir == 1)
            {
                MoveTo(directionIndex % 6, 1, tag);
            }
            else if (state == AgentState.Walking && dir == -1)
            {
                var oppositeDir = (int)HexDirectionExtensions.Opposite((HexDirection)(directionIndex % 6));
                MoveTo(oppositeDir, -1, tag);
            }
            if (gotCard)
            {
                gotCard = false;
                return("got card");
            }
        }
        //MainControl mainControl = FindObjectOfType<MainControl>();


        return("");
    }
Exemplo n.º 3
0
    public void AddExternalAction(ActionInformation.AgentState state, int dir)
    {
        switch (mv.controlType)
        {
        case MovementType.ControlType.DiscreteQueued:
            break;

        case MovementType.ControlType.Discrete:
            break;

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

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

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

        case MovementType.ControlType.Simulated:
            simulatedControl.DoAction(state, dir);
            break;

        case MovementType.ControlType.Replay:
            replayControl.AddExternalAction(state, dir);
            break;
        }
    }
Exemplo n.º 4
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);
    }
Exemplo n.º 5
0
    public void AddExternalAction(ActionInformation.AgentState state, int dir)
    {
        var externalAction = new AgentAction();

        externalAction.agentState = state;
        externalAction.direction  = dir;
        externalActionsQ.Enqueue(externalAction);
    }
Exemplo n.º 6
0
 public override void AddAction(ActionInformation.AgentState state, int dir)
 {
     if (!timeKeeper.isPaused && !isMoving)
     {
         if (state == AgentState.Turning && dir == 1)
         {
             SetRotate(1, tag);
         }
         else if (state == AgentState.Turning && dir == -1)
         {
             SetRotate(-1, tag);
         }
         else if (state == AgentState.Walking && dir == 1)
         {
             SetMoveTo(directionIndex % 6, 1, tag);
         }
         else if (state == AgentState.Walking && dir == -1)
         {
             var oppositeDir = (int)HexDirectionExtensions.Opposite((HexDirection)(directionIndex % 6));
             SetMoveTo(oppositeDir, -1, tag);
         }
     }
 }