Ejemplo n.º 1
0
    // Use this for initialization
    public override void Start()
    {
        base.Start();
        attackCounter = 0;

        myBrother = GameObject.FindObjectOfType <Rob>();
        //Initialize(7, 2);
        modify_TIME_PER_ACTION = TIME_PER_ACTION;
    }
Ejemplo n.º 2
0
        void _AutomateComm_OnNewTrameArduinoReceived(object sender, NewTrameArduinoReceveidEventArgs e)
        {
            byte IDRobot = e.Source.id;

            ArduinoBotIA Rob;

            if (_ListArduino.Exists(ArduinoBotIA.ById(IDRobot)))
            {
                Rob = _ListArduino.Find(ArduinoBotIA.ById(IDRobot));
            }
            else
            {
                Rob = new ArduinoBotIA(IDRobot);
                _ListArduino.Add(Rob);
            }
            switch (e.Message.headerMess)
            {
            case (byte)EMBtoPCmessHeads.ASK_CONN:
                // Rien de spécial sur la demande de connexion
                break;

            case (byte)EMBtoPCmessHeads.AUTO_MODE_OFF:
                // Fin de mode auto / le robot doit avoir pris le cube
                if (Rob.LastAction == ActionRobot.ROBOT_AUTONOME)
                {
                    Rob.LastAction = ActionRobot.ROBOT_ARRET;
                    Rob.Saisie     = true;
                    Rob.SetTrace(null);
                    // Une fois le cube saisie
                }
                else
                {
                    Logger.GlobalLogger.error("Fin de mode autnome qui n'as pas été lancé par le serveur !" + Rob.ID);
                }
                break;

            case (byte)EMBtoPCmessHeads.RESP_SENSOR:
                Logger.GlobalLogger.info("Réponse de capteur ? : : " + e.Message.ToString());
                break;

            default:
                Logger.GlobalLogger.error("Message reçu qui ne devrais pas être remonter dans L'IA : " + e.Message.ToString());
                break;
            }
            tickIA();
        }
Ejemplo n.º 3
0
        public void WhenItIsTimeForThePlayerTo(Mock <Player> playerMock, string action)
        {
            var       player = playerMock.Object;
            TurnState currentState;
            var       model = context.Get <GameModel>();

            model.ActivePlayer = player;
            switch (action.Trim())
            {
            case "build":
                currentState = new Build(model);
                break;

            case "place a city":
                currentState = new WaitCity(model);
                break;

            case "place a settlement":
                currentState = new WaitSettlement(model);
                break;

            case "place a road":
                currentState = new WaitRoad(model);
                break;

            case "roll the dice":
                currentState = new WaitRollDice(model);
                break;

            case "trade":
                currentState = new Trade(model);
                break;

            case "doTrade":
                currentState = new DoTrade(model);
                break;

            case "rob people":
                currentState = new MoveRobber(model)
                {
                    ReturnStateType = typeof(Trade)
                };
                break;

            case "steal a resource":
                var rob = new Rob(model)
                {
                    ReturnStateType = typeof(Trade)
                };
                rob.SetSelectedHex(2);
                currentState = rob;
                break;

            default:
                throw new ArgumentException("Unhandled case");
            }

            currentState.OnEnter();
            context["CurrentState"] = currentState;
            if (context.TryGetValue(out TurnManager manager))
            {
                manager.CurrentState = currentState;
            }
        }
Ejemplo n.º 4
0
        private void RobDemo_Click(object sender, RoutedEventArgs e)
        {
            var rW = new Rob();

            rW.Show();
        }