1 using System.Collections.Generic;
8 namespace droid.Runtime.Prototyping.Configurables.Experimental {
12 [AddComponentMenu(ConfigurableComponentMenuPath._ComponentMenuPath
13 +
"ScreenSpaceOcclusion" 14 + ConfigurableComponentMenuPath._Postfix)]
15 [RequireComponent(typeof(Renderer))]
47 Camera _camera = null;
49 [SerializeField] GameObject[] _prefabs = null;
50 List<GameObject> _spawned =
new List<GameObject>();
52 [SerializeField]
int num_obstructions = 10;
58 this._r = this.Identifier +
"R";
59 this._g = this.Identifier +
"G";
60 this._b = this.Identifier +
"B";
61 this._a = this.Identifier +
"A";
63 if (Application.isPlaying &&
this._fsafas) {
64 if (this._prefabs != null && this._prefabs.Length > 0 &&
this._camera) {
65 for (var i = 0; i < this.num_obstructions; i++) {
68 var xy = this.xy_space2.
Sample();
69 var z = this._camera.nearClipPlane + this.depth_space1.
Sample() * this._camera.farClipPlane;
71 var a =
new Vector3(xy.x, xy.y, z);
73 var c = this._camera.ViewportToWorldPoint(a);
75 var rot = this.rot_space.
Sample();
76 var b =
new Quaternion(rot.x, rot.y, rot.z, rot.w);
78 var d = Instantiate(prefab, c, b, this.transform);
79 d.transform.localScale = this.size_space.
Sample();
93 this.ParentEnvironment =
94 NeodroidUtilities.RegisterComponent(this.ParentEnvironment, (
Configurable)
this, this._r);
95 this.ParentEnvironment =
96 NeodroidUtilities.RegisterComponent(this.ParentEnvironment, (
Configurable)
this, this._g);
97 this.ParentEnvironment =
98 NeodroidUtilities.RegisterComponent(this.ParentEnvironment, (
Configurable)
this, this._b);
99 this.ParentEnvironment =
100 NeodroidUtilities.RegisterComponent(this.ParentEnvironment, (
Configurable)
this, this._a);
107 if (this.ParentEnvironment == null) {
111 this.ParentEnvironment.UnRegister(
this, this._r);
112 this.ParentEnvironment.UnRegister(
this, this._g);
113 this.ParentEnvironment.UnRegister(
this, this._b);
114 this.ParentEnvironment.UnRegister(
this, this._a);
117 public override ISpace ConfigurableValueSpace {
get; }
123 var aa =
Random.Range(0, this._spawned.Count);
124 foreach (var bb
in this._spawned) {
125 var xy = this.xy_space2.
Sample();
126 var z = this._camera.nearClipPlane + this.depth_space1.
Sample() * this._camera.farClipPlane;
128 var a =
new Vector3(xy.x, xy.y, z);
130 var c = this._camera.ViewportToWorldPoint(a);
132 var rot = this.rot_space.
Sample();
133 var b =
new Quaternion(rot.x, rot.y, rot.z, rot.w);
135 bb.transform.localScale = this.size_space.
Sample();
137 bb.transform.position = c;
139 bb.transform.rotation = b;
142 if (this.Debugging) {
143 DebugPrinting.ApplyPrint(this.Debugging, configuration, this.Identifier);
153 var s = this.depth_space1.
Sample();
override Configuration [] SampleConfigurations()
override void ApplyConfiguration(IConfigurableConfiguration configuration)
override void RegisterComponent()
override void UnRegisterComponent()