8 namespace droid.Runtime.Prototyping.Configurables.Experimental {
12 [AddComponentMenu(ConfigurableComponentMenuPath._ComponentMenuPath
14 + ConfigurableComponentMenuPath._Postfix)]
15 [RequireComponent(typeof(Renderer))]
17 [SerializeField] Texture[] _textures = null;
18 [SerializeField]
bool load_from_resources_if_empty =
true;
19 [SerializeField] Texture _texture = null;
20 [SerializeField] Renderer _renderer = null;
21 [SerializeField]
bool use_shared =
false;
22 [SerializeField] Material _mat;
23 [SerializeField]
int _last_sample;
24 static readonly Int32 _main_tex = Shader.PropertyToID(
"_BumpMap");
30 this._renderer = this.GetComponent<Renderer>();
31 if (Application.isPlaying) {
32 if (this.use_shared) {
33 this._mat = this._renderer?.sharedMaterial;
35 this._mat = this._renderer?.material;
39 if (this.load_from_resources_if_empty) {
40 if (this._textures == null || this._textures.Length == 0) {
41 this._textures = Resources.LoadAll<Texture>(
"Textures");
46 public override ISpace ConfigurableValueSpace {
get; }
54 DebugPrinting.ApplyPrint(this.Debugging, configuration, this.Identifier);
60 this._mat.SetTexture(_main_tex,
this._texture);
68 this._last_sample =
int.Parse(
Random.Range(0,
this._textures.Length).ToString());
70 return new[] {
new Configuration(this.Identifier, this._last_sample)};
override Configuration [] SampleConfigurations()
override void ApplyConfiguration(IConfigurableConfiguration configuration)