public void UseAspect(BotMentalAspect someAspect) { try { if (someAspect is BotAction) { BotAction act = (BotAction)someAspect; act.InvokeReal(); return; } if (InDialogWith != null) { Actor.TalkTo(InDialogWith, someAspect); return; } if (someAspect is SimObject) { SimObject someObject = (SimObject)someAspect; DoBestUse(someObject); } } finally { //if (IsThinking) // CurrentAction = this; } }
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()); }