Exemplo n.º 1
0
Arquivo: 10.cs Projeto: jayvan/advent
        public void AddConnection(string connection)
        {
            int botId;

              Match match = constAssignment.Match(connection);
              if (match.Success) {
            int binValue = int.Parse(match.Groups[1].Captures[0].ToString());
            botId = int.Parse(match.Groups[2].Captures[0].ToString());
            var binInput = new BinInput(binValue);
            GetBot(botId).AssignInput(binInput);
            return;
              }

              match = botAssignment.Match(connection);
              botId = int.Parse(match.Groups[1].Captures[0].ToString());
              bool lowIsOutput = match.Groups[2].Captures[0].ToString() == "output";
              int lowOutputId = int.Parse(match.Groups[3].Captures[0].ToString());
              var lowBotInput = new BotInput(GetBot(botId), BotInput.OutputType.LOW);
              bool highIsOutput = match.Groups[4].Captures[0].ToString() == "output";
              int highOutputId = int.Parse(match.Groups[5].Captures[0].ToString());
              var highBotInput = new BotInput(GetBot(botId), BotInput.OutputType.HIGH);

              if (lowIsOutput) {
            outputBins.Add(lowOutputId, lowBotInput);
              } else {
            GetBot(lowOutputId).AssignInput(lowBotInput);
              }

              if (highIsOutput) {
            outputBins.Add(highOutputId, highBotInput);
              } else {
            GetBot(highOutputId).AssignInput(highBotInput);
              }
        }
Exemplo n.º 2
0
 public static BotInput getInstance()
 {
     {
         if (instance == null)
         {
             instance = new BotInput();
         }
         return(instance);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Sets whether the specified player wishes to fire or not.
 /// </summary>
 public void SetFiring(byte playerId, bool start)
 {
     if (start)
     {
         GetInput(playerId).Firing = BotFiring.ToFireFirst;
     }
     else
     {
         BotInput input = GetInput(playerId);
         input.Firing = input.Firing == BotFiring.ToFireFirst ? BotFiring.ToFireOnce : BotFiring.NotFiring;
     }
 }
Exemplo n.º 4
0
    public void onSuccess(string textSpeech)
    {
        //speechContoller control = GameObject.FindObjectOfType<speechContoller>();
        speechContoller control = speechContoller.getInstance();

        Debug.Log("ENTER callback onSuccess: " + textSpeech);
        control.settext(textSpeech);

        //BotInput chat = GameObject.FindObjectOfType<BotInput>();
        BotInput chat  = BotInput.getInstance();
        string   texto = textSpeech;

        chat.SendQuestionToRobotFromSpeech(texto);
    }
Exemplo n.º 5
0
        private void FixedUpdate()
        {
            BotCache.ForEach(structure => {
                BotInput input = GetInput(structure.Id);
                if (input.Firing == BotFiring.NotFiring)
                {
                    return;
                }

                structure.ServerTryWeaponFiring();
                if (WeaponSystem.IsSingleFiringType(structure.WeaponType) || input.Firing == BotFiring.ToFireOnce)
                {
                    input.Firing = BotFiring.NotFiring;
                }
                else if (input.Firing == BotFiring.ToFireFirst)
                {
                    input.Firing = BotFiring.ToFireMore;
                }
            });
        }
Exemplo n.º 6
0
 private void Awake()
 {
     inputManager        = GetComponent <BotInput>();
     animationController = GetComponent <Animator>();
 }
Exemplo n.º 7
0
 private bool CheckInputPasswordRule(BotInput botInput, InputRule inputRule) => Regex.IsMatch(botInput.Combo.Password, inputRule.Regex);
Exemplo n.º 8
0
 private bool CheckInputUsernameRule(BotInput botInput, InputRule inputRule) => Regex.IsMatch(botInput.Combo.Username, inputRule.Regex);
Exemplo n.º 9
0
 private bool CheckInputRule(BotInput botInput, InputRule inputRule) => Regex.IsMatch(botInput.ToString(), inputRule.Regex);
Exemplo n.º 10
0
    // Use this for initialization


    void Awake()
    {
        instance = this;
    }