private Status controlStatus; // Controller Status. // Use this for initialization protected override void Awake() { base.Awake(); controlStatus = Status.IDLE; int[] sizes = mapWorld.GetMapSize(); rsize = sizes[0]; csize = sizes[1]; myMap = new char[rsize * csize]; // Initialize to " " space. for (int i = 0; i < rsize; i++) { for (int j = 0; j < csize; j++) { myMap[i * csize + j] = ' '; } } // -- objectInFov = new List <GameObject>(); botActions = gameObject.GetComponent <BotActions>(); deliberator = gameObject.GetComponent(deliberatorName) as IBotDeliberator; // Disable deliberator if deliberator exist or manual control is enabled. ManualControl mc = gameObject.GetComponent <ManualControl>(); deliberatorOn = (deliberator != null) && (mc != null) && !gameObject.GetComponent <ManualControl>().enabled; // Update current position in myMap Vector3 current = gameObject.transform.position; int[] idxs = mapWorld.GetIndexesFromWorld(current.x, current.z); mapWorld.CopyRegion(myMap, idxs[0] - 1, idxs[1] - 1, 3, 3); // Run Thread Function Every `n` second InvokeRepeating("ThinkLoop", 3, thinkTick); }
private Activity PresentNextStep(Activity activity) { var stringToParse = activity.Text.Split(' '); var commandName = stringToParse[1]; var botName = stringToParse[0]; if (botName.ToUpper() != "@SHAZBOT") { return(null); } switch (commandName.ToUpper()) { case "YOUTUBE": return(BotActions.YouTubeSearch(activity, stringToParse[2])); case "AMAZON": return(null); // Currently non functioning - Seems to be an issue getting the service to even connect... Probably something with soap clients and headers // return BotActions.AmazonSearch(activity, stringToParse[2]); case "TRANSLATE": return(null); case "FORECAST": return(BotActions.ForcastSearch(activity, stringToParse[2])); default: return(null); } }
private Authorizer(string token, UpdatesHandler updatesHandler, Secrets clientSecret) { updatesHandler.NullInspect(nameof(updatesHandler)); clientSecret.NullInspect(nameof(clientSecret)); ClientSecret = clientSecret; _botActions = new BotActions(token); AuthorizeRequestEvent += Authorizer_AuthorizeRequestEvent; }
void OnMouseDown() { bot = GameObject.Find(botName); float x = transform.position.x; float z = transform.position.z; BotActions botActions = bot.GetComponent <BotActions>(); string command = action + " " + x + " " + z; botActions.DoAction(command); }
private Status controlStatus; // Controller Status. //public StateBook internalKnowledge; // Use this for initialization protected void Awake() { controlStatus = Status.IDLE; objectInFov = new List <GameObject>(); botActions = gameObject.GetComponent <BotActions>(); deliberator = gameObject.GetComponent(deliberatorName) as IBotDeliberator; // Run Thread Function Every `n` second if (!onDemand) { InvokeRepeating("ThinkLoop", 0, thinkTick); } }
public ChosenInlineResultHandler() { try { _botActions = new BotActions(BotInitializer.Instance.BotSettings.Token); InitRules(); _dbWorker = new GmailDbContextWorker(); BotInitializer.Instance.UpdatesHandler.TelegramChosenInlineEvent += HandleChosenInlineResult; } catch (Exception ex) { throw new TypeInitializationException(nameof(ChosenInlineResultHandler), ex); } }
public InlineQueryHandler() { try { _botSettings = BotInitializer.Instance.BotSettings; _botActions = new BotActions(_botSettings.Token); _dbWorker = new GmailDbContextWorker(); InitFullAccessRules(); InitNotifyAccessRules(); BotInitializer.Instance.UpdatesHandler.TelegramInlineQueryEvent += HandleInlineQuery; } catch (Exception ex) { throw new TypeInitializationException(nameof(InlineQueryHandler), ex); } }
public NotifyHandler() { try { _botSettings = BotInitializer.Instance.BotSettings; _botActions = new BotActions(_botSettings.Token); _messageHandler = BotInitializer.Instance.MessageHandler; _dbWorker = new GmailDbContextWorker(); var authorizer = BotInitializer.Instance.Authorizer; authorizer.AuthorizationRegistredEvent += Instance_AuthorizationRegistredEvent; } catch (Exception ex) { throw new TypeInitializationException(nameof(NotifyHandler), ex); } }
public static void Handle(TwitchBot twitchBot, ChatMessage chatMessage) { if (MessageHelper.IsCommand(chatMessage)) { ((CommandType[])Enum.GetValues(typeof(CommandType))).ToList().ForEach(type => { if (chatMessage.MatchesAnyAlias(type)) { if (!BotActions.IsOnCooldown(chatMessage.Username, type)) { CommandHelper.GetCommand(type).Alias.ForEach(alias => { if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel), @"(\s|$)"))) { BotActions.AddUserToCooldownDictionary(chatMessage.Username, type); Type.GetType(CommandHelper.GetCommandClassName(type)).GetMethod(_handleName).Invoke(null, new object[] { twitchBot, chatMessage, alias }); BotActions.AddCooldown(chatMessage.Username, type); } }); } } }); twitchBot.CommandCount++; } else if (MessageHelper.IsAfkCommand(chatMessage)) { ((AfkCommandType[])Enum.GetValues(typeof(AfkCommandType))).ToList().ForEach(type => { if (chatMessage.MatchesAnyAlias(type)) { if (!BotActions.IsOnAfkCooldown(chatMessage.Username)) { CommandHelper.GetAfkCommand(type).Alias.ForEach(alias => { if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel), @"(\s|$)"))) { BotActions.AddUserToAfkCooldownDictionary(chatMessage.Username); AfkCommandHandler.Handle(twitchBot, chatMessage, type); BotActions.AddAfkCooldown(chatMessage.Username); } }); } } }); twitchBot.CommandCount++; } }
public async Task <bool> WaitUntilActionAccept(BotActions action, int timeout = 30000) { if (botActions.Count == 0) { return(true); } var waitTimes = 0; while (true && waitTimes < timeout) { if (botActions.Count == 0) { return(true); } ///implement logic of action dependent waitTimes += 1000; await Task.Delay(1000); } return(false); //timedout }
public MessageHandler() { try { _authorizer = BotInitializer.Instance.Authorizer; _dbWorker = new GmailDbContextWorker(); _botSettings = BotInitializer.Instance.BotSettings; _botActions = new BotActions(_botSettings.Token); InitFullAccessRules(); InitNotifyAccessRules(); InitFullForceReplyRules(); InitNotifyForceReplyRules(); BotInitializer.Instance.UpdatesHandler.TelegramTextMessageEvent += HandleTextMessage; BotInitializer.Instance.UpdatesHandler.TelegramTextMessageEvent += HandleForceReplyMessage; BotInitializer.Instance.UpdatesHandler.TelegramDocumentMessageEvent += HandleForceReplyMessage; BotInitializer.Instance.UpdatesHandler.TelegramAudioMessageEvent += HandleForceReplyMessage; BotInitializer.Instance.UpdatesHandler.TelegramVideoMessageEvent += HandleForceReplyMessage; } catch (Exception ex) { throw new TypeInitializationException(nameof(MessageHandler), ex); } }
//public StateBook internalKnowledge; // Use this for initialization protected void Awake() { controlStatus = Status.IDLE; objectInFov = new List<GameObject>(); botActions = gameObject.GetComponent<BotActions>(); deliberator = gameObject.GetComponent(deliberatorName) as IBotDeliberator; // Run Thread Function Every `n` second if (!onDemand) { InvokeRepeating("ThinkLoop", 0, thinkTick); } }
// Use this for initialization protected override void Awake() { base.Awake(); attributes = gameObject.GetComponent<BotAttributes>(); parentAction = gameObject.GetComponent<BotActions>(); }
// Use this for initialization void Start() { botActions = gameObject.GetComponent<BotActions>(); }
// Use this for initialization protected override void Awake() { base.Awake(); controlStatus = Status.IDLE; int[] sizes = mapWorld.GetMapSize(); rsize = sizes[0]; csize = sizes[1]; myMap = new char[rsize * csize]; // Initialize to " " space. for (int i = 0; i < rsize; i++) { for (int j = 0; j < csize; j++) { myMap[i * csize + j] = ' '; } } // -- objectInFov = new List<GameObject>(); botActions = gameObject.GetComponent<BotActions>(); deliberator = gameObject.GetComponent(deliberatorName) as IBotDeliberator; // Disable deliberator if deliberator exist or manual control is enabled. ManualControl mc = gameObject.GetComponent<ManualControl>(); deliberatorOn = (deliberator != null) && (mc != null) && !gameObject.GetComponent<ManualControl>().enabled; // Update current position in myMap Vector3 current = gameObject.transform.position; int[] idxs = mapWorld.GetIndexesFromWorld(current.x, current.z); mapWorld.CopyRegion(myMap, idxs[0] - 1, idxs[1] - 1, 3, 3); // Run Thread Function Every `n` second InvokeRepeating("ThinkLoop", 3, thinkTick); }
public BlockableScope(ISession session, BotActions action) { this.session = session; this.action = action; }
// Use this for initialization void Start() { botActions = gameObject.GetComponent <BotActions>(); }
public float speedDecreaseRate; /**< Speed decrease rate by gold. */ // Use this for initialization protected override void Awake() { base.Awake(); attributes = gameObject.GetComponent <BotAttributes>(); parentAction = gameObject.GetComponent <BotActions>(); }