Neodroid  0.2.0
Machine Learning Environment Prototyping Tool
ExternalMeshConfigurable.cs
Go to the documentation of this file.
5 using UnityEngine;
6 
7 namespace droid.Runtime.Prototyping.Configurables.Experimental {
11  [AddComponentMenu(ConfigurableComponentMenuPath._ComponentMenuPath
12  + "ExternalMesh"
13  + ConfigurableComponentMenuPath._Postfix)]
18  string _texture_str;
19 
20  [SerializeField] Texture _texture = null;
21 
25  protected override void PreSetup() { this._texture_str = this.Identifier + "Texture"; }
26 
30  protected override void RegisterComponent() {
31  this.ParentEnvironment =
32  NeodroidUtilities.RegisterComponent(this.ParentEnvironment, (Configurable)this, this._texture_str);
33  }
34 
38  protected override void UnRegisterComponent() {
39  this.ParentEnvironment?.UnRegister(this, this._texture_str);
40  }
41 
42  public override ISpace ConfigurableValueSpace { get; }
43 
47  public override void ApplyConfiguration(IConfigurableConfiguration configuration) {
48  #if NEODROID_DEBUG
49  if (this.Debugging) {
50  DebugPrinting.ApplyPrint(this.Debugging, configuration, this.Identifier);
51  }
52  #endif
53 
54  if (configuration.ConfigurableName == this._texture_str) {
55  if (this._texture) {
56  this._texture.anisoLevel = (int)configuration.ConfigurableValue;
57  }
58  }
59  }
60 
65  public override Configuration[] SampleConfigurations() {
66  return new[] {new Configuration(this._texture_str, Space1.ZeroOne.Sample())};
67  }
68  }
69 }
override void ApplyConfiguration(IConfigurableConfiguration configuration)