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); } }
public static BotInput getInstance() { { if (instance == null) { instance = new BotInput(); } return(instance); } }
/// <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; } }
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); }
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; } }); }
private void Awake() { inputManager = GetComponent <BotInput>(); animationController = GetComponent <Animator>(); }
private bool CheckInputPasswordRule(BotInput botInput, InputRule inputRule) => Regex.IsMatch(botInput.Combo.Password, inputRule.Regex);
private bool CheckInputUsernameRule(BotInput botInput, InputRule inputRule) => Regex.IsMatch(botInput.Combo.Username, inputRule.Regex);
private bool CheckInputRule(BotInput botInput, InputRule inputRule) => Regex.IsMatch(botInput.ToString(), inputRule.Regex);
// Use this for initialization void Awake() { instance = this; }