protected static bool SetWorkoutTone(SimDescription sim, AthleticGameObject.WorkOut interaction) { List <InteractionToneDisplay> tones = interaction.AvailableTonesForDisplay(); if ((tones == null) || (tones.Count == 0)) { return(false); } interaction.CurrentITone = RandomUtil.GetRandomObjectFromList(tones).InteractionTone; return(true); }
protected override bool PrivateUpdate(ScenarioFrame frame) { try { float increment = Event.mIncrement * 60; AthleticGameObject.WorkOut interaction = Sim.CreatedSim.CurrentInteraction as AthleticGameObject.WorkOut; if (interaction != null) { if (interaction.CurrentITone == null) { if (SetWorkoutTone(Sim, interaction)) { IncStat("Tone " + interaction.CurrentITone.Name()); } } ReferenceWrapper reference = new ReferenceWrapper(interaction); float value = 0; if (sTimedPassed.TryGetValue(reference, out value)) { if (value > 180) { Sim.CreatedSim.InteractionQueue.CancelInteraction(Sim.CreatedSim.CurrentInteraction, true); IncStat("Auto Cancelled"); } } sTimedPassed[reference] = value + increment; } if (!Sim.CreatedSim.Autonomy.IsRunningHighLODSimulation) { Sim.UpdateBodyShape(increment, Sim.CreatedSim.ObjectId); } return(true); } catch (Exception e) { IncStat("Exception Fail"); Common.DebugException(Sim, e); return(false); } }