Exemple #1
0
        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);
                        }
                    }
                }
            }
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        //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));
        }
Exemple #4
0
 public double GetCurrentHeading(BoonBotBase targetBot)
 {
     if (targetBot == null)
     {
         throw new BdBaseException("The bot can not be null for gethEading");
     }
     return(ActualGetCurrentHeading(targetBot));
 }
Exemple #5
0
 protected override void ActualChangeHeading(BoonBotBase targetBot, double byThisMuch)
 {
     hub.Launch <Message_BotPerformAction>(new Message_BotPerformAction(MainMessageKind.MapObjectMovementChange, KnownSubkinds.ChangeDirection)
     {
         PublicBotId = targetBot.PublicId,
         DParameter  = byThisMuch
     });
 }
Exemple #6
0
 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);
 }
Exemple #7
0
 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));
 }
Exemple #8
0
        private void CreateNewBotMamagementReference(BoonBotBase bot, int p)
        {
            BotManagementReference bmr = new BotManagementReference();

            bmr.EngineIdentity  = p;
            bmr.PublicIdentity  = Guid.NewGuid();
            bmr.DirectReference = bot;
            botReferences.Add(bmr);
        }
Exemple #9
0
        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);
        }
Exemple #10
0
        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);
        }
Exemple #11
0
        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
            });
        }
Exemple #12
0
 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));
 }
Exemple #13
0
        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);
        }
Exemple #14
0
        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);
        }
Exemple #15
0
        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);
        }
Exemple #16
0
 public void AddContestant(BoonBotBase ctst)
 {
     ctsts.Add(ctst);
 }
Exemple #17
0
 protected abstract EquipmentInstallationResult ActualMountEquipment(BoonBotBase targetBot, int equipmentIdentifier, MountPoint mountPoint);
Exemple #18
0
 protected abstract EquipmentUseResult ActualUseEquipmentItem(BoonBotBase targetBot, EquipmentUseDetails eud);
Exemple #19
0
 protected abstract void ActualChangeSpeed(BoonBotBase targetBot, int byThisMuch);
Exemple #20
0
 protected abstract void ActualChangeHeading(BoonBotBase targetBot, double byThisMuch);
Exemple #21
0
 protected abstract int ActualGetCurrentSpeed(BoonBotBase publicId);
Exemple #22
0
 protected abstract double ActualGetCurrentHeading(BoonBotBase boonBotBase);