Exemple #1
0
 public void DiscardCard() //...............Discard Action cards......................
 {
     int count = 1;
     Console.WriteLine("Choose a card to Discard");
     
     foreach (Action card in ActionHand)
     {
         Console.Write("{0}). {1}, ", count, card.Name.ToString());
         count += 1;
     }
     Int32.TryParse(Console.ReadLine(), out int query2);
     //Instead of backing out, which is difficult, it assumes the first card will be dropped
     if (query2 < 1 || query2 > ActionHand.Count) query2 = 1;
     Discard.Add(ActionHand[query2-1]);
     ActionHand.RemoveAt(query2 - 1);
 }
Exemple #2
0
    private ActionHand getActionAndHand(CommandType commandType)
    {
        ActionHand actionHand = null;

        switch (commandType)
        {
        case CommandType.ActivateLeft:
            actionHand = new ActionHand(Action.Activate, Hands.Left);
            break;

        case CommandType.ActivateRight:
            actionHand = new ActionHand(Action.Activate, Hands.Right);
            break;

        case CommandType.DeactivateLeft:
            actionHand = new ActionHand(Action.Deactivate, Hands.Left);
            break;

        case CommandType.DeactivateRight:
            actionHand = new ActionHand(Action.Deactivate, Hands.Right);
            break;

        case CommandType.LeaveLeft:
            actionHand = new ActionHand(Action.Release, Hands.Left);
            break;

        case CommandType.LeaveRight:
            actionHand = new ActionHand(Action.Release, Hands.Right);
            break;

        case CommandType.LookAt:
            actionHand = new ActionHand(Action.Release);
            break;

        case CommandType.Speech:
            actionHand = new ActionHand(Action.Speak);
            break;

        case CommandType.LookFor:
            actionHand = new ActionHand(Action.LookFor);
            break;

        case CommandType.Move:
            actionHand = new ActionHand(Action.Move);
            break;

        case CommandType.TakeLeft:
            actionHand = new ActionHand(Action.Take, Hands.Left);
            break;

        case CommandType.TakeRight:
            actionHand = new ActionHand(Action.Take, Hands.Right);
            break;

        case CommandType.Turn:
            actionHand = new ActionHand(Action.Turn);
            break;

        case CommandType.HeadReset:
            actionHand = new ActionHand(Action.HeadReset);
            break;

        case CommandType.Rotate:
            actionHand = new ActionHand(Action.Rotate);
            break;

        case CommandType.TasteLeft:
            actionHand = new ActionHand(Action.Taste, Hands.Left);
            break;

        case CommandType.TasteRight:
            actionHand = new ActionHand(Action.Taste, Hands.Right);
            break;

        case CommandType.SmellLeft:
            actionHand = new ActionHand(Action.Smell, Hands.Left);
            break;

        case CommandType.SmellRight:
            actionHand = new ActionHand(Action.Smell, Hands.Right);
            break;

        case CommandType.CancelCommands:
            actionHand = new ActionHand(Action.Cancel);
            break;

        default:
            actionHand = null;
            break;
        }

        return(actionHand);
    }
Exemple #3
0
    private void processCommand(string data)
    {
        string        idCommand     = getCommandId(data);
        CommandType   commandType   = getCommandType(data);
        ParameterType parameterType = getParameterType(data);

        if (checkCmdParType(commandType, parameterType))
        {
            ActionHand ah = getActionAndHand(commandType);
            if (ah != null)
            {
                switch (parameterType)
                {
                case ParameterType.WithId:
                    int        id = getId(data);
                    GameObject gO = getGameObjectById(id);
                    runningCommands.Add(scm.sendCommand(idCommand, ah.hand, ah.action, gO.transform));
                    break;

                case ParameterType.WithPos:
                    Position3 position    = getPosition(data);
                    Vector3   auxPosition = new Vector3(position.x, position.y, position.z);
                    runningCommands.Add(scm.sendCommand(idCommand, ah.hand, ah.action, auxPosition));
                    break;

                case ParameterType.WithString:
                    string str = getText(data);
                    runningCommands.Add(scm.sendCommand(idCommand, ah.action, str));
                    break;

                case ParameterType.WithAngle:
                    float angle = getAngle(data);
                    runningCommands.Add(scm.sendCommand(idCommand, ah.action, angle));

                    break;

                case ParameterType.WithoutParameter:
                    if (ah.isToUseHand())
                    {
                        runningCommands.Add(scm.sendCommand(idCommand, ah.hand, ah.action));
                    }
                    else
                    {
                        runningCommands.Add(scm.sendCommand(idCommand, ah.action));
                    }
                    break;

                default:
                {
                    break;
                }
                }
            }
            else
            {
                Response response = new Response {
                    idCommand = idCommand, executed = false
                };
                sendResponse(response);
            }
        }
    }
Exemple #4
0
 public void DiscardCard(Action card) //base method to discard card....................
 {
     Discard.Add(card);
     ActionHand.Remove(card);
     Shuffle(1);
 }
Exemple #5
0
 public ConsoleColor Color { get; set; } //Player Color on the Console................
 //.............................Begin Functions.......................................
 public void DrawCard() //....................Draw action cards.......................
 {
     ActionHand.Add(Deck.Actions.First()); 
     Deck.Actions.RemoveAt(0);
 }