public virtual void InvokeBotSideEffect(SimAvatar TheBot)
        {
            Debug(TheBot, ToString());
            //User.ApplyUpdate(use, simObject);
            BotNeeds CurrentNeeds = (BotNeeds)TheBot["CurrentNeeds"];

            if (CurrentNeeds == null)
            {
                TheBot["CurrentNeeds"] = CurrentNeeds = new BotNeeds(90.0f);
            }
            BotNeeds needsBefore = CurrentNeeds.Copy();
            BotNeeds update      = Target.Affordances.GetActualUpdate(TypeUsage.UsageName);

            //TODO rate interaction and update TheBot.Assumptions
            CurrentNeeds.AddFrom(update);
            CurrentNeeds.SetRange(0.0F, 100.0F);
            BotNeeds difNeeds = CurrentNeeds.Minus(needsBefore);

            Debug(TheBot, TheBot + " " + ToString() + "\n\t " +
                  TheBot.DistanceVectorString(Target)
                  + "=> " + difNeeds.ShowNonZeroNeeds());
            if (TheBot is SimActor)
            {
                ((SimActor)TheBot).ExecuteLisp(this, TypeUsage);
            }
            Thread.Sleep(TypeUsage.totalTimeMS);
        }
Пример #2
0
        public string DebugInfo()
        {
            String s = String.Format("\n{0}", ToString());

            int show = 10;

            var KnowsAboutList = ObservedActor.GetKnownObjects();

            lock (KnowsAboutList)
            {
                KnowsAboutList.Sort(CompareObjects);
                s += String.Format("\nKnowsAboutList: {0}", KnowsAboutList.Count);
                foreach (SimObject item in KnowsAboutList)
                {
                    show--;
                    if (show < 0)
                    {
                        break;
                    }
                    /// if (item is ISimAvatar) continue;
                    s += String.Format("\n   {0} {1}", item, ObservedActor.DistanceVectorString(item));
                }
            }

            show = 10;
            List <SimTypeUsage> KnownTypeUsages = new List <SimTypeUsage>(ObservedActor.KnownTypeUsages);

            KnownTypeUsages.Sort(CompareUsage);
            s += String.Format("\nKnownTypeUsages: {0}", KnownTypeUsages.Count);
            foreach (SimTypeUsage item in KnownTypeUsages)
            {
                show--;
                if (show < 0)
                {
                    break;
                }
                /// if (item is ISimAvatar) continue;
                s += String.Format("\n   {0} {1}", item, item.RateIt(CurrentNeeds));
            }

            s += String.Format("\nCurrentNeeds: {0}", CurrentNeeds);
            s += String.Format("\nNextAction: {0}", GetNextAction());
            s += String.Format("\nLastAction: {0}", ObservedActor.LastAction);
            s += String.Format("\nCurrentAction: {0}", Actor.CurrentAction);
            return(s);
        }
Пример #3
0
 public virtual void InvokeBotSideEffect(SimAvatar TheBot)
 {
     Debug(TheBot, ToString());
     //User.ApplyUpdate(use, simObject);
     BotNeeds CurrentNeeds = (BotNeeds)TheBot["CurrentNeeds"];
     if (CurrentNeeds == null)
     {
         TheBot["CurrentNeeds"] = CurrentNeeds = new BotNeeds(90.0f);   
     }                
     BotNeeds needsBefore = CurrentNeeds.Copy();
     BotNeeds update = Target.Affordances.GetActualUpdate(TypeUsage.UsageName);
     //TODO rate interaction and update TheBot.Assumptions
     CurrentNeeds.AddFrom(update);
     CurrentNeeds.SetRange(0.0F, 100.0F);
     BotNeeds difNeeds = CurrentNeeds.Minus(needsBefore);
     Debug(TheBot,TheBot + " " + ToString() + "\n\t " +
                  TheBot.DistanceVectorString(Target)
                  + "=> " + difNeeds.ShowNonZeroNeeds());
     if (TheBot is SimActor) ((SimActor)TheBot).ExecuteLisp(this, TypeUsage);
     Thread.Sleep(TypeUsage.totalTimeMS);
 }
Пример #4
0
 public MoveToLocation(SimAvatar impl, SimPosition position)
     : base("MoveTo " + impl + " -> " + impl.DistanceVectorString(position))
 {
     TheBot = (SimControllableAvatar)impl; 
     Target = position;
 }
 public MoveToLocation(SimAvatar impl, SimPosition position)
     : base("MoveTo " + impl + " -> " + impl.DistanceVectorString(position))
 {
     TheBot = (SimControllableAvatar)impl;
     Target = position;
 }