5 namespace droid.Runtime.Managers {
9 [AddComponentMenu(
"Neodroid/Managers/NeodroidManager")]
14 [Header(
"Warning! Will block editor requiring a restart, if not terminated while receiving.",
19 bool _allow_in_editor_blockage =
false;
24 #region UnityCallbacks 30 if (this.Configuration.SimulationType ==
SimulationType.Frame_dependent_) {
31 this.EarlyUpdateEvent += this.PauseSimulation;
32 this.UpdateEvent += this.MaybeResume;
33 }
else if (this.Configuration.SimulationType ==
SimulationType.Physics_dependent_) {
35 if (this._allow_in_editor_blockage) {
36 this.EarlyFixedUpdateEvent +=
39 Debug.LogWarning(
"Physics dependent blocking in editor is not enabled and is therefore not receiving or sending anything.");
42 this.EarlyFixedUpdateEvent += this.Receive;
49 #region PrivateMethods 57 Debug.Log(
"Resuming simulation because of stepping");
61 this.ResumeSimulation(this.Configuration.TimeScale);
62 }
else if (this.TestActuators) {
65 Debug.Log(
"Resuming simulation because of TestActuators");
69 this.ResumeSimulation(this.Configuration.TimeScale);
73 Debug.Log(
"Not resuming simulation because of stepping");
81 public bool IsSimulationPaused {
get {
return !(this.SimulationTimeScale > 0); } }
85 void PauseSimulation() {
88 Debug.Log(
"Pausing simulation");
91 this.SimulationTimeScale = 0;
97 void ResumeSimulation(
float simulation_time_scale) {
100 Debug.Log(
"Resuming simulation");
103 this.SimulationTimeScale = simulation_time_scale > 0 ? simulation_time_scale : 1;
106 void SetAnimationSpeeds(
float speed) {
107 var animators = FindObjectsOfType<Animator>();
108 foreach (var animator
in animators) {
109 animator.speed = speed;
116 var reaction = this._Message_Server.Receive(TimeSpan.Zero);
117 this.SetReactionsFromExternalSource(reaction);
SimulationType
Determines the discrete timesteps of the simulation environment.