public override void InvokeReal()
        {
            SimActor TheBot = (SimActor)this.TheBot;

            TimeRemaining = rand.Next(1, 3); // one to tree cycles
            while (TimeRemaining-- > 0)
            {
                String use = TypeUsage.UsageName;
                TheBot.Approach(Victem, 5);
                TheBot.Debug(ToString());
                CurrentTopic = TheBot.LastAction;
                TheBot.TalkTo(Victem, CurrentTopic);
                Thread.Sleep(8000);
                //User.ApplyUpdate(use, simObject);
            }
            BotNeeds CurrentNeeds = (BotNeeds)TheBot["CurrentNeeds"];
            BotNeeds needsBefore  = CurrentNeeds.Copy();
            BotNeeds simNeeds     = TypeUsage.ChangeActual;

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

            TheBot.Debug(ToString() + " => " + difNeeds.ShowNonZeroNeeds());
        }
        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);
        }
Пример #3
0
        public string ToDebugString()
        {
            String str = UsageName;

            str += " TextName: '" + TextName;
            str += "' totalTimeMS: " + totalTimeMS;
            str += " maximumDistance: " + maximumDistance;
            str += " ChangePromise:" + ChangePromise.ShowNonZeroNeeds();
            str += " ChangeActual:" + ChangeActual.ShowNonZeroNeeds();
            if (SpecifiedProperties.Contains("UseSit"))
            {
                str += " UseSit: " + UseSit;
            }
            if (SpecifiedProperties.Contains("UseGrab"))
            {
                str += " UseGrab: " + UseGrab;
            }
            if (SpecifiedProperties.Contains("UseAnim"))
            {
                str += " UseAnim: " + UseAnim;
            }
            if (SpecifiedProperties.Contains("LispScript"))
            {
                str += " LispScript: " + LispScript;
            }
            return(str);
        }