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());
        }
Пример #2
0
        //public override void InvokeReal()
        //{
        //    if (avatarThinkerThread == null)
        //    {
        //        avatarThinkerThread = new Thread(Think) { Name = String.Format( };
        //        if (Actor.IsControllable)
        //        {
        //            ///  only think for ourselves
        //            avatarThinkerThread.Priority = ThreadPriority.Normal;
        //            avatarThinkerThread.Start();
        //        }
        //    }
        //    if (!avatarThinkerThread.IsAlive) avatarThinkerThread.Resume();
        //}

        public override void InvokeReal()
        {
            while (true)
            {
                try
                {
                    StartThinking();
                }
                catch (Exception e)
                {
                    Actor.Debug(e.ToString());
                }
            }
        }