Ejemplo n.º 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);
                        }
                    }
                }
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 4
0
 public double GetCurrentHeading(BoonBotBase targetBot)
 {
     if (targetBot == null)
     {
         throw new BdBaseException("The bot can not be null for gethEading");
     }
     return(ActualGetCurrentHeading(targetBot));
 }
Ejemplo n.º 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
     });
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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
            });
        }
Ejemplo n.º 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));
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 16
0
 public void AddContestant(BoonBotBase ctst)
 {
     ctsts.Add(ctst);
 }
Ejemplo n.º 17
0
 protected abstract EquipmentInstallationResult ActualMountEquipment(BoonBotBase targetBot, int equipmentIdentifier, MountPoint mountPoint);
Ejemplo n.º 18
0
 protected abstract EquipmentUseResult ActualUseEquipmentItem(BoonBotBase targetBot, EquipmentUseDetails eud);
Ejemplo n.º 19
0
 protected abstract void ActualChangeSpeed(BoonBotBase targetBot, int byThisMuch);
Ejemplo n.º 20
0
 protected abstract void ActualChangeHeading(BoonBotBase targetBot, double byThisMuch);
Ejemplo n.º 21
0
 protected abstract int ActualGetCurrentSpeed(BoonBotBase publicId);
Ejemplo n.º 22
0
 protected abstract double ActualGetCurrentHeading(BoonBotBase boonBotBase);