private void Prepare() { string path = bsf.PathToBinaries; foreach (var v in bsf.AllBots) { string fname = Path.Combine(path, v.BinaryName); if (!File.Exists(fname)) { throw new InvalidOperationException("Binary not found - Invalid Request"); } Assembly assembly = Assembly.LoadFile(fname); var nextBot = typeof(BoonBotBase); foreach (Type t in assembly.GetTypes()) { if ((t.Name == v.TypeName) && (nextBot.IsAssignableFrom(t))) { BoonBotBase p = (BoonBotBase)Activator.CreateInstance(t); if (p != null) { ctsts.Add(p); } } } } }
protected override double ActualGetCurrentHeading(BoonBotBase targetBot) { var qry = new Message_Query(MainMessageKind.QueryBotStatus, KnownSubkinds.ReadHeading); qry.PublicBotId = targetBot.PublicId; hub.Launch <Message_Query>(qry); return(qry.DParameter); }
//iprovideinteractivityend //iknowwhatbotsdo public int GetCurrentSpeed(BoonBotBase targetBot) { if (targetBot == null) { throw new BdBaseException("The bot can not be null for get speed"); } return(ActualGetCurrentSpeed(targetBot)); }
public double GetCurrentHeading(BoonBotBase targetBot) { if (targetBot == null) { throw new BdBaseException("The bot can not be null for gethEading"); } return(ActualGetCurrentHeading(targetBot)); }
protected override void ActualChangeHeading(BoonBotBase targetBot, double byThisMuch) { hub.Launch <Message_BotPerformAction>(new Message_BotPerformAction(MainMessageKind.MapObjectMovementChange, KnownSubkinds.ChangeDirection) { PublicBotId = targetBot.PublicId, DParameter = byThisMuch }); }
public void ChangeSpeed(BoonBotBase targetBot, int byThisMuch) { if (targetBot == null) { throw new BdBaseException("The bot can not be null for a change of direction"); } ActualChangeSpeed(targetBot, byThisMuch); }
public EquipmentInstallationResult MountEquipment(BoonBotBase targetBot, int equipmentIdentifier, MountPoint mountPoint) { if (targetBot == null) { throw new BdBaseException("The bot can not be null for a change of direction"); } return(ActualMountEquipment(targetBot, equipmentIdentifier, mountPoint)); }
private void CreateNewBotMamagementReference(BoonBotBase bot, int p) { BotManagementReference bmr = new BotManagementReference(); bmr.EngineIdentity = p; bmr.PublicIdentity = Guid.NewGuid(); bmr.DirectReference = bot; botReferences.Add(bmr); }
private MappedBot CreateMappedBot(BoonBotBase bot) { var result = new MappedBot(bot); result.Position = Point.Empty; result.IsActive = false; mappedObjects.Add(result); CreateNewBotMamagementReference(bot, result.EngineId); return(result); }
protected override int ActualGetCurrentSpeed(BoonBotBase targetBot) { var qry = new Message_Query(MainMessageKind.QueryBotStatus, KnownSubkinds.ReadSpeed); qry.PublicBotId = targetBot.PublicId; hub.Launch <Message_Query>(qry); NavigationInfoContext nic = (NavigationInfoContext)qry.ResponseContext; b.Assert.True(nic != null, "The response cant have a null value"); return(nic.SpeedDelta); }
protected override void ActualChangeSpeed(BoonBotBase targetBot, int byThisMuch) { NavigationInfoContext nic = new NavigationInfoContext(); nic.PublicBotId = targetBot.PublicId; nic.SpeedDelta = byThisMuch; hub.Launch <Message_BotPerformAction>(new Message_BotPerformAction(MainMessageKind.MapObjectMovementChange, KnownSubkinds.ChangeSpeed) { RequestContext = nic }); }
public EquipmentUseResult UseEquipmentItem(BoonBotBase targetBot, EquipmentUseDetails eud) { if (targetBot == null) { throw new BdBaseException("The bot can not be null for a change of direction"); } if (eud == null) { throw new BdBaseException("The EUD mustn be specified"); } return(ActualUseEquipmentItem(targetBot, eud)); }
public int AddBot(BoonBotBase bot) { if (activeWorld == null) { throw new BdBaseException("No world loaded"); } if (botReferences.Count >= activeWorld.Map.MaxSupportedBots) { throw new BdBaseException("Too many bots"); } MappedBot mo = CreateMappedBot(bot); this.CanBattleStart = true; return(mo.EngineId); }
protected override EquipmentUseResult ActualUseEquipmentItem(BoonBotBase targetBot, EquipmentUseDetails eud) { EquipmentUseRequestContext euc = new EquipmentUseRequestContext(); euc.OwningBotIdentity = targetBot.PublicId; euc.RequestedEquipmentInstance = eud.InstanceIdentity; euc.IParam = eud.IParam; var msg = new Message_BotPerformAction(MainMessageKind.BotActivity, KnownSubkinds.UseEquipment) { PublicBotId = targetBot.PublicId, RequestContext = euc }; hub.Launch <Message_BotPerformAction>(msg); EquipmentUseResult eur = (EquipmentUseResult)msg.ResponseContext; return(eur); }
protected override EquipmentInstallationResult ActualMountEquipment(BoonBotBase targetBot, int equipmentIdentifier, MountPoint mountPoint) { EquipmentInstallationContext eic = new EquipmentInstallationContext(); eic.OwningBotIdentity = targetBot.PublicId; eic.EquipmentIdentifier = equipmentIdentifier; eic.MountPoint = mountPoint; var msg = new Message_BotPerformAction(MainMessageKind.Workshop, KnownSubkinds.InstallEquipment) { PublicBotId = eic.OwningBotIdentity, RequestContext = eic }; hub.Launch <Message_BotPerformAction>(msg); EquipmentInstallationResult eur = (EquipmentInstallationResult)msg.ResponseContext; // b.Assert.True(eur != null, "The return result is null, the wrong type of return is being done or no message was handled."); return(eur); }
public void AddContestant(BoonBotBase ctst) { ctsts.Add(ctst); }
protected abstract EquipmentInstallationResult ActualMountEquipment(BoonBotBase targetBot, int equipmentIdentifier, MountPoint mountPoint);
protected abstract EquipmentUseResult ActualUseEquipmentItem(BoonBotBase targetBot, EquipmentUseDetails eud);
protected abstract void ActualChangeSpeed(BoonBotBase targetBot, int byThisMuch);
protected abstract void ActualChangeHeading(BoonBotBase targetBot, double byThisMuch);
protected abstract int ActualGetCurrentSpeed(BoonBotBase publicId);
protected abstract double ActualGetCurrentHeading(BoonBotBase boonBotBase);