Beispiel #1
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));
 }
Beispiel #2
0
        public EquipmentUseResult FireWeapon(int target, string weapon)
        {
            if (!namedEquipment.ContainsKey(weapon))
            {
                throw new BdBaseException("The named equipment has not been installed.");
            }
            var v = namedEquipment[weapon];
            EquipmentUseDetails eud = new EquipmentUseDetails();

            eud.InstanceIdentity = v.InstanceId;
            eud.IParam           = target;
            var res = engineActionProvider.UseEquipmentItem(this, eud);

            if (res.State == UsageEndState.Success)
            {
            }
            return(res);
        }
Beispiel #3
0
        public EquipmentUseResult UseEquipment(Guid g)
        {
            foreach (var v in allInstalledEquipment)
            {
                if (v.InstanceId == g)
                {
                    b.Verbose.Log("Usage activation requested for item " + g.ToString());
                    EquipmentUseDetails eud = new EquipmentUseDetails();
                    eud.InstanceIdentity = v.InstanceId;
                    var res = engineActionProvider.UseEquipmentItem(this, eud);

                    if (res.State == UsageEndState.Success)
                    {
                    }
                    return(res);
                }
            }
            throw new BdBaseException("Unable to find the equpment listed");
        }
Beispiel #4
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);
        }
Beispiel #5
0
 protected abstract EquipmentUseResult ActualUseEquipmentItem(BoonBotBase targetBot, EquipmentUseDetails eud);